jspÖеÄ×Ô¶¨Òå±êÇ©µÄÓ÷¨
±àд×Ô¶¨Òå±êÇ©²½Öè
±àд±êÇ©´¦ÀíÆ÷£¨´¦Àí±êÇ©µÄJavaÀࣩ£¬ÕâЩÀàÐèҪʵÏÖһЩ¹æ·¶»¯µÄ±êÇ©½Ó¿Ú
±àд±êÇ©¿âÃèÊöÎļþ£¨TLD£©£¬Õâ¸öÎļþÃèÊöÁËÿ¸ö±êÇ©ºÍ¶ÔÓ¦µÄJava±êÇ©´¦ÀíÆ÷ÀàÖ®¼äµÄÓ³Éä¹Øϵ
ÔÚweb.xmlÖÐÅäÖñêÇ©¿âÎļþµÄURI
ÔÚJSPÒ³ÃæÖÐÀûÓÃtaglibÖ¸Á±êÇ©¿âÒýÈëµ½Ò³ÃæÖÐ
¾ßÌåÄÚÈݲο¼¿Î¼þÁË¡£Ö»ËµÒ»Ð©×¢ÒâµÄµØ·½£º
¶¨Òå±êÇ©µÄ´¦ÀíµÄÊÇÒ»¸öÀ࣬¶ø²»ÊÇÒ»¸öservlet£¬ËùÒÔн¨µÄʱºòÔÚMyEclipseÖÐÑ¡Ôñн¨Ò»¸öclass£¬²¢ÇÒ×¢ÒâÒ»¶¨Òª·ÅÔÚÒ»¸ö°üÀ²»ÄÜÖ±½ÓÓÃdefaultpackage,ÏÖÔÚ»¹²»ÖªµÀ½â¾ö°ì·¨¡£
Õû¸ö¹ý³ÌÊÇÕâÑùµÄ£º
jspÖÐʹÓñêÇ©£¬µ±Ò³Ãæ·¢ÏÖ²»ÄÜÔÚĬÈϵıêÇ©¿âÖÐÕÒµ½µÄʱºò£¬»á²éÕÒ<%@ taglib uri="tagliburi" prefix="taglibprefix" %>
È»ºó»áµÃµ½´¦ÀíÕâ¸ö±êÇ©µÄ¶ÔÓ¦µÄtagliburi£¬
ÔÚweb.xmlÖÐÕÒµ½´¦ÀíÕâ¸öuri¶ÔÓ¦µÄtaglib.tld,
<taglib>
<taglib-uri>/mytaglib</taglib-uri>
<taglib-location>/WEB-INF/lib/mytaglib.tld</taglib-location>
</taglib>
ÔÚÕâ¸ötldÖÐÕÒµ½´¦ÀíÕâ¸ö±êÇ©µÄÀ࣬
<tag>
<name>tagname</name><!-- Õâ¸öÊDZêÇ©Ãû--!>
<tag-class>package.class</tag-class><!--Õâ¸öÊǶÔÓ¦µÄ´¦ÀíµÄÀà¡£--!>
<attribute><!--ÕâÊÇ´«µÝµÄ²ÎÊý--!>
<name>color</name>
<requried>false</requried>
</attribute>
</tag>
È»ºó½«²ÎÊýÌá½»¸øÕâ¸öÀ࣬Õâ¸öÀà×ö³öÏàÓ¦µÄ´¦Àí¡£
×îºóΪÌåÏÖÔÚwebÒ³ÃæÉÏ£¬ÊǾ¹ýת»¯µÄhtml±ê¼Ç¡£Àý£¬ÂÔ¡£
Ïà¹ØÎĵµ£º
Ò»¡¢¸ÅÊö
»º´æµÄ˼Ïë¿ÉÒÔÓ¦ÓÃÔÚÈí¼þ·Ö²ãµÄ¸÷¸ö²ãÃæ¡£ËüÊÇÒ»ÖÖÄÚ²¿»úÖÆ£¬¶ÔÍâ½ç¶øÑÔ£¬ÊDz»¿É¸ÐÖªµÄ¡£
Êý¾Ý¿â±¾ÉíÓлº´æ£¬³Ö¾Ã²ãÒ²¿ÉÒÔ»º´æ¡££¨±ÈÈ磺hibernate£¬»¹·Ö1¼¶ºÍ2¼¶»º´æ£©
ÒµÎñ²ãÒ²¿ÉÒÔÓлº´æ£¨µ«Ò»°ãÀ´Ëµ£¬ÕâÊÇÒ»¸ö¹ý³ÌÓò£¬²»»áÉ軺´æ£©¡£
&nbs ......
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.JSP)¾Í³öÏÖÂÒÂ룺
¶Ô²»Í¬µÄWEB·þÎñÆ÷ºÍ²»Í¬µÄJDK°æ±¾£¬´¦Àí½á¹û¾Í²»Ò»Ñù¡£ÔÒò£º·þÎñÆ÷ʹÓõıàÂ뷽ʽ²»Í¬ºÍä¯ÀÀÆ÷¶Ô²»Í¬µÄ×Ö·ûÏÔʾ½á¹û²»Í¬¶øµ¼Öµġ£½â¾ö°ì·¨£ºÔÚJSPÒ³ÃæÖÐÖ¸¶¨±àÂë·½Ê ......
ÔÚactionÀïʹÓÃfileuploadʱ£¬´ÓreqeustµÃµ½µÄÖÐÎÄÊý¾ÝΪÂÒÂ룬³¢ÊÔʹÓÃÁË
Java´úÂë
1. DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEnco ......
<%
Calendar rightNow = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String sysdate = format.format(rightNow.getTime());
int week = rightNow.get(rightNow.DAY_OF_WEEK);
String weekar ......
context.xml Îļþ¼ÐÖÐ
<Context path="/wap"
docBase="D:\IDE\MyEclipse\wap\WebRoot" reloadable="false" >
request.getContextPath(); -==> /wap
this.getServletContext().getRealPath("") ;// D:\IDE\MyEclipse\wap\WebRoot
......