JSPÖÐÀûÓÃÊý¾ÝÔ´¶ÔÏó½¨Á¢Êý¾Ý¿âÁ¬½Ó
ÅäÖóÌÐòµÄÔËÐÐĿ¼ÓëJDBCÊý¾ÝÔ´:
<Context path="/test" docBase="F:\JSPLesson\test" reloadable="true">
<Resource name="jdbc/bookstore" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="root" password="123456"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/bookstore?autoReconnect=true"/>
</Context>
JSPÖÐͨ¹ýÈçÏ·½Ê½µÃµ½Êý¾Ý¿âÁ¬½Ó:
<%
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/bookstore");
Connection conn = ds.getConnection();
%>
Ïà¹ØÎĵµ£º
1. RequestDispatcher.forward()
ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´«µÝHTTPÇëÇó´Óµ±Ç°µÄServlet or JSPµ½ÁíÍâÒ»¸öServlet,JSP »òÆÕͨHTMLÎļþ,Ò²¼´ÄãµÄformÌá½»ÖÁa.jsp,ÔÚa.jspÓõ½ÁËforward()ÖØ¶¨ÏòÖÁb.jsp,´ËʱformÌá½»µÄËùÓÐÐÅÏ¢ÔÚ b.jsp¶¼¿ÉÒÔ»ñµÃ,²ÎÊý×Ô¶¯´«µÝ. µ«fo ......
½â¾öjsp»òserverlet ²»ÄܽâÎömultipart/form-data ÀàÐÍµÄ±íµ¥ÓòµÄÎÊÌâ
10 6ÔÂ 2008
Situation:
Javax.servlet.HttpServletRequest.getParameter(String) returns null when the ContentType is multipart/form-data
Solutions:
Solution A:
1. download http://www.servlets.com/cos/index.html
2. invoke getPara ......
Web.xml³£ÓÃÔªËØ
<web-app>
<display-name></display-name>¶¨ÒåÁËWEBÓ¦ÓõÄÃû×Ö
<description></description> ÉùÃ÷WEBÓ¦ÓõÄÃèÊöÐÅÏ¢
<context-param></context-param> context-paramÔªËØÉùÃ÷Ó¦Ó÷¶Î§Äڵijõʼ»¯²ÎÊý¡£
<filter></filter> ¹ýÂËÆ÷ÔªËØ½«Ò»¸ ......
ÓÉÓÚϵͳÐèÇó£¬×î½üÔÚ¿ª·¢¹ý³ÌÖн«ÏµÍ³´ÓÔÀ´µÄMySQL×ªÒÆµ½SQL
2000Ï£¬ÆäÖÐÓöµ½ÁËÖî¶àÎÊÌ⣬»¨·ÑÁËÎÒ²»ÉÙʱ¼ä¡£ÏÖÔÚ°ÑÎҵľÑéÄóöÀ´¸æËß´ó¼Ò£¬ºÃÈôó¼ÒÉÙ×ßÍä·£¬½ÚԼʱ¼ä¡£
¡¡¡¡Ê×ÏÈÊÇSQL
2000Êý¾Ý¿âµÄ°²×°ÎÊÌ⣬ÔÚ´ËÎÒÖ÷Òª½²Ð©¹ØÓÚSQL 2000µÄ°æ±¾Óë²Ù×÷ϵͳµÄ¼æÈÝÐÔÎÊÌ⣺SQL
2000×ܹ²ÓÐ7¸ö²»Í¬°æ±¾£¬ÊÊ ......
this.state="01";ͨ³£µÄ×ö·¨ÊÇдһ¸öÀࣨ½Ó¿Ú£©À´´æ·Å³£Á¿
public interface MyConstant
{
public static final String STATE_01= "01";
}
È»ºóÔÚ³ÌÐòÖÐÕâÑùд¾Í¿ÉÒÔÁË
this.state=MyConstant.STATE_01;
ÔÚJava³ÌÐòÖÐÕâÑù¾Í¿ÉÒÔ±ÜÃâÓ²±àÂëÁË¡£¿ÉÊÇJSPÖÐÄØ£¿µ±È»£¬Èç¹ûJSPÖÐÔÊÐíʹÓÃScripletµÄ»°µ±È»Ò²¿ÉÒÔÖ±½ÓʹÓó ......