Jsp ELÓï·¨
Jsp ELÓï·¨
Àý£º
${sessionScope.user.sex}
ËùÓÐEL¶¼ÊÇÒÔ ${ ΪÆðʼ¡¢ÒÔ} Ϊ½áβµÄ¡£
ÉÏÊöEL·¶ÀýµÄÒâ˼ÊÇ£º´ÓSessionÈ¡µÃÓû§µÄÐÔ±ð¡£Èç¹ûʹÓÃ֮ǰJSP´úÂëµÄд·¨ÈçÏ£º
<%
User user = (User)session.getAttribute(”user”);
String sex = user.getSex( );
%>
Á½ÕßÏà±È½Ï֮ϣ¬¿ÉÒÔ·¢ÏÖELµÄÓï·¨±È´«Í³JSP´úÂë¸üΪ·½±ã¡¢¼ò½à¡£
ELÌṩ . ºÍ [ ] Á½ÖÖÔËËã·ûÀ´´æÈ¡Êý¾Ý£¬[ ]¿ÉÒÔ·ÃÎʼ¯ºÏ»òÕßÊÇÊý×éµÄÔªËØ¡¢BeanµÄÊôÐÔ¡£
ÏÂÁÐÁ½ÕßËù´ú±íµÄÒâ˼ÊÇÒ»ÑùµÄ£¬µ«ÊÇÐèÒª±£Ö¤ÒªÈ¡µÃ¶ÔÏóµÄÄǸöµÄÊôÐÔÓÐÏàÓ¦µÄsetXxx()ºÍgetXxx()·½·¨²ÅÐС£
Àý£º
${sessionScope.user.sex}
µÈÓÚ ${sessionScope.user["sex"]}
. ºÍ [ ] Ò²¿ÉÒÔͬʱ»ìºÏʹÓã¬ÈçÏ£º
${sessionScope.shoppingCart[0].price}
·µ»Ø½á¹ûΪshoppingCartÖеÚÒ»ÏîÎïÆ·µÄ¼Û¸ñ¡£
ÔÚELÖУ¬×Ö·û´®¼È¿ÉÒÔʹÓÔabc”£¬¿ÉÒÔʹÓÃ’abc’¡£
ELÔËËã·û
ELµÄËãÊõÔËËã·ûºÍJavaÖеÄÔËËã·ûµÄ´óÖÂÏàͬ£¬ÓÅÏȼ¶Ò²Ïàͬ¡£
×¢Ò⣺’+’ ÔËËã·û²»»áÁ¬½Ó×Ö·û´®ÁË£¬ËûÖ»ÓÃÓÚ¼Ó·¨ÔËËã¡£
EL¹ØϵÔËËã·ûÓÐÒÔÏÂÁù¸öÔËËã·û
¹ØϵÔËËã·û ˵ Ã÷ ·¶ Àý ½á¹û
= = »ò eq | µÈÓÚ |${ 5 = = 5 } »ò ${ 5 eq 5 } | true
!= »ò ne | ²»µÈÓÚ |${ 5 != 5 } »ò ${ 5 ne 5 } | false
< »ò lt | СÓÚ |${ 3 < 5 }»ò ${ 3 lt 5 } | true
> »ò gt | ´óÓÚ |${ 3 > 5 }»ò ${ 3 gt 5 } | false
<= »ò le | СÓÚµÈÓÚ |${ 3 <= 5 }»ò ${ 3 le 5 } | true
>= »ò ge | ´óÓÚµÈÓÚ |${ 3 >= 5 }»ò ${ 3 ge 5 } | false
emptyÔËËã·û
EmptyÔËËã·ûÖ÷ÒªÓÃÀ´ÅжÏÖµÊÇ·ñΪnull»ò¿ÕµÄ£¬ÀýÈ磺
${ empty param.name }
½ÓÏÂÀ´ËµÃ÷EmptyÔËËã·ûµÄ¹æÔò£º
{empty} A
Èç¹ûAΪnullʱ£¬·µ»Øtrue
Èç¹ûA²»´æÔÚʱ£¬·µ»Øtrue
Èç¹ûAΪ¿Õ×Ö·û´®Ê±£¬·µ»Øtrue
Èç¹ûAΪ¿ÕÊý×é
Ïà¹ØÎĵµ£º
1. RequestDispatcher.forward()
ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´«µÝHTTPÇëÇó´Óµ±Ç°µÄServlet or JSPµ½ÁíÍâÒ»¸öServlet,JSP »òÆÕͨHTMLÎļþ,Ò²¼´ÄãµÄformÌá½»ÖÁa.jsp,ÔÚa.jspÓõ½ÁËforward()Öض¨ÏòÖÁb.jsp,´ËʱformÌá½»µÄËùÓÐÐÅÏ¢ÔÚ b.jsp¶¼¿ÉÒÔ»ñµÃ,²ÎÊý×Ô¶¯´«µÝ. µ«fo ......
ÔÚjspÖÐʹÓÃsmartupload×é¼þÉÏ´«Îļþ
jsp¶ÔÉÏ´«ÎļþµÄÖ§³Ö²»ÏóphpÖÐÖ§³ÖµÄÄÇôºÃ£¬Ö±½Ó×ö³ÉÁ˺¯Êý£¬Ò²²»ÏóaspÖÐҪͨ¹ý×é¼þ²ÅÄÜʵÏÖ¡£jspÖпÉÒÔͨ¹ýjavabeanÀ´ÊµÏÖ¡£µ«ÊÇÎÒÃÇûÓбØÒª×Ô¼ºÈ¥Ð´Ò»¸öÉÏÔصÄbean£¬ÔÚÍøÉÏÒѾÓÐÁ˺ܶà³ÉÐ͵ļ¼Êõ£¬smartupload¾ÍÊÇÆäÖеÄÒ»¸ö¡£µ«ÊÇsmartuploadÊǽ«ÎļþÏȶÁµ ......
½â¾öjsp»òserverlet ²»ÄܽâÎömultipart/form-data ÀàÐÍµÄ±íµ¥ÓòµÄÎÊÌâ
10 6ÔÂ 2008
Situation:
Javax.servlet.HttpServletRequest.getParameter(String) returns null when the ContentType is multipart/form-data
Solutions:
Solution A:
1. download http://www.servlets.com/cos/index.html
2. invoke getPara ......
<jsp:useBean>¶¯×÷ÓÃÓÚʵÀý»¯JavaBean£¬»òÕ߶¨Î»Ò»¸öÒѾ´æÔÚµÄJavaBeanʵÀý£¬²¢°ÑʵÀýµÄÒýÓø³¸øÒ»¸ö±äÁ¿¡£
Óï·¨ÈçÏ£º
<jsp:useBean id="cart" scope="session" class="org.sunxin.lesson.jsp.bookstore.CartBean">
<jsp:setProperty>¶¯×÷ºÍ<jsp:useBean>Ò»ÆðʹÓã¬ÓÃÀ´ÉèÖÃJavaBeanµÄ¼òµ¥ÊôÐ ......
ºÍJavaÒ»Ñù£¬JSPÊÇÄ¿Ç°±È½ÏÈÈÃŵÄÒ»¸ö»°Ìâ¡£ËüÊÇÒ»ÖÖÔÚ·þÎñÆ÷¶Ë±àÒëÖ´ÐеÄWebÉè¼ÆÓïÑÔ£¬ÒòΪ½Å±¾ÓïÑÔ²ÉÓÃÁËJava£¬ËùÒÔJSP¼Ì³ÐÁËJavaµÄËùÓÐÓŵ㡣¿ÉÊÇÔÚʹÓÃJSP³ÌÐòµÄ¹ý³ÌÖУ¬³£Óöµ½ÖÐÎÄÂÒÂëÎÊÌ⣬ºÜ¶àÈËΪ´ËÍ·ÌÛ²»ÒÑ£¬±ÊÕß¾ÍÉîÊÜÆ亦£¬¶øÇÒʹÓÃƽ̨²»Í¬£¬ÖÐÎÄÂÒÂëÎÊÌâµÄ½â¾ö·½·¨Ò²²»Í¬£¬ÎÞÐÎÖÐÔö¼ÓÁËѧϰJSPµÄÄѶȡ£Æäʵ£¬Ô ......