Java Web µÚ10Ìì ELºÍJSTL 2
ËÄ¡¢JSTLµÄÓ÷¨
ÔÚƽ³£µÄʹÓÃÖÐÎÒÃÇÒ»°ãÀûÓÃ
EL
¿ØÖƱäÁ¿ÒÔ¼°±äÁ¿µÄÊä³ö£¬ÀûÓÃ
JSTL
¿ØÖÆËãÊõÂß¼¡£
JSTL
ÊÇÒ»ÖÖ±ê¼Ç¡£
1.
JSTL
µÄµ¼Èë
i.
ÊÖ¶¯µ¼Èë¼Ü°ü£¬ÌîдÕæʵµÄ
uri=http://java.sun.com/products/jsp/jst1
ii.
ÀûÓÃ
Myeclipse
µ¼Èë¼Ü°ü£¬ÌîдµÄ
uri
Ò²±ä³ÉÏà¶Ô·¾¶
2.
JSTL
ÖеÄÁ÷³Ì¿ØÖÆ
a)
Ìõ¼þ´¦Àí
ÀýÈ磺£¨¾ÍËãÊÇ
String
ÀàÐ͵ÄÒ²ÊÇÀûÓÃ
= =
ÅжÏÊÇ·ñÏàͬ£©
<c:if
test=”${x==9}”>
${x}
</c:if>
ÀýÈ磺
<c:choose>
<c:when text=” ${x==9}”>
This is when term
</c:when>
<c:otherwise>
This is otherwise term
</c:otherwise>
</c:choose>
b)
Ñ»·¿ØÖÆ
ÆÕͨѻ·£º
<c:forEach var=”x” begin=” 1” end=”9”>
${x}
</c:forEach>
Êý×éµÈ±éÀú£º
<h3>
±éÀúÊý×é
</h3>
<%int[] sss = {22,34,21};
pageContext.setAttribute("ss", sss, PageContext.PAGE_SCOPE);
for(int
s:sss){
out.print(s);
}
&
Ïà¹ØÎĵµ£º
OpenJWeb Java¼¼ÊõÃÅ»§ÍøµØַΪhttp://www.openjweb.com:8088/crm ,´ËÍøÕ¾ÓÚ2010Äê2ÔÂ16ÈÕÕýʽÆôÓá£
OpenJWeb Java¼¼ÊõÃÅ»§ÍøÖ÷ÒªÌṩJava¼Ü¹¹Ñ§Ï°¡¢Java¿ªÔ´¿ò¼Ü¼¼Êõ½»Á÷¡¢OpenJWeb¼¼Êõ×ÊÁÏÏÂÔØ¡¢Ãâ·Ñ»áÔ±×¢²á¡¢openjweb.comÃâ·ÑÓÊÏä·þÎñ¡¢ÓʼþȺ·¢¡¢¿Í»§µµ°¸¹ÜÀí¡¢ÄÚÈݹÜÀíϵͳµÈ¹¦ÄÜ¡£
OpenJWeb Java¼¼ÊõÃÅ»§Íøµ ......
Ò»¡¢
web
µÄÈýÖÖ×÷ÓÃÓò
ServletContext(
ÉÏÏÂÎÄ
)
£ºÕû¸ö
web
Ó¦ÓóÌÐò£¬Ï̲߳»°²È«
HttpSession(
ȇȡ
)
£ºÒ»¸ö»á»°½»»¥¹ý³Ì
ServletRequest(
ÇëÇó
)
£ºÒ»´ÎÇëÇó¹ý³Ì
ÊôÐÔ²Ù×÷·½·¨£º
void setAttribute(String,Object)
......
Ò»¡¢
ʲôÊǹýÂËÆ÷
´Ó¼¼ÊõÉϽ²¹ýÂËÆ÷ÊÇÒ»¸öÖмä×é¼þ£¬ÓÃÓÚÀ¹½ØÔ´Êý¾ÝºÍÄ¿µÄÊý¾Ý¼äµÄÏûÏ¢£¬²¢ÇÒ¹ýÂ˶þÕßÖ®¼ä´«µÝµÄÊý¾Ý¡£¶ÔÓÚ
WEB
Ó¦ÓóÌÐò£¬¹ýÂËÆ÷ÊÇפÁôÔÚ
WEB
·þÎñÆ÷ÉϵÄ
WEB
×é¼þ¡£¶ÔÓÚ¿Í»§¶ËºÍÄ¿±ê×ÊÔ´¶øÑÔ¹ýÂËÆ÷ÊÇ͸Ã÷µÄ£¬ËûÃÇÊDz»ÖªµÀ·¢ËÍÀ´µÄÊý¾ÝÊÇ·ñ¾¹ý¹ýÂËÆ÷µÄ´¦Àí¡£
¶þ¡¢
¹ýÂËÆ÷µÄ×÷ÓÃ
¹ýÂËÆ÷Ï൱ÓÚÒ ......