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¶ËµÄjava´úÂëÔõô±àÒ룬ÉèÖöϵ㶼²»»áÔڶϵ㴦ͣÁô¡£°Ù˼²»µÃÆä½â£¬ÔÚͬʵİïÖúÏ£¬·¢ÏÖÊÇ´úÂë×¢ÊÍÓÐÎÊÌâ¡£
Ô´úÂ룺
<!-- <jsp:forward page="/hello/Welcome.do"/> - ......
½«²ÎÊýд³É 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µÄpageÖ¸ÁîÖÐÉèÖÃerrorPage="url"¾Í¿ÉÒÔÉèÖô¦ÀíÒ쳣ʼþµÄJSPÎļþ¡£Èç¿ÉÒÔÕâÑùд£º
<%@ page errorPage="error.jsp" %>
ÕâÑùµÄ»°£¬µ±Ò³ÃæÖгöÏÖÒì³£µÄÊ ......
Ê×ÏÈÉêÃ÷£ºÕâ¸öÊÇÎÒ×ªÔØµÄ£¬ÖÂÁ¦ÓÚΪÏñÎÒÒ»ÑùµÄÐÂÊÖÌṩ°ïÖú£¡
1¡¢IISÏÂ301ÉèÖà InternetÐÅÏ¢·þÎñ¹ÜÀíÆ÷ -> ÐéÄâĿ¼ -> ÖØ¶¨Ïòµ½URL£¬ÊäÈëÐèҪתÏòµÄÄ¿±êURL£¬²¢Ñ¡Ôñ“×ÊÔ´µÄÓÀ¾ÃÖØ¶¨Ïò”¡£
2¡¢ASPϵÄ301תÏò´úÂë
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanent ......
1£®
×î»ù±¾µÄÂÒÂëÎÊÌâ¡£
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãÐÂÊÖ»á³öÏÖ¡£¾ÍÊÇ
Ò³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
<%@ page
language="java" pageEncoding="UTF-8"%>
<%@ page
contentType="text/html;charset=iso8859-1"%>
<html>
<head>
<title> ......