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

JSPÒ³Ãæ¼ä´«µÝ²ÎÊý·½·¨½éÉÜ


JSPÒ³Ãæ¼ä´«µÝ²ÎÊý·½·¨½éÉÜ
±¾ÎĽéÉÜÁËJSPÒ³Ãæ¼ä´«µÝ²ÎÊýµÄ¼¸¸ö·½·¨¡£×îÖ±½ÓµÄ·½·¨¾ÍÊÇÖ±½ÓÔÚURLÇëÇóºóÌí¼Ó£¬²»¹ý¶à¸öÒ³ÃæµÄÇé¿ö»á¸´ÔÓһЩ¡£
JSPÒ³Ãæ¼ä´«µÝ²ÎÊýÊǾ­³£ÐèҪʹÓõ½µÄ¹¦ÄÜ£¬ÓÐʱ»¹ÐèÒª¶à¸öJSPÒ³Ãæ¼ä´«µÝ²ÎÊý¡£ÏÂÃæ½éÉÜÒ»ÏÂʵÏֵķ½·¨¡£
£¨1£©Ö±½ÓÔÚURLÇëÇóºóÌí¼Ó
È磺< a href="thexuan.jsp?action=transparams&detail=directe">Ö±½Ó´«µÝ²ÎÊý< /a>
ÌرðµÄÔÚʹÓÃresponse.sendRedirect×öÒ³ÃæתÏòµÄʱºò£¬Ò²¿ÉÒÔÓÃÈçÏ´úÂ룺
response.sendRedirect("thexuan.jsp?action=transparams&detail=directe") £¬¿ÉÓÃrequest.getParameter(name)È¡µÃ²ÎÊý
£¨2£©jsp:param
Ëü¿ÉÒÔʵÏÖÖ÷Ò³ÃæÏò°üº¬Ò³Ãæ´«µÝ²ÎÊý£¬ÈçÏ£º
< jsp:include page="Relative URL">  < jsp:param name="param name" value="paramvalue" />  < /jsp:include> 
»¹¿ÉÒÔʵÏÖÔÚʹÓÃjsp:forward¶¯×÷×öÒ³ÃæÌøתʱ´«µÝ²ÎÊý£¬ÈçÏ£º
< jsp:forward page="Relative URL">  < jsp:param name="paramname" value="paramvalue" /> 
< /jsp:forward> ͨ¹ýÕâÖÖ·½Ê½ºÍÒ»°ãµÄ±íµ¥²ÎÊýÒ»ÑùµÄ£¬Ò²¿ÉÒÔͨ¹ýrequest.getParameter(name)È¡µÃ²ÎÊý
£¨3£©ÉèÖÃsessionºÍrequest
ͨ¹ýÏÔʾµÄ°Ñ²ÎÊý·ÅÖõ½sessionºÍrequestÖУ¬ÒÔ´ïµ½´«µÝ²ÎÊýµÄÄ¿µÄ
session.setAttribute(name,value);   request.setAttribute(name,value)  
È¡²ÎÊý£º
value=(value className)session.getAttribute(name);   value=(value className)request.getAttribute(name);   
´ó¼Ò¿Ï¶¨ÒѾ­×¢Òâµ½ÁË£¬ÔÚÈ¡²ÎÊýµÄʱºò£¬×öÁËÀàÐÍת»»£¬ÕâÊÇÒòΪ·ÅÖÃÔÚsessionºÍrequestÖеĶÔÏóµÄÊôÐÔ±»¿´×÷ java.lang.ObjectÀàÐ͵ÄÁË£¬Èç¹û²»×ª»»£¬ÔÚ½«Ö±¸¶¸øvalueʱ»á±¨classcastexceptionÒì³£¡£
ÔÚ¶à¸öJSPÒ³ÃæÖ®¼ä´«µÝ²ÎÊý
1.       ÔõôÔÚ¶à¸öJSPÒ³ÃæÖ®¼ä½øÐвÎÊý´«µÝ£¿ÐèҪʹÓÃJSPµÄÄÚÖÃ×÷ÓÃÓò¶ÔÏósession¡£ÀûÓÃËüµÄÁ½¸ö·½·¨setAttribute()£¬getAttribute()
2.       ÏÂÃæµÄÕâ¸öʵÀýʵÏÖÁ˰ѵÚÒ»¸öJSPÒ³ÃæµÄ²ÎÊý´«µÝ¸øµÚÈý¸öÒ³ÃæµÄ¹¦ÄÜ
3.       ´úÂëÈçÏ£º1.jsp
< html>&nb


Ïà¹ØÎĵµ£º

jsp servletÖеĹýÂËÆ÷FilterÅäÖÃ×ܽá

Ô­ÎĵØÖ·£ºhttp://hi.baidu.com/wangking/blog/item/8a109423ff3d2341ac34dec9.html
ÔÚJava web¿ª·¢Öг£»áʹÓõ½¹¦ÄÜÇ¿´óµÄ¹ýÂËÆ÷£¬Ëû±Ï¾¹ÄܸøÎÒÃÇ´øÀ´ºÜ´óµÄ·½±ã£¬µ«ÊÇÕë¶Ô¹ýÂ˵Ä×ÊÔ´ÎÒÃÇÐèÒªÏêϸµÄÁ˽âËûÃÇÔÚweb.xmlÖеÄÅäÖÃÐÅÏ¢¡£Õâ¸ö¸ù¾Ý¼¸ÖÖ³£ÓõIJ»Í¬Çé¿ö½øÐÐÁË×ܽ᣺
1¡£Èç¹ûÒªÓ³Éä¹ýÂËÓ¦ÓóÌÐòÖÐËùÓÐ×ÊÔ´£º
< ......

jsp¾²Ì¬»¯ºÍα¾²Ì¬»¯


Ê×ÏÈ˵˵ΪʲôҪ¾²Ì¬»¯¡£
¶ÔÓÚÏÖÔÚµÄWeb ApplicationÀ´Ëµ£¬¶¯Ì¬Ò³ÃæÊÇÕ¼Óоø¶Ô¸ßµÄµØλµÄ£¬ÕýÒòΪÓÐÁ˶¯Ì¬»¯£¬²ÅÓÐÁËÏÖÔÚWebµÄ·á¸»¶à²Ê£¬µ«ÊÇÈçͬËùÓбðµÄÊÂʵһÑù£¬ºÃ´¦ÍùÍù¶¼ÊÇÓдú¼ÛµÄ¡£
ΪÁ˲úÉú³ö¶¯Ì¬µÄЧ¹û£¬Ã¿Ò»´Î¶ÔÒ³ÃæµÄÇëÇ󶼻áÒªÇó·þÎñÆ÷¶ÔÒ³Ãæ½øÐбàÒë»òÕßÖ´ÐУ¬ÕâЩ²Ù×÷¶¼ºÜÏûºÄϵͳ×ÊÔ´¡£Èç¹ûÕâÆڼ仹ÓÐ ......

jspѧϰ±Ê¼Ç1

JSP£¨java server page£©
JSPÊÇ·þÎñÆ÷¶ËÔËÐеÄÒ³Ã棬JSP±¾Ê¾ÍÊÇÒ»¸öÎĵµ£¬Ëû²»½ö¿ÉÒÔ°üº¬¾²Ì¬µÄHTML´úÂ룬Ҳ¿ÉÒÔ°üº¬¶¯Ì¬µÄJAVA´úÂ룬·þÎñÆ÷ÈÝÆ÷¿ÉÒÔ½«JSPת»»³ÉServlet·¢²¼£¬²¢½ÓÊÜÇëÇó¡£
JspÎļþÖ»Ðè·ÅÔÚÓ¦ÓÃÎļþϾͿÉÒÔÁË¡£
JSPÀý×Ó£º
     <html>
     <head& ......

jspѧϰ±Ê¼Ç2

JSPµÄ×¢ÊÍ
<%--........--%>
JSPÖ¸ÁîºÍJSP¶¯×÷£¨±ê×¼µÄJSP±êÇ©£©
JSPÖ¸ÁîµÄÓï·¨
<%@... ....%>
<%@include file="...."%> °üº¬Ö¸Á°üº¬Ö¸Áî»á½«Òª°üº¬µÄÎļþ´úÂëÔ­ÑùÊä³öµ½±¾Ò³Ã棨ÔÚ·­Òëʱ°Ñ°üº¬ÎļþµÄÄÚÈÝÒýÈë²¢ºÏ²¢£©£¬²»½øÐз­Ò룬fileÊôÐÔÖƶ¨Òª°üº¬µÄÎļþµÄÃû×Ö£¨×¢ÒâÒª°üº¬µÄÎļþµÄ·¾¶£©£ ......

jspѧϰ±Ê¼Ç4

JSP×Ô¶¨Òå±êÇ©£¨tag£©
ʲôÊÇ×Ô¶¨Òå±êÇ©
1£¬Óû§×Ô¶¨ÒåµÄJavaÓïÑÔÔªËØ, ʵÖÊÊÇÔËÐÐÒ»¸ö»òÕßÁ½¸ö½Ó¿ÚµÄJavaBean;
2£¬¿ÉÒԷdz£»úÃܵغÍJSPµÄ±íʾÂß¼­ÁªÏµÔÚÒ»Æð£¬ÓÖ¾ßÓкÍÆÕͨJavaBeanÏàͬµÄÒµÎñÂß¼­´¦ÀíÄÜÁ¦;
3£¬µ±Ò»¸öJSPÒ³Ãæת±äΪservletʱ£¬Æä¼äµÄÓû§×Ô¶¨Òå±êǩת»¯Îª²Ù×÷Ò»¸ö³ÆΪ±êÇ©handerµÄ¶ÔÏó;
4£¬¿É²Ù×÷ĬÈÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ