是不是你的bean的位置没指定正确,或是BEAN的问题。
解决方案 »
- 在myeclipse中java project如何部署进入tomcat
- session.setAttribute为对象时怎么打印
- java se基础问题,请教高手解释一下
- 用js如何获取某段时间内的所有的天呢?
- 数据库连接池的问题,请高手解答~
- Enumeration 问题
- 帮忙给个正则表达式
- 在jsp页面中嵌套一个applet,运行后,出错"class loginapp.Applet2 not found"
- 如何实现JAVASCRIPT与JSP通信
- 救命:tomcat4.04下配置连接池,连接sql server2000出现问题!!!在线等待!
- 一个奇怪的问题???????????JSP的
- 关于数据库中的数据显示问题?
class CaBean{
....
public void InsertCategory(String code,String name) throws SQLException{
//String strCode = request.getParameter("CategortyCode");
//String strName = request.getParameter("CategoryName");
String strCode = code;
String strName = name;
PreparedStatement pstmt=null;
if (conn == null || conn.isClosed())
{
conn=connectionPool.getConnection();
} strSql = "INSERT INTO Category(CategoryCode,CategoryName) VALUES(?,?)";
pstmt = conn.prepareStatement(strSql);
pstmt.setString(1,strCode);
pstmt.setString(2,strName);
pstmt.executeQuery() ;
CategoryTable group = new CategoryTable(strCode,strName);
vecRset.add(group);
pstmt.close() ;
connectionPool.close(conn);
}
....
}
JSP中的要从本页输入从本页提交;
...
<%@page import="net.corp2b.fortress.apps.system.utils.beans.CaBean"%>
<jsp:useBean id="caBean" scope="session" class="net.corp2b.fortress.apps.system.utils.beans.CaBean "/>
<%
String strCode= request.getParameter("CateogryCode");
String strName=request.getParameter("CategoryName");
if(strCode!=null||strName!=null)
caBean.InsertCategory(strCode,strName);
else{
%>
<html>
<head>
....
<input type="text" name="CategoryCode" size="10" value="">
<input type="text" name="CategoryName" size="60" value="">