html:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="/loginWeb/houtai.jsp"> //action=/模块名/要提交的jsp名???
<table width="248" border="1">
<tr>
<td width="44">ming</td>
<td width="188"><label>
<input name="tname" type="text" id="tname" />
</label></td>
</tr>
<tr>
<td>ma</td>
<td><label>
<input name="tpwd" type="text" id="tpwd" />
</label></td>
</tr>
</table>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
</body>
</html>
java Bean1:
import java.sql.*;
public class sqlBean {
public sqlBean() {
}
Connection con;
//得到con
public Connection getCon() throws ClassNotFoundException,
IllegalAccessException, InstantiationException
{
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").
newInstance();
con = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://localhost:1433;databasename=werkers","sa", "");
} catch (Exception ex) {
ex.printStackTrace();
}
return con;
}
}
java Bean2:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*" %>
<jsp:useBean id="bean0" scope="session" class="sqlBean" />
<%
Connection conn;
Statement stm;
ResulSet rs;
String name=request.getParameter("tname");
String pwd =request.getParameter("tpwd");
conn=bean0.getCon();
stm=conn.createStatement();
stm.executeUpdate("insert into employee(name,password)values('"+name+"','"+pwd+"')");
stm.close();
conn.close();
%>
java Bean2 make出错:
"houtai.jsp": cannot find symbol; symbol : class sqlBean, location: class org.apache.jsp.houtai_jsp
"houtai.jsp": cannot find symbol; symbol : class sqlBean, location: class org.apache.jsp.houtai_jsp
"houtai.jsp": cannot find symbol; symbol : class sqlBean, location: class org.apache.jsp.houtai_jsp
"houtai.jsp": cannot find symbol; symbol : class ResulSet, location: class org.apache.jsp.houtai_jsp
我用JBuider 2005作的 请各位老大指点一下 谢了