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

JSPÖÐerrorPageµÄÎÊÌâ

           µ±ÔÚJSPµÄpageÖ¸ÁîÖÐÉèÖÃerrorPage="url"¾Í¿ÉÒÔÉèÖô¦ÀíÒ쳣ʼþµÄJSPÎļþ¡£Èç¿ÉÒÔÕâÑùд£º
                <%@ page errorPage="error.jsp" %>
           ÕâÑùµÄ»°£¬µ±Ò³ÃæÖгöÏÖÒì³£µÄʱºò£¬¾Í»á×Ô¶¯Ìø×ªµ½´íÎó´¦ÀíÒ³Ãæ¡£µ«ÊÇҪעÒ⣬
           Ö»Óе±Õý³£´ò¿ªÒ³Ã棬ȻºóÔÚÒ³ÃæÖгöÏÖÒì³£µÄʱºò²Å»áÌø×ªµ½´íÎó´¦ÀíÒ³Ãæ£¬Èç¹ûÒ³Ãæ±¾ÉíÓÐÓï·¨´íÎó¶ø³öÏÖÁ˱àÒë´íÎó£¬ÊDz»»áÌø×ªµÄ£¡
           Àý£ºindex.jsp
<%@ page contentType="text/html; charset=GB2312" language="java" errorPage="error.jsp"%>
<html><head><title>lifecycle</title></head><body>
<%!
private int initVar = 0;
private int serviceVar = 0;
private int destroyVar = 0;
public void jspInit() { initVar ++; }
public void jspDestroy() { destroyVar ++; }
%>
<%
serviceVar ++;
String content1="³õʼ»¯´ÎÊý£º" + initVar;
String content2="ÏìÓ¦¿Í»§ÇëÇó´ÎÊý£º" + serviceVar;
String content3="Ïú»Ù´ÎÊý£º" + destroyVar;
out.println("<h1>hahaha</h1>");
               if(serviceVar==5){
                    String info = getServletInfo();
                    throw new Exception("Exception in:" + info);
               }
%>
<h1><%=content1%></h1><h1><%=content2%></h1><h1><%=content3%></h1>
<!--this is some funny words.-->
</body></html>
ÏÂÃæµÄÊÇerror.jsp
<%@ page contentType="text/html; charset=GB2312" language="java" isErrorPage="true"%>
<html><head><title>error</title></head><body>
this is the error page.
</body></html>


Ïà¹ØÎĵµ£º

jsp¶Ë¿Ú¼ì²âÒÔ¼°ÓòÃû¼ì²â

<tr>
<td height="30" align="right">ÓòÃû£º</td>
<td align="left"><input name="domain" type="text" class="input" value="<%=request.getServerName()%>"/></td>
<td align="left">ϵͳÒѾ­¼ì²â³öÄúµÄÓòÃû£¬ÇëÎð¸Ä¶¯</td>
</t ......

jspѧϰ


 <c:if>ÓÃÓÚ
Á÷³Ì¿ØÖÆ
  
Óï·¨
1:
<c:if
test=”testCondition” var=”varName”
[scope=”page|request|session|application”]/>
  Óï·¨
2:
  <c:if
test=”testCondition” var=”varName”
[scope=&rdquo ......

webʵÑ鱨¸æ——±íµ¥ÓëJSPÄÚÖöÔÏó

Ò»¡¢ÊµÑéÄ¿µÄ
1¡¢ ÕÆÎÕ±íµ¥µÄʹÓ÷½·¨£¬ÒÔ¼°·þÎñÆ÷¶Ë´¦Àí±íµ¥ÇëÇóµÄ·½·¨£»
2¡¢ Àí½âForwardµÄ×÷Óã»
3¡¢ ÊìÁ·ÔËÓÃJSPµÄµäÐÍÄÚÖöÔÏó
 
¶þ¡¢ÊµÑéÄÚÈݼ°²½Öè
1¡¢±íµ¥µÄʹÓü°ÆäµÝ½»¡¢´¦Àí¹ý³Ì
ÔÚÔ­´´½ÌÎñϵͳÖУ¬ÏµÍ³»á¸ù¾ÝÓû§ÀàÐÍ(½Ìʦ/ѧÉú)ÏÔʾ²»Í¬µÄÒ³Ãæ¡£ÎªÄ£Äâ¸Ã¹¦ÄÜ£¬ÐèÒª¶¨ÒåÉè¼ÆÈçÏÂҳà ......

Jsp apache common fileupload ÎļþÉÏ´« ÂÒÂë

ÔÚactionÀïʹÓÃfileuploadʱ£¬´ÓreqeustµÃµ½µÄÖÐÎÄÊý¾ÝΪÂÒÂ룬³¢ÊÔʹÓÃÁË
Java´úÂë
1.   DiskFileItemFactory factory = new DiskFileItemFactory();  
    ServletFileUpload upload = new ServletFileUpload(factory);  
    upload.setHeaderEnco ......

jspÖÐÈ¡µÃ·þÎñÆ÷ʱ¼ä²¢¶¯Ì¬ÏÔʾ


<%
      Calendar rightNow = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String sysdate = format.format(rightNow.getTime());
int week = rightNow.get(rightNow.DAY_OF_WEEK);
String weekar ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ