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

JSPѧϰ£¨Ò»£©

JSP»ù±¾Óï·¨
´ó²¿·ÖJSP±»Ò»¸öÒÔ“<%” ¿ªÍ·ºÍÒÔ“%>”½áβµÄµÄ±ê¼ÇÀ¨ÔÚÆäÖС£ÔÚ¸üеÄJSP 1.1¹æ·¶³ǫ̈ºó£¬¾ÍÓÐÁËÓëXML¼æÈݵİ汾¡£
JSPÖ¸ÁîºÍ½Å±¾ÔªËØ
Directives <%@ directive %>
Declarations <%! declaration %>
Expressions <%= expression %>
Code Fragment/Scriptlet <% code fragment %>
Comments <%-- comment --%>
µÚÒ»¸öJSP:  Hello World
 <%
String str1 = "Hello World!";
%>
<h2><%=str1%></h2>
<%
out.print("I'm OH.C");
%>
Êä³öÏÔʾΪ£º
Hello World!
I'm OH.C
Ö¸Áî
JSPÖ¸ÁîÊÇΪJSPÒýÇæ¶øÉè¼ÆµÄ¡£ËûÃDz¢²»Ö±½Ó²úÉúÈκοɼûÊä³ö£¬¶øÖ»ÊǸæËßÒýÇæÈçºÎ´¦ÀíÆäÓàJSPÒ³Ãæ¡£ÕâЩָÁîʼÖÕ±»À¨ÔÚ “<%@ ...%>”±ê¼ÇÖС£Á½¸ö×îÖØÒªµÄÖ¸ÁîÊÇ“page”ºÍ“Include”¡£“Taglib”Ö¸Áî²»ÔÚÌÖÂÛÖ®ÁУ¬µ«ÊÇÔÚÓÃJSP1.1´´½¨×Ô¶¨Òå±ê¼Ç¿ÉÒÔʹÓÃËü¡£
¼¸ºõÔÚËùÓÐJSPÒ³Ã涥²¿¶¼»á¿´µ½“Page”Ö¸Áî¡£¾¡¹Ü²»ÊDZØÐëµÄ£¬µ«Ëü¿ÉÒÔÈÃÄãÖ¸¶¨£º
µ½ºÎ´¦²éÕÒÆðÖ§³Ö×÷ÓõÄJavaÀà±ð£º
<%@ page import="java.util.Date" %>,
³öÏÖJavaÔËÐÐÎÊÌâʱ£¬½«ÍøÉϳåÀËÕßÒýÏòºÎ´¦£º
<%@ page errorPage="errorPage.jsp" %>,
»¹ÓÐÄãÊÇ·ñÐèÒª¹ÜÀíÓû§µÄ»á»°¼¶ÐÅÏ¢£¬ÕâЩÐÅÏ¢¿ÉÄÜÀ´×Ô¶à¸öÍøÒ³£º
<%@ page session="true" %>.
“Include”Ö¸Áî¿ÉÒÔ°ÑÄãµÄÄÚÈݷֳɸü¶à¿É¹ÜÀíµÄÔªËØ£¬±ÈÈç°üÀ¨Ò»¸öÆÕͨҳÃæҳü»òÒ³½ÅµÄÔªËØ¡£°üº¬µÄÍøÒ³¿ÉÒÔÊÇÒ»¸ö¹Ì¶¨µÄHTML Ò³Ãæ»ò¸ü¶àµÄJSPÄÚÈÝ£º
<%@ include file="200453092147.htm.jsp" %>
ÉùÃ÷
JSPÉùÃ÷ÓÃÀ´ÈÃÄ㶨ÒåÒ³Ã漶±äÁ¿£¬ÒÔ±£´æÐÅÏ¢»ò¶¨ÒåJSPÒ³ÃæµÄÆäÓಿ·Ö¿ÉÄÜÐèÒªµÄÖ§³Ö·½·¨¡£Èç¹ûÄã·¢ÏÖ´úÂëÌ«¶à£¬Í¨³£×îºÃ°ÑËüÃÇд³ÉÒ»¸ö¶ÀÁ¢µÄJavaÀà±ð¡£ÉùÃ÷Ò»°ã¶¼ÔÚ“<%  %>”±ê¼ÇÖС£Ò»¶¨ÒªÒԷֺţ¨£»£©½áÊø±äÁ¿ÉùÃ÷£¬ÒòΪÈκÎÄÚÈݶ¼±ØÐëÊÇÓÐЧµÄJavaÓï¾ä£º
<% int i=0; %>¡£
±í´ïʽ
ÓÐÁËJSP±í´ïʽ£¬±í´ïʽÆÀ¹À½á¹û»á±»×ª»»³ÉÒ»¸ö×Ö·û´®£¬²¢ÇÒ±»Ö±½Ó°üÀ¨ÔÚÊä³öÒ³ÃæÖ®ÄÚ¡£JSP ±í´ïʽ°üº¬ÔÚ“<%=   %>” ±ê¼ÇÖУ¬Ã»Óзֺţ¬³ý·ÇÔÚ¼ÓÒýºÅµÄ×Ö·û´®²¿·ÖʹÓ÷ֺš£
<%= i %>
<%= "Hello" %>
´úÂëƬ¶Î/½Å±¾Æ¬¶Î
´úÂëƬ¶Î/½Å±¾Æ¬¶Î


Ïà¹ØÎĵµ£º

JSPÖеÄpage,request,session,application

application£ºÈ«¾Ö×÷Ó÷¶Î§£¬Õû¸öÓ¦ÓóÌÐò¹²Ïí£¬¾ÍÊÇÔÚ²¿ÊðÎļþÖеÄͬһ¸öwebApp¹²Ïí£¬ÉúÃüÖÜÆÚΪ£ºÓ¦ÓóÌÐòÆô¶¯µ½Í£Ö¹¡£
session£º»á»°×÷ÓÃÓò£¬µ±Óû§Ê״ηÃÎÊʱ£¬²úÉúÒ»¸öеĻỰ£¬ÒÔºó·þÎñÆ÷¾Í¿ÉÒÔ¼ÇסÕâ¸ö»á»°×´Ì¬¡£ÉúÃüÖÜÆÚ£º»á»°³¬Ê±£¬»òÕß·þÎñÆ÷¶ËÇ¿ÖÆʹ»á»°Ê§Ð§¡£
sessionÊÇÕë¶Ôµ¥¸ö¿Í»§ºÍ·þÎñÆ÷½øÐлỰµÄ  ......

¹ØÓÚJAVA,JSPµÄ1¸öÎÊÌâ

×î½üÔÚѧJAVA£¬Á·Ï°µÄʱºòÓöµ½¸öÎÊÌ⣬Çë´ó¼Ò°ïæ¿´¿´……
Ö÷ÒªÎÊÌâÊÇ£¬ÔÚJSPÖÐûÓа취µ¼ÈëÎÒÏëÓõÄÀ࣬Ã÷Ã÷µ¼ÈëÁË°ü£¬È´±¨£ºMyDAO cannot be resolved to a type
JSP´úÂ룺
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.t ......

JSP»ù´¡

Ò»¡¢JSP¼ò½é
JSP (Java Server Pages)ÊÇ·þÎñÆ÷¶ËµÄ½Å±¾ÓïÑÔ£¬ÊÇÒ»ÖÖÔÚHTMLÒ³ÃæÖмÓÈëJavaÓïÑÔ¶øÉú³É¶¯Ì¬Ò³ÃæµÄ¼¼Êõ£º¼ÓÈëÁËеıêÇ©£¨<%£¬%>£¬…£©¡£
JSPÊÇÒÔJavaºÍServletΪ»ù´¡¿ª·¢¶ø³ÉµÄ¶¯Ì¬ÍøÒ³Éú³É¼¼Êõ£¬ËüµÄµ×²ãʵÏÖÊÇJava Servlet¡£
JSPÒ³ÃæÓÉHTML´úÂëºÍǶÈëÆäÖеÄJava´úÂëËù×é³É¡£·þÎñÆ÷ÔÚÒ³Ãæ±»¿Í» ......

Êý¾Ý¿â»º´æ·½°¸£¨Java°æµÄ£¬º¬²âÊÔJSP£©£¨×ª£©

http://hi.baidu.com/shedewang/blog/item/b4a71b254e43ce35c895599b.html
˵ÊÇÖ§³Ö1ÒÚpv/Ì죬ҲÐíÓеã¿äÕÅ£¬µ«Èç¹ûÄúÄÜÈÏÕæ¿´ÍêÏàÐÅÒ²²»»áÈÃÄúʧÍû¡£
Èç¹û´ó¼ÒÕæÏëÖ§³ÖÎÒ¡¢Ö§³ÖÖйúÈË¿ªÔ´ÏîÄ¿£¬Çë°Ñ¸ÃÎÄÌùµ½×Ô¼ºµÄ²©¿ÍÖлòÕßÊղر¾ÎÄ£¬¼ÇµÃ°üº¬ÎĵµµÄÏÂÔصØÖ·£¡£¡£¡£¡£¡£¡£¡Ð»Ð»¡£
ÎÒ˵µÄϵͳÖ÷ÒªÊǹ¹½¨ÔÚhibernateÖ®ÉÏ ......

ÔÚTomcat6.0ÖйØÓÚJSP/Servlet±íµ¥ÂÒÂëµÄÒ»¸ö½â¾ö·½·¨

²½ÖèÒ»£º±à¼­TomcatµÄÅäÖÃÎļþconf/server.xmlÔÚÓÃÓÚ½ÓÊÜ¿Í»§¶ËÓï·¨µÄConnector<connector></connector>±êÇ©ÖÐÌí¼ÓURIEncoding="UTF-8"ÊôÐÔ£¬¸ÃÊôÐÔÓÃÀ´½â¾öGETÖеıàÂëÎÊÌâ¡£
xml ´úÂë
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" / ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ