ÈçºÎÈ¥³ý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>
&
Ïà¹ØÎĵµ£º
·pageContext£ºÌṩ¶ÔÒ³ÃæÊôÐԵķÃÎÊ¡£
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
pageContext.setAttribute("basePath",basePath);
%>
ʹÓãº
${pageScope}
·reques ......
ÔÚÏîÄ¿ÖУ¬ÎÒÃǾ³£Óöµ½ÐèÒªÔÚjspÒ³ÃæÇл»Öд«µÝÖÐÎÄ×Ö·û¡£ÕâÖ÷ÒªÓÐÁ½ÖÖ·½Ê½¡£
¡¡¡¡URL·½Ê½£¬ÀýÈ磺http://website/test1.jsp?act=add&type=Æ»¹û¶m=%20D%20B
¡¡¡¡FORM·½Ê½£¬ÀýÈ磺
¡¡¡¡<form name=test mehtod="post">
¡¡¡¡<input type=hidden name=text2 value="ÖÐÎÄ">
¡¡¡¡<input type=t ......
(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Öв»Óö¨Òå¿ÉÒÔÖ±½ÓÓõľÍÊÇjspµÄ9¸öÄÚ½¨¶ÔÏóÁË
1£¬Request 2,Response 3,session 4,out 5,page
6,application 7,pageContext 8,config
9,exception
1¡¢Request¶ÔÏó
¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóÏàÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡·â×°µÄÐÅÏ¢£¬¼´Ê¹ÓøöÔÏó¿ÉÒÔ
»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
µ±Request¶ÔÏó»ñÈ¡¿Í» ......
£±.×îÖ±½Ó×î¼òµ¥µÄ£¬·½Ê½ÊÇ°ÑÎļþµØÖ·Ö±½Ó·Åµ½htmlÒ³ÃæµÄÒ»¸öÁ´½ÓÖС£ÕâÑù×öµÄȱµãÊÇ°ÑÎļþÔÚ·þÎñÆ÷ÉϵÄ·¾¶±©Â¶ÁË£¬²¢ÇÒ»¹ÎÞ·¨¶ÔÎļþÏÂÔؽøÐÐÆäËüµÄ¿ØÖÆ£¨ÈçȨÏÞ£©¡£Õâ¸ö¾Í²»Ð´Ê¾ÀýÁË¡£
£².ÔÚ·þÎñÆ÷¶Ë°ÑÎļþת»»³ÉÊä³öÁ÷£¬Ð´Èëµ½response£¬ÒÔresponse°ÑÎļþ´øµ½ä¯ÀÀÆ÷£¬ÓÉä¯ÀÀÆ÷À´ÌáʾÓû§ÊÇ·ñÔ¸Òâ±£´æÎ ......