JSPÖбêÇ©¿âµÄÉîÈëÑо¿
±êÇ©¿âTaglib
±êÇ©±»¶¨ÒåºÍ·Ö²¼ÔÚÒ»¸ö³ÆΪ±êÇ©¿âµÄ½á¹¹ÖУ¬Ò»¸ö±êÇ©¿âÊÇÓÉÔªÐÅÏ¢ºÍÀà×é³ÉµÄ¼¯ºÏ£º
1.±êÇ©´¦ÀíÆ÷£ºÊµÏÖ¶¨ÖƱêÇ©¹¦ÄܵÄJavaÀà¡£
2.±êÇ©¸½¼ÓÐÅÏ¢£¨TEI£©£ºÏòJSPÈÝÆ÷Ìṩ±ß¼ÒÔÈ·ÈϱêÇ©ÊôÐԺʹ´½¨±äÁ¿µÄÀà¡£
3.±êÇ©¿âÃèÊöÆ÷£¨TLD£©£ºÃèÊöµ¥¸ö±êÇ©ºÍÕû¸ö±êÇ©¿âÊôÐÔµÄXMLÎĵµ¡£
±êÇ©´¦ÀíÆ÷ºÍ±êÇ©¸½¼ÓÐÅÏ¢ÐèÒª¶¨Î»ÔÚJSPÈÝÆ÷ÀàÔØÈëÆ÷Äܹ»ÕÒµ½µÄµØ·½¡£±êÇ©¿âÃèÊöÆ÷¿ÉÔÚURLÖ¸¶¨µÄ·ûÒâλÖá£JSP1.1¹æ·¶ÐèÒªJSPÈÝÆ÷½ÓÊÜÒ»¸ö´ò°ü³ÉÒò¶¨½á¹¹µÄJARÎĵµµÄ±êÇ©¿â¡£TLD±ØÐëÊÇ/META-INFĿ¼ÖÐÃûΪtaglib.tldµÄÎĵµ£¬JARÎĵµÔò¸´ÖƵ½/WEB-INF/libĿ¼Ï¡£
Ò»¡¢±êǩʵÏÖ
1.Ñз¢²½Öè
a.¶¨Òå±êÇ©µÄÃû×Ö¡¢ÊôÐÔ¡¢ÉùÃ÷µÄ±äÁ¿ºÍ±êÇ©ÌåµÄÄÚÈÝ¡£
b.±àд±êÇ©¿âÃèÊöÆ÷TLD¡£
c.±àд±êÇ©´¦ÀíÆ÷¡£
d.ÔÚJSPÒ³ÃæÖÐʹÓñêÇ©¡£
2.JSPÒ³ÃæÔÚJSPÈÝÆ÷ÖеÄת»»²½Ö裺
JSPÒ³Ãæ´æÔÚÈýÖÖÐÎʽ£ºjspÎĵµ¡¢javaÎĵµºÍclassÎĵµ¡£
a.Ö¸ÁîÔªËØ¡¢ºÍÏòJSPÈÝÆ÷Ìṩת»»Ê±ÐÅÏ¢¡£
b.HTMLÐÐÔÚ_jspService()·½·¨ÖÐÒÀ˳Ðòת»»µ½out.print()ÓïÃûÖС£
c.½Å±¾ÔªËصÄÉùÃ÷±»Ô·â²»¶¯µØ¸´ÖƵ½_jspService()·½·¨ÍâµÄÔ´ÂëÖС£
d.½Å±¾ÔªËصıí´ïʽÔÚ_jspService()·½·¨ÖÐÒÀ˳Ðòת»»µ½out.print()ÓïÃûÖС£
e.½Å±¾ÔªËصÄScriptlet±»Ô·â²»¶¯µØ¸´ÖƵ½_jspService()·½·¨ÖС£
f.ÐÐΪԪËر»×ª»»ÎªÖ´ÐÐÆ书ÄܵÄÔËÐÐʱÂß¼´úÂë¡£
g.¶¨ÖƱêÇ©±»À©Õ¹µ½µ÷ÓÃÆäÏàÓ¦±êÇ©´¦ÀíÆ÷Öз½·¨µÄJavaÓï¾äÖС£
3.±êÇ©ÔÚJSPÈÝÆ÷ÖеÄת»»²½Ö裺
a.JSPÈÝÆ÷ʹÓÃtaglibÖ¸ÁîÔªËض¨Î»±êÇ©¿âÃèÊöÆ÷£¬½«Ò³ÃæÖÐÓõ½µÄ¶¨ÖƱêÇ©ºÍTLDÏàÆ¥Åä¡£
b.¶ÁÈ¡±êÇ©¿âÃèÊöÆ÷µÄ±êÇ©ÁбíºÍÿһ±êÇ©Ïà¹ØµÄÀàÃû×Ö¡£
c.ÔÚÒ³ÃæÖÐÅöµ½Ò»¸ö±êǩʱ£¬²éÕҺ;߱¸Ö¸¶¨Ãû×ֵıêǩǰ׺Ïà¹ØµÄÒ»¸ö±êÇ©¿â¡£
d.ÈÝÆ÷ʹÓÃÔÚTLDÖÐÕÒµ½µÄ±êÇ©½á¹¹ÐÅÏ¢Éú³ÉһϵÁÐÍê³É±êÇ©¹¦ÄܵÄJavaÓï¾ä¡£
¶þ¡¢±êÇ©¿âÃèÊöÆ÷£¨TLD£©
±êÇ©¿âÃèÊöÆ÷ÊǸöÃèÊöÕû¸ö±êÇ©¿â±ê¼ÇÐÅÏ¢ºÍ¿âÖÐÿ¸ö±êÇ©´¦ÀíÆ÷¼°ÆäÊôÐÔµÄXMLÎĵµ¡£
±êÇ©¿âÃèÊöÆ÷µÄDTDÓÉÒ»¸ö¼òµ¥µÄÔªËØ×é³É£¬´ËÔªËØ°üº¬ÏÂÁÐһЩ×ÓÔªËØ¡£
Õû¸ö±êÇ©¿â±ê¼ÇÐÅÏ¢
tlibversion ±êÇ©¿â°æ±¾ºÅ¡£ÊǸöµãʽʮ½øÖÆÊý£¬×î¶àΪ4×éСÊýµã·Ö¸ôµÄÊý×Ö×é³É¡£
jspversion ±êÇ©¿âËùÐèµÄJSP¹æ·¶×îµÍ°æ±¾¡£ÀýÈçJSP1.1
shortname ±êÇ©¿âµÄËõдÃû¡£JSPÄܹ»Ê¹ÓøÃÃû×Ö×÷Ϊ¿âÖбêÇ©µÄȱʡǰ׺¡£
uri ±êÇ©¿âΨһURIµÄÔªËØ¡£µäÐÍURLλÖÃÀ´×
Ïà¹ØÎĵµ£º
Ò³ÃæµÄÊäÈëºÍÊä³öÉæ¼°µ½ÁËRequestºÍResponse,ÓÉÓÚËûÃǺÍJspÖеÄÏàËÆ,
ÏÂÃæÎÒÃǽøÐÐÏêϸµÄ½â¶Á£º
JSPÖУº
ÔÚ¶¯Ì¬ÍøÒ³¿ª·¢ÖУ¬HTML±íµ¥ÊÇÓëÓû§½»»¥ÐÅÏ¢µÄÖ÷ÒªÊֶΡ£
ʹÓÃJSP´¦Àí±íµ¥ÇëÇóʱ£¬Ò»°ã×ñÑÕâÑùÒ»ÖÖģʽ£¬Ê×ÏÈ£¬Óû§Í¨¹ý±íµ¥¿Ø¼þÊäÈë²¢Ìá½»ÐÅÏ¢;½Ó×Å£¬JSPÒ³Ãæ»ñµÃ±íµ¥Êý ......
Ò»¸öajaxÇëÇóÒ»¸öjspÎļþ£¬²Ù×÷³É¹¦,jspÎļþout.println("1");µ«ÊÇÿ´Î³É¹¦ºóxmlHttp.responseText=='1'×ÜÊÇΪfalse£¬
ÓÃencodeURIComponent¿´xmlHttp.responseText£¬·¢ÏÖ×îºó¶àÁË%0A%0D£¬°Ù¶ÈһϠÓÃÀ´ÊÇ»»ÐУ¬
jspÎļþÖеÄout.println……°ÑlnÈ¥µôÔÙ´Î±È½Ï ³É¹¦ = =¡ ......
1.request¶ÔÏó
¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóµÄÏìÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
µ±request¶ÔÏó»ñÈ¡Óû§Ìá½»µÄºº×Ö×Ö·ûʱ£¬»á²úÉúÂÒÂ룬ÓÉÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö£º
Sting s2 = new String(s1.getBytes("iso8859-1"),"GB2312")½øÐÐת»»¡£
request³£Óõķ½·¨ ......
ÓÉÓÚÒª×öÉÏ´« ¾ÍÕÒÁ˸öÀý×Ó Áô×Ųο¼
ÉÏ´«£ºÐèÒªsmartupload×é¼þ
import com.jspsmart.upload.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
/**
* ÉÏ´«¹«¹²Àà,¶ÔSmartUpload½øÐÐÁË·â×°
* ......
¼¸ºõËùÓеÄWeb¿ª·¢ÓïÑÔ¶¼Ö§³ÖSession¹¦ÄÜ£¬ServletÒ²²»ÀýÍâ¡£ Servlet/JSPÖеÄSession¹¦ÄÜÊÇͨ¹ý×÷ÓÃÓò(scope)Õâ¸ö¸ÅÄîÀ´ÊµÏֵġ£
×÷ÓÃÓò·ÖΪËÄÖÖ£¬·Ö±ðΪ£º
page
ÔÚµ±Ç°Ò³ÃæÓÐЧ(½öÓÃÓÚJSPÖÐ)
request
ÔÚµ±Ç°ÇëÇóÖÐÓÐЧ
session
ÔÚµ±Ç°»á»°ÖÐÓÐЧ
application
ÔÚËùÓÐÓ¦ÓóÌÐòÖÐÓÐЧ
ÊDz»ÊÇ¿´²»Ì«Ã÷°×£¿pageÒòΪ½ ......