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();
%>
Ïà¹ØÎĵµ£º
index.jsp:
<html>
<head>
<title>The News</title>
</head>
<body>
<h1> Latest News</h1>
<table>
<tr>
<td><h3><%@include file="items/news1.jsp" %></h3></td>
</tr>
<tr>
<td> ......
½â¾ö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 ......
member.jsp //sessionÏÞÖÆ·ÃÎÊÒ³
<%
String url = ""
if(session.getAttribute("username")==null)
{
url = myRedirect.dealurl(request);//¼Ç¼µ±Ç°µØÖ·ºÍÇëÇó²ÎÊý£¬dealurl½«Êµ¼Êurl´¦ÀíÁ˱ÜÃâºÍÒªÇëÇóurlÓиÉÈÅ,ÒòΪ»áÓÐ& ×Ö·û
......
ÄÇôÏÖÔÚ¿ªÊ¼ÎÒÃǵÄjspºÍÊý¾Ý¿âÖ®Âðɡ£
Ò»¡¢jspÁ¬½ÓOracle8/8i/9iÊý¾Ý¿â£¨ÓÃthinģʽ£©
testoracle.jspÈçÏ£º
<%@ page contentType=\"text/html;charset=gb2312\"%>
<%@ page import=\"java.sql.*\"%>
<html>
<body>
<%Class.forName(\"oracle.jdbc.driver.Oracl ......
this.state="01";ͨ³£µÄ×ö·¨ÊÇдһ¸öÀࣨ½Ó¿Ú£©À´´æ·Å³£Á¿
public interface MyConstant
{
public static final String STATE_01= "01";
}
È»ºóÔÚ³ÌÐòÖÐÕâÑùд¾Í¿ÉÒÔÁË
this.state=MyConstant.STATE_01;
ÔÚJava³ÌÐòÖÐÕâÑù¾Í¿ÉÒÔ±ÜÃâÓ²±àÂëÁË¡£¿ÉÊÇJSPÖÐÄØ£¿µ±È»£¬Èç¹ûJSPÖÐÔÊÐíʹÓÃScripletµÄ»°µ±È»Ò²¿ÉÒÔÖ±½ÓʹÓó ......