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

ÈçºÎÈ¥³ýJSPÊä³öHTMLʱ²úÉúµÄ´óÁ¿¿Õ¸ñºÍ»»ÐÐ

ÔÚWEBÓ¦ÓÃÖÐ,Èç¹ûʹÓÃjsp×÷Ϊview²ãµÄÏÔʾģ°å,¶¼»á±»¿Õ¸ñ/¿Õ»»ÐÐÎÊÌâËùÀ§ÈÅ.
Õâ¸öÎÊÌâµ±ÄêÒ²À§ÈÅÁËÎұȽϳ¤µÄʱ¼ä.ÒòΪÔÚjspÄÚʹÓõÄEL±êÇ©ºÍÆäËû±êǩʱ,»á²úÉú´óÁ¿µÄ¿Õ¸ñºÍ»»Ðзû.ÀýÈç:
------- start ----------
<c:choose>
    <c:when test="${fn:length(mainPageList)>1&}">
          Something
    </c:when>
    <c:otherwise>
          Others
    </c:otherwise>
</c:choose>
------- end -----------
Õâ¶Î´úÂëÔÚTomcatÉÏÊä³öÈçÏ£¬¶àÁ˼¸Ðл»ÐС£
------- start ----------
 
 
Something
 
------- end -----------
µ±È»£¬Ò»°ã²»È¥ÌرðÁôÒâÊDz»»á·¢ÏÖÓÐʲôÎÊÌâµÄ£¬±Ï¾¹Êä³öÔÙ¶àµÄ¿Õ¸ñºÍ»»Ðзû£¬¶ÔÓÚä¯ÀÀÆ÷Éú³ÉµÄ×îÖÕЧ¹ûÊÇÒ»ÑùµÄ¡£Ò²¾ÍÊǴ󲿷ֿª·¢ÈËÔ±ºöÂÔÕâ¸öÎÊÌâµÄÔ­Òò£»µ«Êµ¼ÊÉÏÕâЩ¿Õ¸ñºÍ»»ÐлáÕ¼ÓÃÁ˲»Éٿռ䣬Îҵľ­ÑéÊÇ30%×óÓÒÊÇ¿Õ¸ñ/»»ÐС£Ò²ÓÐÈË˵£¬µ±web·þÎñÆ÷ÒÔzipµÄ·½Ê½À´Êä³öhtmlʱ£¬¿Õ¸ñÒýÆðµÄ´ø¿íÎÊÌâ¾Í¿ÉÒÔ½â¾öÁË£»Êǵģ¬µ±Ê¹ÓÃzipÀ´Êä³öhtmlʱ£¬¿Õ¸ñ/»»ÐеĿռä»á±»½ÚÊ¡»ØÀ´£¬µ«Õâ¸öÔö¼ÓzipµÄ¹¤×÷Á¿£¬¶øÇÒ×î´óµÄÎÊÌâÊÇ£¬ä¯ÀÀÆ÷Éú³ÉÒ³Ãæʱ£¬»¹ÊǻỹԭËùÓеĿոñµÄ»»Ðзû¡£¶ÔÓÚÇ°¶Ë¿ª·¢ÈËÔ±À´ËµÕâÊǸöجºÄ£¬Ãæ¶Ô´óÁ¿µÄ¿Õ¸ñºÍÈß³¤µÄhtmlÔ´Â룬ÏëÒªÕÒµ½¶ÔÓ¦³öÎÊÌâµÄÑùʽËùÔÚµÄλÖÿɲ»ÊÇÈÝÒ×µÄÊÂÇé¡£
ÏÂÃæ˵һϽâ¾ö·½°¸£¬ÒÔTomcatΪÀý£º
·½°¸Ò»£¬ÀûÓÃweb·þÎñÆ÷µÄtrimSpaces¹¦ÄÜ¡£
Tomcat5 ÒÔÉÏ°æ±¾¶¼¿ÉÒÔʹÓã¬ÕâÊÇ×î¼òµ¥µÄ·½·¨¡£
<servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
  &


Ïà¹ØÎĵµ£º

JSP Òþʽ¶ÔÏó

·pageContext£ºÌṩ¶ÔÒ³ÃæÊôÐԵķÃÎÊ¡£
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
pageContext.setAttribute("basePath",basePath);
%>
ʹÓãº
${pageScope}
 
·reques ......

jspÖеÄÖÐÎIJÎÊýµÄ´«µÝ

ÔÚÏîÄ¿ÖУ¬ÎÒÃǾ­³£Óöµ½ÐèÒªÔÚjspÒ³ÃæÇл»Öд«µÝÖÐÎÄ×Ö·û¡£ÕâÖ÷ÒªÓÐÁ½ÖÖ·½Ê½¡£
¡¡¡¡URL·½Ê½£¬ÀýÈ磺http://website/test1.jsp?act=add&type=Æ»¹û&param=%20D%20B
¡¡¡¡FORM·½Ê½£¬ÀýÈ磺
¡¡¡¡<form name=test mehtod="post">
¡¡¡¡<input type=hidden name=text2 value="ÖÐÎÄ">
¡¡¡¡<input type=t ......

jsp Ö®Filter

(1) ÇëÇóÐÅÏ¢±àÂëת»¯µÄFilter
importjava.io.IOException;
importjava.util.Enumeration;
importjavax.servlet.Filter;
importjavax.servlet.FilterChain;
importjavax.servlet.FilterConfig;
importjavax.servlet.ServletException;
importjavax.servlet.ServletRequest;
importjavax.servlet.ServletResponse;
......

jspµÄ9¸öÄÚ½¨¶ÔÏó

ÔÚjspÖв»Óö¨Òå¿ÉÒÔÖ±½ÓÓõľÍÊÇjspµÄ9¸öÄÚ½¨¶ÔÏóÁË
1£¬Request 2,Response 3,session 4,out 5,page
6,application 7,pageContext 8,config
9,exception
1¡¢Request¶ÔÏó
¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóÏàÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡·â×°µÄÐÅÏ¢£¬¼´Ê¹ÓøöÔÏó¿ÉÒÔ
»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
µ±Request¶ÔÏó»ñÈ¡¿Í» ......

JspʵÏÖÎļþÏÂÔع¦Äܵķ½·¨

 
£±.×îÖ±½Ó×î¼òµ¥µÄ£¬·½Ê½ÊÇ°ÑÎļþµØÖ·Ö±½Ó·Åµ½htmlÒ³ÃæµÄÒ»¸öÁ´½ÓÖС£ÕâÑù×öµÄȱµãÊÇ°ÑÎļþÔÚ·þÎñÆ÷ÉϵÄ·¾¶±©Â¶ÁË£¬²¢ÇÒ»¹ÎÞ·¨¶ÔÎļþÏÂÔؽøÐÐÆäËüµÄ¿ØÖÆ£¨ÈçȨÏÞ£©¡£Õâ¸ö¾Í²»Ð´Ê¾ÀýÁË¡£
 
£².ÔÚ·þÎñÆ÷¶Ë°ÑÎļþת»»³ÉÊä³öÁ÷£¬Ð´Èëµ½response£¬ÒÔresponse°ÑÎļþ´øµ½ä¯ÀÀÆ÷£¬ÓÉä¯ÀÀÆ÷À´ÌáʾÓû§ÊÇ·ñÔ¸Òâ±£´æÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ