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

jspÖÐincludeµÄÁ½ÖÖÐÎʽ

jspÖÐincludeµÄÁ½ÖÖÐÎʽ:      1.<%@ include file=” ”%>
                                            2.<jsp:include page=” ” flush=”true”/>
¶þÕßÖ÷ÒªÓÐÁ½¸ö·½ÃæµÄ²»Í¬;
£¨1£©:Ö´ÐÐʱ¼äÉÏ:
      <%@ include file=”relativeURI”%>   ÊÇÔÚ·­Òë½×¶ÎÖ´ÐÐ
      <jsp:include page=”relativeURI” flush=”true” />   ÔÚÇëÇó´¦Àí½×¶ÎÖ´ÐÐ.
£¨2£©:ÒýÈëÄÚÈݵIJ»Í¬:
      <%@ include file=”relativeURI”%>   ÒýÈ뾲̬Îı¾(html,jsp),ÔÚJSPÒ³Ã汻ת»¯³Éservlet֮ǰºÍËüÈں͵½Ò»Æð.
      <jsp:include page=”relativeURI” flush=”true” />   ÒýÈëÖ´ÐÐÒ³Ãæ»òservletËùÉú³ÉµÄÓ¦´ðÎı¾.
Á½ÖÖÓ÷¨ÖÐfileºÍpageÊôÐÔ¶¼±»½âÊÍΪһ¸öÏà¶ÔµÄURI.Èç¹ûËüÒÔб¸Ü¿ªÍ·,ÄÇôËü¾ÍÊÇÒ»¸ö»·¾³Ïà¹ØµÄ·¾¶.½«¸ù¾Ý¸³¸øÓ¦ÓóÌÐòµÄURIµÄǰ׺½øÐнâÊÍ,Èç¹ûËü²»ÊÇÒÔб¸Ü¿ªÍ·,ÄÇô¾ÍÊÇÒ³ÃæÏà¹ØµÄ·¾¶,¾Í¸ù¾ÝÒýÈëÕâ¸öÎļþµÄÒ³ÃæËùÔڵķ¾¶½øÐнâÊÍ.
ÒÔÏÂÊÇʵ¼ÊÀý×ÓÀ´½âÊÍÒÔÉÏÄÚÈÝ£º
        //======date.jspµÄÔ´Îļþ=====//
        <%@ page language=”java” contentType="text/html;charset=gb2312"%>
        <%
        java.util.Date date=new java.util.Date();
        String date_cn ="";
        String dateStr = "";
        switch(date.getDay())
        {
              &nbs


Ïà¹ØÎĵµ£º

JSPÒ³Ãæ²ãµÄ¾­Ñ鱸Íü×ܽá

 1£º²éÕÒÒ³ÃæµÄ´úÂë´íÎóÓÌÈçÒ½Éú¸ø²¡ÈË¿´²¡£¬²»ÄÜͷʹҽͷ£¬½ÅÍ´Ò½½Å£¬¾ÍÊÇ˵һ¸öµØ·½µÄ“´íÎó”ÍùÍùÊÇÓɱðµÄµØ·½ÓÐÎÊÌâ¶øÒý·¢µÄ¡£
2£ºÈç¹ûÊý¾Ý·ÅÔÚrequestÖÐ(¿ÉÄÜ°üÀ¨url²ÎÊý)£¬ÄÇôҪÔÚºóÐøµÄÒ³Ãæ(»òÊÇˢкó)Öп´µ½ÒÔÇ°µÄÊý¾Ý¿ÉÒÔʹÓÃ${param.yourdate},²»¹ý·ÅÔÚActionFormÖпÉÄܸüºÃһЩ¡£
3£ºÔÚJSPÒ³ ......

ÔÚjspÖÐÖ±½ÓÊä³ö¶þ½øÖÆͼƬ


<%@ page info="Random Image Show"  
    pageEncoding="UTF-8" contentType="image/jpg"  
    autoFlush="true" buffer="16kb" session="false" import="java.io.FileInputStream"  
%>< ......

JSPµÄÄÚÖöÔÏó

À´Ô´ÓÚ¡¶Java¡¢javaEEÈí¼þ¹¤³Ìʦ¾ÍÒµÇóÖ°Êֲᡷ
1 HttpServletRequestÀàµÄrequest¶ÔÏ󣺴ú±íÇëÇó¶ÔÏó£¬Ö÷ÒªÓÃÓÚ½ÓÊÜ¿Í»§¶Ëͨ¹ýHTTPЭÒéÁ¬½Ó´«Êäµ½·þÎñÆ÷µÄÊý¾Ý¡£
2 HttpServletResponseÀàµÄresponse£º´ú±íÏìÓ¦¶ÔÏó£¬Ö÷ÒªÓÃÓÚÏò¿Í»§¶Ë·¢ËÍÊý¾Ý¡£
3 JspWriterÀàµÄout¶ÔÏó:Ö÷ÒªÓÃÓÚÏò¿Í»§¶ËÊä³öÊý¾Ý£¬OutµÄ»ùÀàÊÇJspWriter¡ ......

Ö´ÐÐJSPºóÉú³ÉHTML¾²Ì¬Îļþ

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.Servl ......

jspÒ³Ãæ»ñÈ¡Action±äÁ¿Öµ(²»Í¨¹ý±êÇ©)


¹Ø¼ü×Ö: struts2 webwork
½ñÌìÓöµ½Ò»¸öÇé¿ö,ÒªÔÚjspÒ³ÃæÉÏ´¦Àí²éѯ³öÀ´listÒ³µÄһЩÊý¾Ý,¸Ä±äActionÀàÌ«Âé·³,ÓÚÊÇÏëµ½´ÓÒ³ÃæÉÏÖ±½Ó»ñÈ¡ActionÖеıäÁ¿Öµ,²¢½øÐвÙ×÷,ÏÖÔÚ°Ñ»ñÈ¡·½·¨¼Ç¼һÏÂ,ÒÔ±ãÒÔºó²éѯ.
Èç¹ûÔÚActionÀàÀïÓÐÒ»¸ö¼òµ¥µÄ±äÁ¿,²¢ÇÒÒѾ­Ð´ºÃÁËËüµÄgetºÍset·½·¨
private String test="jsp  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ