Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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Ò³Ãæͨ³£ÎÞÐëÅäÖã¬Ò²¾Í²»´æÔÚÅäÖÃÐÅÏ¢¡£Òò´Ë£¬¸Ã¶ÔÏ


Ïà¹ØÎĵµ£º

¹ØÓÚjspÖеÄcookieС³ÌÐò

<body>
 <%
   Cookie[] cookies = request.getCookies() ;
   Cookie cookie = null ;
   if(cookies!=null){
     cookie = cookies[0] ;
     out.print("ÉϴηÃÎʵÄipÊÇ£º " + request.getRemoteAddr() +"<br>") ;&n ......

JSPÁ¬½ÓMySqlÊý¾Ý¿â


Á¬Ðø¼¸Ìì°²×°ÅäÖúÍÁ¬½ÓMysqlÊý¾Ý¿â£¬½ñÌìÖÕÓڳɹ¦ÁË£¬»ØÏëÕ⼸Ì죬ÕæµÄÊÇÌðËá¿àÀ±¶¼ÓУ¬µ¥mysql¾ÍÖØ×°Á˲»ÏÂ10´Î£¬¶øÔÚeclipseÉϱàдµÄÁ¬½ÓÊý¾Ý¿âµÄ³ÌÐò×ÜÊDZ¨´í£®ÎÒ¶¼ÒѾ­downÁËoracal×¼±¸·ÅÆúmysqlÁË£¬²»¹ý£®£®£®¾ÍÏóµçÊÓ¾çÑݵÄÄÇÑù£¬×ª»ú×ÜÊÇÔÚÕâ¸öʱºò³öÏÖ£¬ÏÈÊÇ¿´µ½ÁËsaulzy¹ØÓÚmysql4.1.11°æ±¾µÄ°²×°½éÉÜ£¬½Ó×ÅÓÖÕ ......

ÔÚJSPÒ³ÃæÖÐÓÃselectÏÂÀ­ÁбíÀ´ÏÔʾListÁбíµÄ·½Ê½

Ò» ¡¢ ÓÃstruts2±êÇ©µÄ<s:selectÀ´ÏÔʾ
<s:select cssStyle="width: 84%" list="#application.officeList" headerKey="" headerValue="--ÇëÑ¡Ôñ--" listKey="#this.value" listValue="#this.key+'.'+#this.value" name="entity.officeName" value="entity.officeName"/>
ÆäÖÐ
1¡¢listÊǽÓÊÕjavaÀà»òÕßÔÚÆô¶¯Ê± ......

JSP·ÖÒ³¼¼ÊõʵÏÖ

title: JSP·ÖÒ³¼¼ÊõʵÏÖ
summary:ʹÓù¤¾ßÀàʵÏÖͨÓ÷ÖÒ³´¦Àí
author: evan_zhao
email: evan_zhao@hotmail.com
¡¡¡¡Ä¿Ç°±È½Ï¹ã·ºÊ¹ÓõķÖÒ³·½Ê½Êǽ«²éѯ½á¹û»º´æÔÚHttpSession»òÓÐ״̬beanÖУ¬·­Ò³µÄʱºò´Ó»º´æÖÐÈ¡³öÒ»Ò³Êý¾ÝÏÔʾ¡£ÕâÖÖ·½·¨ÓÐÁ½¸öÖ÷ÒªµÄȱµã£ºÒ»ÊÇÓû§¿ÉÄÜ¿´µ½µÄÊǹýÆÚÊý¾Ý£»¶þÊÇÈç¹ûÊ ......

jspÒ³ÃæÌøת·½·¨´óÈ«

JSPÖеÄÌøת£º
(1). forward()·½·¨
    ʹÓõ½javax.servlet.RequestDispatcherÀà
    RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
    rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
    /*forwardº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ