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

´«ÖDz¥¿Í 2010 1 11 Ê®¶þ¡¢JSP(4)_EL JSTL I18N


Ò»¡¢Expression Language
EL±í´ïʽÓÃÓÚ»ñÈ¡²¢ÏÔʾҳÃæÊý¾Ý£¬²¢Ìæ»»JSPÒ³ÃæÖеĽű¾±í´ïʽ¡£ËüÊÇJSP 2.0¹æ·¶ÖеÄÒ»Ãż¼Êõ ¡£Òò´Ë£¬ÈôÏëÕýÈ·½âÎöEL±í´ïʽ£¬ÐèʹÓÃÖ§³ÖServlet2.4/JSP2.0¼¼ÊõµÄWEB·þÎñÆ÷¡£
1¡¢  EL±í´ïʽÒþʽ¶ÔÏó
Òþº¬¶ÔÏóÃû³Æ
Ãè       Êö
pageContext
¶ÔÓ¦ÓÚJSPÒ³ÃæÖеÄpageContext¶ÔÏó£¨È¡µÄÊÇpageContext¶ÔÏó£©
pageScope
´ú±ípageÓòÖÐÓÃÓÚ±£´æÊôÐÔµÄMap¶ÔÏó
requestScope
´ú±írequestÓòÖÐÓÃÓÚ±£´æÊôÐÔµÄMap¶ÔÏó
sessionScope
´ú±ísessionÓòÖÐÓÃÓÚ±£´æÊôÐÔµÄMap¶ÔÏó
applicationScope
´ú±íapplicationÓòÖÐÓÃÓÚ±£´æÊôÐÔµÄMap¶ÔÏó
param
±íʾһ¸ö±£´æÁËËùÓÐÇëÇó²ÎÊýµÄMap¶ÔÏó
paramValues
±íʾһ¸ö±£´æÁËËùÓÐÇëÇó²ÎÊýµÄMap¶ÔÏó£¬Ëü¶ÔÓÚij¸öÇëÇó²ÎÊý£¬·µ»ØµÄÊÇÒ»¸östring[]
header
±íʾһ¸ö±£´æÁËËùÓÐhttpÇëÇóÍ·×ֶεÄMap¶ÔÏó
headerValues
ͬÉÏ£¬·µ»Østring[]Êý×é¡£×¢Ò⣺Èç¹ûÍ·ÀïÃæÓГ-” £¬ÀýAccept-Encoding£¬ÔòÒªheaderValues[“Accept-Encoding”]
cookie
±íʾһ¸ö±£´æÁËËùÓÐcookieµÄMap¶ÔÏó
initParam
±íʾһ¸ö±£´æÁËËùÓÐwebÓ¦Óóõʼ»¯²ÎÊýµÄmap¶ÔÏó
2¡¢  ÔËËã·û
[ ] ºÍ .
ÕâÁ½¸öÔËËã·û¶¼¿ÉÒÔ·ÃÎʸ÷¸öÓòÊôÐÔ¶ÔÏóÖеÄÊôÐÔºÍÒþº¬¶ÔÏóµÄÊôÐÔ¡£ÀýÈ磬±í´ïʽ ${user.name} ºÍ ${user[“name”]} ÊǵÈЧµÄ ¡£
[] ÔËËã·û»¹¿ÉÒÔ·ÃÎÊÓÐÐò¼¯ºÏ£¨¼´ÊµÏÖÁËjava.util.List½Ó¿ÚµÄ¼¯ºÏ£©»òÊý×éÖеÄÖ¸¶¨Ë÷ÒýλÖõÄij¸öÔªËØ£¬ÀýÈç±í´ïʽ ${users[0]} ÓÃÓÚ·ÃÎʼ¯ºÏ»òÊý×éusersÖеĵÚÒ»¸öÔªËØ¡£ÔÚÕâÖÖÇé¿öÏ£¬EL±í´ïʽÖÐÖ»ÄÜʹÓà [] ÔËËã·û£¬¶ø²»ÄÜʹÓõãÔËËã·û¡£
ËãÊýÔËËã·ûºÍÂß¼­ÔËËã·û½ÏΪ¼òµ¥£¬±ÊÕ߾Ͳ»ÔÙ׸Êö¡£
3¡¢  EL Function
EL×Ô¶¨Ò庯Êý¾ÍÊÇÔÊÐí¿ª·¢ÈËÔ±ÒÔEL±í´ïʽµÄÐÎʽµ÷ÓÃÒ»¸öJavaÀàµÄ·½·¨¡£ÔÚEL±í
´ïʽÖе÷ÓõÄÖ»ÄÜÊÇJavaÀàµÄ¾²Ì¬·½·¨¡£
4¡¢  JSTLÖг£ÓÃELº¯Êý
ΪÁ˼ò»¯ÔÚJSPÒ³Ãæ²Ù×÷×Ö·û´®£¬JSTLÖÐÌṩÁËÒ»Ì×EL×Ô¶¨Ò庯Êý£¬ÕâЩº¯Êý°üº¬ÁË
JSPÒ³ÃæÖÆ×÷Õß¾­³£ÒªÓõ½µÄ×Ö·û´®²Ù×÷¡£
º¯ÊýÃû
ÃèÊö
fn:toLowerCase
½«Ò»¸ö×Ö·û´®Öаüº¬µÄËùÓÐ×Ö·ûת»»ÎªÐ¡Ð´ÐÎʽ£¬²¢·µ»Øת»»ºóµÄ×Ö·û´®£¬Ëü½ÓÊÕÒ»¸ö×Ö·û´®ÀàÐ͵IJÎÊý
fn:toUpperCase
½«Ò»¸ö×Ö·û´®Öаüº¬µÄËùÓÐ×Ö·ûת»»Îª´óдÐÎʽ£¬²¢·µ»Øת»»ºóµÄ×Ö·û´®£¬Ëü½ÓÊÕÒ»¸ö×Ö·û´®ÀàÐ͵IJÎÊý¡£
fn:trim
ɾ³ýÒ»¸ö×Ö·û´®µÄÊ×βµÄ¿Õ¸ñ£¬²¢·µ»Øɾ³ý¿Õ¸ñºóµÄ½á¹û×Ö·û´


Ïà¹ØÎĵµ£º

LinuxÏÂÅäÖÃJSP¿ª·¢»·¾³µÄ·½·¨

¡¡¡¡ÏµÍ³»·¾³£ºLinux 5.0 AS 64λ
¡¡¡¡²½Ö裺
¡¡¡¡1¡¢ÏÂÔØapache-tomcat-5.5.23.tarºÍjdk-1_5_0_12-linux-i586.bin²¢´æ·ÅÔÚ/usr/localÎļþ¼ÐÏ£»
¡¡¡¡2¡¢°²×°jdk
¡¡¡¡[root@localhost local]#chmod 775 jdk-1_5_0_12-linux-i586.bin '·Ç±ØÐ룬ҪÊÇÖ±½ÓÔËÐÐʱÌáʾȨÏÞ²»¹»Ê±¸Ä±äȨÏÞ£»
¡¡¡¡[root@localhost local]#./jd ......

jsp ±êÇ©taglib²»Æð×÷ÓõÄÎÊÌâ

JSTL <c:out value="${EL}">²»ÄÜÕýÈ·Êä³öµÄÎÊÌâ
ÓÉÓÚJsp2.0Ïòºó¼æÈݵÄÌØÐÔ£¬ µ±Óöµ½Ê¹ÓÃJsp 1.2£¨Servlet v2.3£©µÄÍøվʱ»áĬÈϵĽûÓÃJSP2.0 EL£¬ËùÒÔµ¼ÖÂc:out²»ÄÜÕýÈ·Êä³ö¡£
£¨ÕâÀï×¢ÒâJsp 1.2½ûÓÃJSP2.0µÄEL£¬¶øÊÇȥʹÓÃJSTL 1.0 taglibÈ¥½âÎöEL¡£ËùÒÔʹÓÃJSP 1.2+JSTL 1.0²»»á³öÎÊÌ⣬
¶øʹÓÃÁËJSP 1.2+JSTL 1 ......

jspÒ³ÃæÅжÏÊÇ·ñ°²×°²å¼þ


ÒÔÏÂΪÔÚjspÒ³ÃæjavascriptʵÏÖ·½Ê½£º
Èç¹ûÐèÒªÉèÖõØÖ·¹©Óû§ÏÂÔØʹÓÃ
1. ÐèÒªµ¼ÈëjspSmartUpload.jar°ü¡£
2. ÔÚÒ³ÃæÌí¼Ó<%@ page import=”com..jspsmart.upload.*”%>
function createOCX()
{
try
{
//´´½¨ActiveXobject¶ÔÏóʱ´«Èë²å¼þµÄVersionIndependProgID
//´Ë´¦ÅжÏϵͳÖÐÊÇ·ñ°²×°meid ......

JSP ÖÐurlÖÐÎÄÂÒÂë½â¾ö·½°¸

pager.setActionName("../servlet/GetBookList?bookname="+booktemp.getBookName()
    +"&author="+booktemp.getAuthor()+"&publish="+booktemp.getPublish()+"&");
<a
  href="<c:out value="${pager.actionName}"/>pageNo=<c:out value="${pager.pageNo+1}"/& ......

FusionChartsʾÀý ǰ̨jsp¡¢jquery£¬ºǫ́Ϊservlet

¹ØÓÚһЩFCFµÄ»ù´¡¸ÅÄî¿ÉÒÔÔÚgoogleÉÏÃæËÑË÷“FusionChartsFree ÖÐÎÄ¿ª·¢Ö¸ÄÏ”¡££¨×¢Ò⣬Õâ¸ö×ÊÁÏÀïÃæ¶ÔÓÚÖÐÎÄÂÒÂëµÄÎÊÌⲢûÓÐ×ö³ö½â¾ö£¬½â¾ö·½·¨²Î¿¼£ºhttp://yongboy.javaeye.com/blog/270092£©
ÔÚÁ˽âÁËһЩ±ØÒªµÄ¸ÅÄîºó£¬²ÅÊDZ¾ÎĵÄÖص㣬×öÒ»¸öºǫ́ΪservletµÄFCFµÄÀý×Ó£¨×¢Ò⣺´ËÀýÖÐjs¿ò¼ÜʹÓÃjquery£© ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ