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();
%>
Ïà¹ØÎĵµ£º
×¢ÊÍ
ÔÚ¿Í»§¶ËÏÔʾһ¸ö×¢ÊÍ.
JSP Óï·¨
<!-- comment [ <%= expression %> ] -->
Àý×Ó 1
<!-- This file displays the user login screen -->
ÔÚ¿Í»§¶ËµÄHTMLÔ´´úÂëÖвúÉúºÍÉÏÃæÒ»ÑùµÄÊý¾Ý£º
<!-- This file displays the user login screen -->
Àý×Ó 2
<!-- This page was lo ......
ÔÚ±àдJSP³ÌÐòʱ£¬³£³£»áÅöµ½ÖÐÎÄ×Ö·û´¦ÀíµÄÎÊÌ⣬ÔÚ½ÓÊÜrequestµÄÖÐÎÄ×Ö·ûʱÏÔʾ³öÀ´Ò»´®ÂÒÂë¡£ÍøÉÏ´¦Àí·½·¨Ò»Âá¿ð£¬ÏÂÃæ˵˵ÎÒÓùýµÄÁ½ÖÖÓÐЧµØ½â¾ö°ì·¨£º
1.Ϊ³ÌÐò±àдһ¸ö×Ö·û´®´¦Àíº¯Êý£¬ÓÃÒ»¸ö¾²Ì¬Îļþ±£´æ£¬ÔÚÐèÒª´¦ÀíÖÐÎÄ×Ö·ûµÄJSPÒ³ÃæÖаüº¬Ëü£¬
<%!
public String codeToString(String str)
{ ......
½â¾ö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 ......
jspÂÒÂëÎÊÌâ½â¾ö
1¡¢Ò»°ãµÄjspÒ³ÃæÏÔʾÂÒÂë
<%@ page contentType="text/html; charset=UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
2¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èç¹ûjspÌá½»Ó¢ÎÄ×Ö·ûÄÜÕýÈ·ÏÔʾ£¬¶øÌá½»ÖÐÎÄʱ¾Í»á³öÏÖÂÒÂë¡£
ÔÒò£ºä ......
Ò»¸öÏîÄ¿ÖлáÔÚ¶à¸öJSP½çÃæÖÐʹÓÃÏÂÀ¿ò£¬ÈÕÆڿؼþ£¬·ÖÒ³¿Ø¼þ¡£ÈôÄܽ«´ËÀà¿Ø¼þ³éÏó³öÀ´£¬×ö³ÉÒ»¸öJspTagµÄ»°£¬ÄÇʹÓÃÆðÀ´¾Í·½±ã¶àÁË¡£Í¬Ê±±ãÓÚJSPµÄÔĶÁ£¬¸üÖ÷ÒªµÄÊÇ·½±ãÁËÏîÄ¿µÄ¹ÜÀíÓëά»¤¡£
ÏÂÃæÒÔÐÐÒµÏÂÀ¿ò¿Ø¼þΪÀý½éÉÜ×Ô¶¨ÒåJspTag£¬ÓÈÆä×¢ÒâºìÉ«±ê×¢´¦£¬´Ó¶ÔÓ¦¹Øϵ¿ÉÒÔÕÒµ½ÔËÓùæÂÉ£º
Ê×ÏȽ¨Á¢/WEB-INF/tags/my-t ......