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
Ïà¹ØÎĵµ£º
½«²ÎÊýд³É 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Ò³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.JSP)¾Í³öÏÖÂÒÂ룺
¶Ô²»Í¬µÄWEB·þÎñÆ÷ºÍ²»Í¬µÄJDK°æ±¾£¬´¦Àí½á¹û¾Í²»Ò»Ñù¡£ÔÒò£º·þÎñÆ÷ʹÓõıàÂ뷽ʽ²»Í¬ºÍä¯ÀÀÆ÷¶Ô²»Í¬µÄ×Ö·ûÏÔʾ½á¹û²»Í¬¶øµ¼Öµġ£½â¾ö°ì·¨£ºÔÚJSPÒ³ÃæÖÐÖ¸¶¨±àÂë·½Ê ......
ÔÚactionÀïʹÓÃfileuploadʱ£¬´ÓreqeustµÃµ½µÄÖÐÎÄÊý¾ÝΪÂÒÂ룬³¢ÊÔʹÓÃÁË
Java´úÂë
1. DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEnco ......
context.xml Îļþ¼ÐÖÐ
<Context path="/wap"
docBase="D:\IDE\MyEclipse\wap\WebRoot" reloadable="false" >
request.getContextPath(); -==> /wap
this.getServletContext().getRealPath("") ;// D:\IDE\MyEclipse\wap\WebRoot
......
Ê×ÏÈÉêÃ÷£ºÕâ¸öÊÇÎÒתÔصģ¬ÖÂÁ¦ÓÚΪÏñÎÒÒ»ÑùµÄÐÂÊÖÌṩ°ïÖú£¡
1¡¢IISÏÂ301ÉèÖà InternetÐÅÏ¢·þÎñ¹ÜÀíÆ÷ -> ÐéÄâĿ¼ -> Öض¨Ïòµ½URL£¬ÊäÈëÐèҪתÏòµÄÄ¿±êURL£¬²¢Ñ¡Ôñ“×ÊÔ´µÄÓÀ¾ÃÖض¨Ïò”¡£
2¡¢ASPϵÄ301תÏò´úÂë
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanent ......