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

5ÔÂ19ÈÕ JSP»ù´¡

1.essionÄڵĴæ·ÅµÄÊǶÔÏóµÄÒýÓÃ,ËùÒÔÐÞ¸ÄÄÚÖöÔÏóºó,²»ÐèÒªÖØÐ·ÅÖõ½sessionÖÐ
2.ÅäÖÃContext³õʼ»¯²ÎÊý
<Context-param>
<param-name></paran-name>
<param-value></param-value>
<Context-param>
this.getServletContext().getInitParameter(arg0);
-----------------------------------------------------------------------------------------------------------------
3.ÅäÖÃservlet³õʼ»¯²ÎÊý
<init-param>
   <param-name></param-name>
   <param-value></param-value>
</inti-param>
ServletConfig config=this.getServletConfig();
config.getParameter(""); 
-----------------------------------------------------------------------------------------------------------------
4ÅäÖÃÎļþ properties
¸ñʽ: key=value  ÆäÖÐkey²»±ä valueÊDZ仯µÄ
ÀýÈç: #ÆäÖÐ"#"ΪעÊÍ
   Îļþ db.properties
    username=ÇØÑæÅà
    password=peiaihua 
×îºÃ·ÅÖõ½/WEB-INF/db.properties  
 ¶ÁÈ¡ÊôÐÔÎļþµÄÐÅÏ¢:
 /ÔÚwebÓ¦ÓÃÖÐ,getServletContext().getRealPath±íʾµÄ
 ÊÇweb¹¤³ÌµÄ¸ù·¾¶,
 Èç:"C:\Program Files\apache-tomcat-6.0.18\webapps\TestURL"
 
 String path=this.getServletContext().getRealPath("");
 FileImputSream fi=new FileInputStream(path);
 Properties pro=new Properties();
 pro.load(fi);
 pro.getProperty("key");
 
 String realPath=this.getServletContext().getResourceAsStream("/WEB-INF/db.properties")
 ±íʾµÄÒ²ÊÇ´Ó¸ù·¾¶¿ªÊ¼¼ÓÔØÎļþ:
 -----------------------------------------------------------------------------------------------------------------
 <!--  ¸Ã±êÇ©±íʾ·þÎñÆ÷Æô¶¯Ê±,×Ô¶¯´´½¨servlet¶ÔÏó,¶øÇÒÊý×ÖÔ½ÏÈÓÅÏȼ¶Ô½¸ß-->
 <Load-on-startup>0,1,2,3,....</Load-on-srartup>
 -----------------------------------------------------------------------------------------------------------------
 servletͨÐÅ(communicate):
  ·¾¶ÉèÖÃ:
&n


Ïà¹ØÎĵµ£º

JSP×¢ÊÍ

½ñÌìÔÚµ÷ÊÔ´úÂëʱ£¬·¢ÏÖÒ»¶ÎдÔÚjsp¶ËµÄjava´úÂëÔõô±àÒ룬ÉèÖöϵ㶼²»»áÔڶϵ㴦ͣÁô¡£°Ù˼²»µÃÆä½â£¬ÔÚͬʵİïÖúÏ£¬·¢ÏÖÊÇ´úÂë×¢ÊÍÓÐÎÊÌâ¡£
      Ô­´úÂ룺
            <!-- <jsp:forward page="/hello/Welcome.do"/> - ......

JSP URLÖÐÎÄ´«²Î

 ½«²ÎÊýд³É java.net.URLEncoder.encode(sContent,"gb2312")ºóÔÙ´«µÝ¡£
±ÈÈçurlÊÇ"/accept.do?content=<%=java.net.URLEncoder.encode(sContent,"UTF-8")%>";
¶Áȡʱ£¬Ê¹ÓÃ
String sc =  new String(request.getParameter("content").getBytes("iso-8859-1"),"UTF-8"); ......

JSPÖÐerrorPageµÄÎÊÌâ

           µ±ÔÚJSPµÄpageÖ¸ÁîÖÐÉèÖÃerrorPage="url"¾Í¿ÉÒÔÉèÖô¦ÀíÒ쳣ʼþµÄJSPÎļþ¡£Èç¿ÉÒÔÕâÑùд£º
                <%@ page errorPage="error.jsp" %>
           ÕâÑùµÄ»°£¬µ±Ò³ÃæÖгöÏÖÒì³£µÄÊ ......

301ÖØ¶¨ÏòÉèÖü°³ÌÐò´úÂëʵÏÖÈ«¼¯(ASP|.NET|PHP|JSP)

Ê×ÏÈÉêÃ÷£ºÕâ¸öÊÇÎÒ×ªÔØµÄ£¬ÖÂÁ¦ÓÚΪÏñÎÒÒ»ÑùµÄÐÂÊÖÌṩ°ïÖú£¡
1¡¢IISÏÂ301ÉèÖà InternetÐÅÏ¢·þÎñ¹ÜÀíÆ÷ -> ÐéÄâĿ¼ -> ÖØ¶¨Ïòµ½URL£¬ÊäÈëÐèҪתÏòµÄÄ¿±êURL£¬²¢Ñ¡Ôñ“×ÊÔ´µÄÓÀ¾ÃÖØ¶¨Ïò”¡£
2¡¢ASPϵÄ301תÏò´úÂë
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanent ......

Jsp /jsÂÒÂëÎÊÌâ


1£®
×î»ù±¾µÄÂÒÂëÎÊÌâ¡£
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãÐÂÊÖ»á³öÏÖ¡£¾ÍÊÇ
Ò³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
<%@ page
language="java" pageEncoding="UTF-8"%>
<%@ page
contentType="text/html;charset=iso8859-1"%>
<html>
<head>
<title> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ