JSPÖÐ404´íÎóµÄ½â¾ö
404´íÎóÊÇʲôʱºò²úÉúµÄÄØ£¿µ±ÎÒÃÇͨ¹ýä¯ÀÀÆ÷ÇëÇó·þÎñÆ÷ÉϵÄij¸ö×ÊÔ´µÄʱºò£¬¿ÉÄÜÊÇJSP£¬Ò²¿ÉÄÜÊÇServlet£¬Èç¹ûÒª·ÃÎʵÄ×ÊÔ´²»´æÔÚ£¬¾Í»á²úÉú404´íÎó£¬404´íÎó¿ÉÄÜÊÇÓ¦Óñ¾ÉíµÄÎÊÌ⣬ÀýÈçûÓÐÕý³£²¿Êð¡¢Ãû×Öд´íÁË£¬Ò²¿ÉÄÜÊÇÎļþµÄÎÊÌ⣬JSPÎļþ²»´æÔÚ¡¢Ãû×Ö´íÎ󣬻òÕßServleûÓÐÅäÖá£
¸ù¾ÝÕâЩÇé¿ö£¬404´íÎóµÄ½â¾ö·½·¨ÈçÏ£º
1¡¢ webÓ¦ÓÃûÓв¿Êð³É¹¦£º´Ó¿ØÖÆ̨(http://localhost:7001/console)µÄdeploymentsÏÂÃæ¿´£¬Òª×¢Òâ״̬¡£Èç¹ûûÓв¿Êð³É¹¦£¬¿ÉÒÔµ½¿ØÖÆ̨£¨Æô¶¯·þÎñÆ÷µÄÃüÁîÐд°¿Ú£©²é¿´´íÎó¡£Èç¹ûʹÓÃÁËTomcat£¬Ôòͨ¹ýhttp://localhost:8080£¬ÔÙÑ¡Ôñ¹ÜÀí½çÃæ¡£
2¡¢ WebÓ¦ÓõÄÃû×Ö£¨Êµ¼ÊÉÏÊÇ·ÃÎÊ·½Ê½£¬Í¨³£ÊÇcontext-root£©£¬²é¿´·½Ê½£ºÔÚ¹¤³ÌÉϵãÓÒ¼ü£¬Ñ¡Ôñ“Properties”£¬Ñ¡ÔñMyEclipseàWeb£¬½çÃæÖеÄWeb Context-root.
3¡¢ ×ÊÔ´µÄÃû×Ö£¨JSPºÍservlet£©
Èç¹ûÊÇJSPÎļþ£¬×Ðϸ¿´ÎļþÃû×ÖÊÇ·ñд´í¡££¨ÔÚMyEclipseÖпª·¢µÄʱºò£¬JSPÎļþ·ÅÔÚweb-rootÖУ¬²»ÄÜ·Å´í£¬Èç¹ûÓÐÆäËûÎļþ¼Ð£¬·ÃÎÊ·½Ê½ÖÐҪд³öÎļþ¼Ð£©Èç¹ûûÓдíÎó£¬×Ðϸ¿´ÎļþÖÐÊÇ·ñͨ¹ýjsp:forward»òÕßjsp:includeµÈ·ÃÎÊ·½Ê½·ÃÎÊÁËÆäËûÎļþ£¬¿´ÆäËûÎļþÊÇ·ñ´æÔÚ¡£
Èç¹ûÊÇServlet£¬²é¿´web.xmlÎĵ²£º
<servlet-mapping>
<servlet-name>XXXXServlet</servlet-name>
<url-pattern>/XXXX</url-pattern>
</servlet-mapping>
ÆäÖÐurl-patternµÄÄÚÈݾö¶¨ÁË·ÃÎÊ·½Ê½¡£
Èç¹ûÕâ¸öServletµÄÅäÖÃûÓдíÎó£¬Òª²é¿´¸ÃServletÎļþÖÐÊÇ·ñ·ÃÎÊÁËÆäËûÎļþ£¬²é¿´Ëù·ÃÎʵÄÎļþÊÇ·ñ´æÔÚ¡£
4¡¢ Èç¹ûÉÏÃæÕâЩ´íÎó¶¼Ã»ÓУ¬¿ÉÄÜÊÇϵͳµÄ»º´æÎÊÌ⣬°üÀ¨¿Í»§¶Ëä¯ÀÀÆ÷ºÍ·þÎñÆ÷µÄÁÙʱÎļþ¡£½â¾ö·½·¨£ºÉ¾³ýÒ³Ã滺´æ£¬É¾³ý·þÎñÆ÷ÉϵĻº´æ£¬ÖØÐÂÆô¶¯ä¯ÀÀÆ÷£¬ÖØбàÒ빤³ÌÖØв¿Ê𣬹رÕÓ¦Ó÷þÎñÆ÷£¬ÖØÐÂÆô¶¯Ó¦Ó÷þÎñÆ÷£¬ÖØзÃÎÊ¡£
Ïà¹ØÎĵµ£º
ÔÚʹÓÃÊý¾Ý¿âµÄ¹ý³ÌÖУ¬²»¿É±ÜÃâµÄÐèҪʹÓõ½·ÖÒ³µÄ¹¦ÄÜ£¬¿ÉÊÇJDBCµÄ¹æ·¶¶Ô´ËȴûÓкܺõĽâ¾ö¡£¶ÔÓÚÕâ¸öÐèÇóºÜ¶àÅóÓѶ¼ÓÐ×Ô¼ºµÄ½â¾ö·½°¸£¬±ÈÈçʹÓÃVectorµÈ¼¯ºÏÀàÏȱ£´æÈ¡³öµÄÊý¾ÝÔÙ·ÖÒ³¡£µ«ÕâÖÖ·½·¨µÄ¿ÉÓÃÐԺܲÓëJDBC±¾ÉíµÄ½Ó¿ÚÍêÈ«²»Í¬£¬¶Ô²»Í¬ÀàÐ͵Ä×ֶεÄÖ§³ÖÒ²²»ºÃ¡£ÕâÀïÌṩÁËÒ»ÖÖÓëJDBC¼æÈÝÐԷdz£ºÃµÄ·½°¸¡£
JD ......
MVCÊÇÓÉÄ£ÐͲ㣬ÊÓͼ²ã£¬¿ØÖƲã×é³É£¬MVCÌá¸ßÁË¿ª·¢Ð§ÂÊ£¬±ãÓÚά»¤
·ÖÒ³ÊÇWeb¿ª·¢ÖеÄÒ»¸öÖØÒªµÄ¹¦ÄÜ£¬ÄÇÔõÑùʵÏÖ·ÖÒ³ÄØ£¿£¿£¿
¼Ù·ÖÒ³ÊÇÖ¸²éѯ³öËùÓеÄÊý¾Ý£¬Ö»ÏÔʾÐèÒªµÄÊý¾Ý£¬ËüÍêÈ«ÓɳÌÐòʵÏÖ£¬¿ª·¢Ð§Âʲ»¸ß£¬µ«ÈÝÒ×ʵÏÖ
´úÂëÈçÏÂ:
Ò».Ä£ÐͲã
UserInfo(JavaBeanµÄʵÏÖ£¬´«µÝÊý¾Ý£©
package com.feng.test;
......
ŬÁ¦ÁËÒ»ÌìÔÙ¼ÓÒ»Ì죬¾Íд¸ö½Å±¾»¹ÊDz»ÐС£Ôõô°ì¡£
ÏÂÃæµÄ´úÂëÓдíµÄ£¬Ö´Ðв»ÁË¡£ÔÝʱ»¹Ã»Óз¢ÏÖMyEclipseÀïÃæÈçºÎÀ´µ¥²½µ÷ÊÔ£¬¾ÍÏñÔÚvs2005ÀïÃæ¿ÉÒÔ°´×¡F10À´µ÷ÊÔ£¬¿´³ö×Ô¼ºµÄÄǸöÓï¾äд´íÁË£¬¶øÔÚÀïÖ»Äܹ»×Ô¼º¼ì²é£¬²éÁ˶àÉÙ±éÁËÒ²»¹ÊÇûÓÐÄܹ»·¢ÏÖÓÐʲô´íµÄ¡£´úÂëժ¼ÈçÏ£º
<script language="javaScript ......
ºÜ¾ÃûÓÐÓÃMysqlÁË£¬·¢ÏÖССµÄʱ¼äÎÊÌâÒ²Óöµ½²»ÉÙÂé·³£¬ºÇºÇ
ËùÒÔ×ܽáһϣº
µÚÒ»ÖÖ:
Date time= new java.sql.Date(new java.util.Date().getTime());
µÚ¶þÖÖ:
java ÓÃPreparedStatementÀ´setDate,ÓÃÎʺŵÄÐÎʽ¸øÈÕÆÚÎʺŸ³Öµ
pstmt.setTimestamp(8, new Timestamp(System.currentTimeMillis()));
pst ......
ÔÚJspÖе÷ÓÃSerlvetÖÐÒѾ´æ´¢ÁËÐÅÏ¢µÄ JavaBean.
ServletÖÐÒѾ°ÑÊý¾Ý¿âµÄÐÅÏ¢±£´æµ½JavaBeanÖÐ,ÔÙ°ÑJavaBean±£´æµ½SessionÖÐ.
Jsp¿ªÊ¼µ÷ÓÃ:
<jsp:useBean id="key" type="ClassName" scope="Session" />
<jsp:getProperty name="key" property="PropertyName" />
ÎÞ·¨¶Á³öÐÅÏ¢:
ÔÒò: JavaBean ÖÐÊôÐÔµ ......