¿´V512ÊÓƵJsp/Servletѧϰ±Ê¼Ç
//ѧϰ±Ê¼Ç, ¿ÉÄÜÓÐЩµØ·½Àí½âÓÐÎó, »á±í´ï²»Çå³þ
v512_servlet+jsp
01 ÔÚÐÞ¸ÄÍêCookieºó,Ò»¶¨Òª¼ÓÉÏresponse.addCookie(c);
CookieÖÐÖ»Äܱ£´æ×Öĸ»òÊý×ÖÐÅÏ¢;
02 req.getSession()Óëreq.getSession(boolean create)
ÎÞ²ÎÊýµÄ == ÓвÎÊýµÄ²ÎÊýΪtrueʱ
ÓвÎÊýµÄ,µ±²ÎÊýΪtrueʱ,Èç¹ûûÓÐSession¶ÔÏó¾Í´´½¨Ò»¸ö; Èç¹û²ÎÊýΪfalse,Ôò·µ»Ønull;
03 »á»°µÄÏûʧ: ä¯ÀÀÆ÷µÄ¹Ø±Õ; Ö÷¶¯¹Ø±Õ; »á»°³¬Ê±; (????ä¯ÀÀÆ÷¹Ø±Õ)
04 ÈçºÎÓ¦ÓÃEclipseÀ´¿ª·¢Servlet????????
05 TomcatµÄworkĿ¼±£´æÁËËùÓеÄjspת»»³ÉServletµÄËùÓÐÔ´ÎļþºÍ±àÒëºóµÄÎļþ;
06 charset = gbkÓëpageEncoding = gbkЧ¹ûÒ»Ñù;
07 <%@ include file="..." %>: ¿ÉÒÔ°üº¬Ò»¸ö.html/.jspµÈÎļþ½øÀ´;
08 Ö¸Áʽ°üº¬: <%@ include file="logn.jsp" %> °ÑËüµÄÄÚÈÝ°üº¬½øÀ´;
¶¯×÷·½Ê½°üº¬: <jsp:include page="logn.jsp" > µ÷Ó÷½·¨ÊµÏÖ;
<jsp:forward page="logn.jsp" > µÈ¼ÛÓÚ requuest.getRequestDipacher().forward(request,response)
09 ¶ÔÏóÃû:application ---> javax.servlet.ServletContext(ÉÏÏÂÎÄ)
10 ±»ÒýÈëµÄ.classÎļþ²»ÄÜûÓаü??? Èç:count2.jsp
11 ´íÎó´úÂë:
401ÑéÖ¤³ö´í(ÈçÃÜÂë), 404²»´æÔÚµÄ×ÊÔ´, 405Ìá½»·½Ê½²»ÔÊÐí, 505·þÎñÆ÷¶Ë´úÂë´íÎó;
12 javabenaÐèÒª¶¨ÒåÒ»¸öÎ޲εķ½·¨, ÇÒ±ØÐëÒªÓаü, ²»ÄÜʹÓÃÂãÌåÀà;
13 <jsp:useBena setProperty name="..." property="..." /> ĬÈϽÓÊÜformÌá½»¹ýÀ´µÄ²ÎÊý;
JSP EL
01. JSP ELÔËËã·û:
¿ÉÒÔÓÃdivÌæ»»/, ÓÃmodÌæ»»%
and &&, or ||, not !
02. <%@ page isELIgnored="true" %> :Ö¸¶¨µ±Ç°Ò³Ã治ʹÓÃjsp el(Ò²¿ÉÒÔÔÚweb.xmlÖÐÅäÖÃ)
03. ${10 + 10 }Ï൱ÓÚ <%= 10+10 %>, ¿ÉʹÓÃ\$»ò'$'Êä³ö: ×Ö·û$
04. ${username} :Êä³ö×÷ÓÃÓò×îСµÄusernameµÄÊôÐÔÖµ;
Tag Lib
01. (1) ±àдһ¸öclass¼Ì³ÐTagSupport, ÖØдdoStartTag(),doEndTag()·½·¨,
JspWriter out = pageContext.getOut();µÃµ½´
Ïà¹ØÎĵµ£º
JFreeChartÊÇÒ»×鹦ÄÜÇ¿´ó¡¢Áé»îÒ×ÓõÄJava»æͼAPI£¬Ê¹ÓÃËü¿ÉÒÔÉú³É¶àÖÖͨÓÃÐԵı¨±í£¬°üÀ¨Öù״ͼ¡¢±ýͼ¡¢ÇúÏßͼ¡¢¸ÊÌØͼµÈ¡£ËüÄܹ»ÓÃÔÚSwingºÍWebµÈÖÐÖÆ×÷×Ô¶¨ÒåµÄͼ±í»ò±¨±í£¬²¢Çҵõ½¹ã·ºµÄÓ¦Óᣱ¾ÎĽ«Í¨¹ýÒýÁì¶ÁÕßѧϰÔÚJFreeChartÖбýͼ¡¢Öù״ͼ ......
£¨Ò»£©°üº¬ÆäËûÒ³ÃæµÄ·½·¨£º
includeÖ¸Á<%@ include file = "test1.jsp" %>
¾²Ì¬°üº¬£¬¿ÉÒÔ°üº¬ÈÎÒâ¸ñʽµÄÎļþ£¨²»¹âÊÇjspÎļþ£¬»¹¿ÉÒÔÊÇtxtµÈÎı¾Îļþ£©£¬¾²Ì¬°üº¬¾ÍÊǽ«±»°üº¬ÎļþµÄÄÚÈÝ¿½±´µ½°üº¬ÎļþÖУ¬½øÐÐÖ´ÐС£µ±Ç°Ò³ÃæºÍtest1.jspÖв»ÄÜÓÐÖØÃûµÄ±äÁ¿¡£
include¶¯×÷ <jsp:include page = "tes ......
Ðí¾ÃûÓеǼ×Ô¼ºµÄУÄÚÍøÁË£¬½ñÌìµÇ¼ÁËһϣ¬ºöÈ»·¢ÏÖУÄÚµÄÉÏ´«ÕÕƬͦÓÐÒâ˼µÄ£¬ÓÚÊǺõ¾Í´ÓÍøÉÏÕÒÁËһϣ¬Ð£ÄÚÓ¦¸ÃÊÇʹÓÃjspдµÄ¡£ÔÚÍøÉÏÕÒµ½Á˸öFileUpload¿Ø¼þ£¬¿ÉÒԺܷ½±ãµÄÉÏ´«Îļþ¡£ÔÚÍøÉÏÕÒµ½Ò»ÆªÏêϸ½éÉÜÕâ¸ö¿Ø¼þʹÓõģ¬ÊÔÑéÁËһϣ¬¸ãÁ˺þòÅʵÏÖÏÖÔÚÕûÀí³öÀ´¡£
Ò»¡¢Ê× ......
get
jsp url ${param.serialID}
action jsp String commentId = ServletActionContext.getRequest().getParameter("commentId");
-- ......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<tiles-definitions>
<definition name="tscs.templet" path="/pa ......