¡¾JSPѧϰ±Ê¼Ç¡¿ JSP֪ʶµã×ܽá
Ò»¡¢JSPµÄ¼¼ÊõÔÀí
¶þ¡¢JSPµÄ×¢ÊͺÍÉùÃ÷
JSP×¢ÊÍÓÃÓÚ±íÃ÷ÔÚ³ÌÐò¿ª·¢¹ý³ÌÖеĿª·¢Ìáʾ£¬²»»áÊä³öµ½¿Í»§¶Ë£»
<%--×¢ÊÍÄÚÈÝ--%> —— JSP×¢ÊÍ
<£¡--×¢ÊÍÄÚÈÝ--£¡> ——HTML×¢ÊÍ
Èý¡¢JSP½Å±¾
<%! ÉùÃ÷²¿·Ö %>
<%= ±í´ïʽ %>
<% JSP½Å±¾ %>
ËÄ¡¢JSPµÄÈý¸ö±àÒëÖ¸Áî
³£¼ûµÄ±àÒëÖ¸ÁîÓÐÈý¸ö£ºpage£¬Taglib£¬include£»
¸ñʽ£º<%@ ±àÒëÖ¸ÁîÃû ÊôÐÔÃû=“ÊôÐÔÖµ” … %>
page£º¸ÃÖ¸ÁîÊÇÕë¶Ôµ±Ç°Ò³ÃæµÄÖ¸Á
include:ÓÃÓÚÖ¸¶¨ÈçºÎ°üº¬ÁíÒ»¸öÒ³Ã棻
taglib£ºÓÃÓÚ¶¨ÒåºÍ·ÃÎÊ×Ô¶¨Òå±êÇ©£»
Îå¡¢JSPµÄÆ߸ö´¦ÀíÖ¸Áî
JSP¶¯×÷Ö¸ÁîÖ÷ÒªÓÐÒÔÏÂ7¸ö£º
jsp:forward :Ö´ÐÐÒ³ÃæתÏò£¬½«ÇëÇóµÄ´¦Àíת·¢µ½ÏÂÒ»¸öÒ³Ã棻
jsp:param :ÓÃÓÚ´«µÝ²ÎÊý£¬±ØÐëÓëÆäËûÖ§³Ö²ÎÊýµÄ±êÇ©Ò»ÆðʹÓã»
jsp:include £º ÓÃÓÚ¶¯Ì¬µÄÒýÈëÒ»¸öJSPÒ³Ã棻
jsp:plugin : ÓÃÓÚÏÂÔØJavaBean»òÕßAppletµ½¿Í»§¶ËÖ´ÐУ»
jsp:useBean £º ʹÓÃJavaBean£»
jsp:setProperty £º ÐÞ¸ÄJavaBeanʵÀýµÄÊôÐÔÖµ£»
jsp:getProperty : »ñÈ¡JavaBeanʵÀýµÄÊôÐÔÖµ£»
Áù¡¢JSPµÄ¾Å¸öÄÚÖöÔÏó
application£º
config£º
exception:
out
page:
pageContext:
request:
response:
session:
Æß¡¢Servlet½éÉÜ
°Ë¡¢Filter£¬Listener
¾Å¡¢JSP2.0ÐÂÌØÐÔ
±í´ïʽÓïÑÔ£ºEL
¼ò»¯µÄ×Ô¶¨Òå±êÇ©API
TAGÎļþÓï·¨
&nb
Ïà¹ØÎĵµ£º
//ѧϰ±Ê¼Ç, ¿ÉÄÜÓÐЩµØ·½Àí½âÓÐÎó, »á±í´ï²»Çå³þ
v512_servlet+jsp
01 ÔÚÐÞ¸ÄÍêCookieºó,Ò»¶¨Òª¼ÓÉÏresponse.addCookie(c);
CookieÖÐÖ»Äܱ£´æ×Öĸ»òÊý×ÖÐÅÏ¢;
02 req.getSession()Óëreq.getSession(boolean create)
ÎÞ²ÎÊýµÄ == ÓвÎÊýµÄ²ÎÊýÎ ......
ÂÒÂëÕæÊǸöÁîÈËÌÖÑáµÄÎÊÌâ~
¸Õ²ÅÖÕÓÚ°ÑMySQLÓëJSP½»»¥µÄÂÒÂëÎÊÌâ½â¾öÁË¡£
°ì·¨ÈçÏ£º
1.ÔÚurl´¦¼ÓÉϾä×Ó "&useUnicode=true&characterEncoding=GBK" £»
2.ÎÒÓÃNavicat Lite¿ÉÊÓ»¯¹¤¾ß´´½¨MySQLÊý¾Ý¿âʱ£¬¿ÉÑ¡¶¨Êý¾Ý¿â±àÂ룬ҲÊÇ GBK £»
3.Ò³ÃæµÄ±àÂë¿ÉÒÔÑ¡GBKÒÔÍâµÄ±àÂ뷽ʽ£¬ÈçUTF-8¡£Èô²Ù×÷Ò³ÃæµÄ±àÂëÊÇUTF- ......
1¡¢Í¨¹ý<s:form
action="ÌøתҳÃæ">Ìá½»Öµ£¬µ«ÊÇÔÚ<s:form>±êÇ©ÖеÄactionºóÃæÖÁ¶àÖ»ÄܸúÒ»¸ö²ÎÊý£¬²¢ÇÒ»¹»á±¨¾¯¸æ£¬ËùÒÔÈç¹û
Ïë´«µÝ²ÎÊý¿ÉÒÔÓÃ<s:hidden name=""
values="username"></s:hidden>À´´«Öµ£¬µ«ÊÇÕý¹æµÄд·¨ÐèÒªÅäºÏ<s:set>±êÇ©À´ÓÃ
È磺
......
application£ºÈ«¾Ö×÷Ó÷¶Î§£¬Õû¸öÓ¦ÓóÌÐò¹²Ïí£¬¾ÍÊÇÔÚ²¿ÊðÎļþÖеÄͬһ¸öwebApp¹²Ïí£¬ÉúÃüÖÜÆÚΪ£ºÓ¦ÓóÌÐòÆô¶¯µ½Í£Ö¹¡£
session£º»á»°×÷ÓÃÓò£¬µ±Óû§Ê״ηÃÎÊʱ£¬²úÉúÒ»¸öеĻỰ£¬ÒÔºó·þÎñÆ÷¾Í¿ÉÒÔ¼ÇסÕâ¸ö»á»°×´Ì¬¡£ÉúÃüÖÜÆÚ£º»á»°³¬Ê±£¬»òÕß·þÎñÆ÷¶ËÇ¿ÖÆʹ»á»°Ê§Ð§¡£
sessionÊÇÕë¶Ôµ¥¸ö¿Í»§ºÍ·þÎñÆ÷½øÐлỰµÄ  ......