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"); ......
tomcat ĬÈÏʹÓõÄ×Ö·û¼¯ÊÇISO-8859-1£¬²»Ö§³ÖÖÐÎÄ×Ö·û£¬ËùÒÔÔÚÏÖʵÖÐÎÄʱÐèҪת»»×Ö·ûºÍÉèÖÃ×Ö·û¼¯¡£
server.mxl¸ÄΪ<Connector port="8080" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> £¬Ìí¼Ó´úÂëת»»×Ö·ûString.getBytes("ISO-8859-1"),"UTF-8 ......
ÖÕÓڸ㶨JSPÁ¬½ÓSQL Server 2000Êý¾Ý¿âµÄÎÊÌâÁË
2008Äê01ÔÂ29ÈÕ ÐÇÆÚ¶þ 15:54
ǰ¼¸Ì죬ƽƽͬѧһֱÔÚ¸ãJSP Á¬½ÓSQL Server 2000Êý¾Ý¿âµÄÎÊÌ⣬һֱÁ¬²»ÉÏ£¬È»ºó½ÐÎÒÈ¥°ïËû¿´¿´£¬Æ¾×ÅÒÔǰµÄ¾Ñ飬¸ãÁËÒ»¸öÏÂÎ磬ºÙºÙ£¡ÖÕÓÚ°ïËûÁ¬½ÓÉÏÁË£¬Ö÷Òª²½ÖèÈçÏ£º
1¡¢ÐèÒªµÄ¶«Î÷´ó¼Ò¿ÉÒÔµ½Î ......
±àд×Ô¶¨Òå±êÇ©²½Öè
±àд±êÇ©´¦ÀíÆ÷£¨´¦Àí±êÇ©µÄJavaÀࣩ£¬ÕâЩÀàÐèҪʵÏÖһЩ¹æ·¶»¯µÄ±êÇ©½Ó¿Ú
±àд±êÇ©¿âÃèÊöÎļþ£¨TLD£©£¬Õâ¸öÎļþÃèÊöÁËÿ¸ö±êÇ©ºÍ¶ÔÓ¦µÄJava±êÇ©´¦ÀíÆ÷ÀàÖ®¼äµÄÓ³Éä¹ØÏµ
ÔÚweb.xmlÖÐÅäÖñêÇ©¿âÎļþµÄURI
ÔÚJSPÒ³ÃæÖÐÀûÓÃtaglibÖ¸Á±êÇ©¿âÒýÈëµ½Ò³ÃæÖÐ
......