JSP¾Å¸öÄÚÖöÔÏó
ѧϰJ2EE£¬±ØÐë¶ÔÏÂÃæµÄ¼¸¸ö¶ÔÏóÓкÜÉîµÄÀí½â
1¡¢request -> javax.servlet.http.HttpServletRequestµÄʵÀý
¸Ã¶ÔÏó·â×°ÁËÒ»´ÎÇëÇ󣬿ͻ§¶ËµÄÇëÇó²ÎÊý¶¼±»·â×°ÔڸöÔÏóÀï¡£ÕâÊÇÒ»¸ö³£ÓõĶÔÏ󣬻ñÈ¡¿Í»§¶ËÇëÇó²ÎÊý±ØÐëʹÓøöÔÏó¡£³£Óõķ½·¨ÓÐgetParameter(String paramName)¡¢getParameterValues(String paramName)¡¢setAttribute(String atttName,Object attrValue)¡¢getAttribute(String attrName)ºÍsetCharacterEncoding(String env)µÈ¡£
2¡¢response -> javax.servlet.http.HttpServletResponseµÄʵÀý
´ú±í·þÎñÆ÷¶Ô¿Í»§¶ËµÄÏìÓ¦¡£Í¨³£ºÜÉÙʹÓøöÔÏóÖ±½ÓÏìÓ¦£¬¶øÊÇʹÓÃout¶ÔÏ󣬳ý·ÇÐèÒªÉú³É·Ç×Ö·ûÏìÓ¦¡£¶øresponse¶ÔÏó³£ÓÃÓÚÖØ¶¨Ïò£¬³£Óõķ½·¨ÓÐgetOutputStream()¡¢sendRedirect(java.lang.String location)µÈ¡£
3¡¢session -> javax.servlet.http.HttpSessionµÄʵÀý
¸Ã¶ÔÏó´ú±íÒ»´Î»á»°¡£µ±¿Í»§¶Ëä¯ÀÀÆ÷ÓëÕ¾µã½¨Á¢Á¬½Óʱ£¬»á»°¿ªÊ¼£»µ±¿Í»§¶Ë¹Ø±Õä¯ÀÀÆ÷ʱ£¬»á»°½áÊø¡£³£Óõķ½·¨ÓУºgetAttribute(String attrName)¡¢setAttribute(String attrName, Object attrValue)µÈ¡£ÔÚÓû§µÇ¼´¦ÀíµÄʱºò¾³£Ê¹ÓÃÕâ¸ö¶ÔÏó¡£
4¡¢pageContext -> javax.servlet.jsp.PageContextµÄʵÀý
¸Ã¶ÔÏó´ú±í¸ÃJSPÒ³ÃæÉÏÏÂÎÄ£¬Ê¹ÓøöÔÏó¿ÉÒÔ·ÃÎÊÒ³ÃæÖеĹ²ÏíÊý¾Ý¡£³£Óõķ½·¨ÓÐgetServletContext()ºÍgetServletConfig()µÈ¡£¾³£ÔÚJspÖж¨ÒåһЩÊôÐÔ¾ÍÊDZ»·Å½øÕâ¸öʵÀýÖС£
5¡¢application -> javax.servlet.ServletContextµÄʵÀý
¸ÃʵÀý´ú±íJSPËùÊôµÄWebÓ¦Óñ¾Éí£¬¿ÉÓÃÓÚJSPÒ³Ãæ£¬»òÕßServletÖ®¼ä½»»»ÐÅÏ¢¡£³£Óõķ½·¨ÓÐgetAttribute(String attName)¡¢setAttribute(String attName , String attValue)ºÍgetInitParameter(String paramName)µÈ¡£
6¡¢config -> javax.servlet.ServletConfigµÄʵÀý
¸ÃʵÀý´ú±í¸ÃJSPµÄÅäÖÃÐÅÏ¢¡£³£Óõķ½·¨ÓÐgetInitParameter(String paramName)ºÍgetInitParameternames()µÈ·½·¨¡£ÊÂʵÉÏ£¬JSPÒ³ÃæÍ¨³£ÎÞÐëÅäÖã¬Ò²¾Í²»´æÔÚÅäÖÃÐÅÏ¢¡£Òò´Ë£¬¸Ã¶ÔÏ
Ïà¹ØÎĵµ£º
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<tiles-definitions>
<definition name="tscs.templet" path="/pa ......
Á¬Ðø¼¸Ìì°²×°ÅäÖúÍÁ¬½ÓMysqlÊý¾Ý¿â£¬½ñÌìÖÕÓڳɹ¦ÁË£¬»ØÏëÕ⼸Ìì£¬ÕæµÄÊÇÌðËá¿àÀ±¶¼ÓУ¬µ¥mysql¾Í֨װÁ˲»ÏÂ10´Î£¬¶øÔÚeclipseÉϱàдµÄÁ¬½ÓÊý¾Ý¿âµÄ³ÌÐò×ÜÊDZ¨´í£®ÎÒ¶¼ÒѾdownÁËoracal×¼±¸·ÅÆúmysqlÁË£¬²»¹ý£®£®£®¾ÍÏóµçÊÓ¾çÑݵÄÄÇÑù£¬×ª»ú×ÜÊÇÔÚÕâ¸öʱºò³öÏÖ£¬ÏÈÊÇ¿´µ½ÁËsaulzy¹ØÓÚmysql4.1.11°æ±¾µÄ°²×°½éÉÜ£¬½Ó×ÅÓÖÕ ......
String url="http://www.baidu.com";
ActionForward gotourl = new ActionForward(url);
gotourl.setPath(url);
gotourl.setRedirect(true);
return gotourl;
1.RequestDispatcher.forward()
¡¡¡¡ ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´ ......
ÔÚMyEclipseÖпª·¢WEBÓ¦ÓÃʱ¾³£Òª´´½¨JSPÎļþ£¬µ«ÊÇÿ´ÎMyEclipse¶¼»áÓÃĬÈϵÄMyEclipse Visual JSP Designer£¬´ò¿ªËٶȷdz£Âý£¬¶øÇÒ»ù±¾ÉÏÒ²Óò»µ½Õâ¸ö¿ÉÊÓ»¯µÄJSP±à¼Æ÷£¬¶à°ë¶¼ÊÇʹÓÃMyEclipse JSP Editor£¬ËùÒÔ£¬ÓбØÒª°ÑĬÈϵÄJSPÎļþ±à¼Æ÷¸Ä³ÉMyEclipse JSP Editor£¬·½±ãʹÓã¬Ò²¿É ......
application£ºÈ«¾Ö×÷Ó÷¶Î§£¬Õû¸öÓ¦ÓóÌÐò¹²Ïí£¬¾ÍÊÇÔÚ²¿ÊðÎļþÖеÄͬһ¸öwebApp¹²Ïí£¬ÉúÃüÖÜÆÚΪ£ºÓ¦ÓóÌÐòÆô¶¯µ½Í£Ö¹¡£
session£º»á»°×÷ÓÃÓò£¬µ±Óû§Ê״ηÃÎÊʱ£¬²úÉúÒ»¸öеĻỰ£¬ÒÔºó·þÎñÆ÷¾Í¿ÉÒÔ¼ÇסÕâ¸ö»á»°×´Ì¬¡£ÉúÃüÖÜÆÚ£º»á»°³¬Ê±£¬»òÕß·þÎñÆ÷¶ËÇ¿ÖÆÊ¹»á»°Ê§Ð§¡£
sessionÊÇÕë¶Ôµ¥¸ö¿Í»§ºÍ·þÎñÆ÷½øÐлỰµÄ  ......