The value for the useBean class attribute dbBean.DBBean is invalid
来源:百度知道 编辑:UC知道 时间:2024/06/15 11:59:07
出现的错误是:org.apache.jasper.JasperException: /bookstore/verify.jsp(2,0) The value for the useBean class attribute dbBean.DBBean is invalid.
verify.jsp的代码是:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="conn" class="dbBean.DBBean" scope="session"/>
<jsp:setProperty name="conn" property="connStr" value="jdbc:odbc:bookstore"/>
<%
request.setCharacterEncoding("gb2312");
session.setMaxInactiveInterval(-1);
String user=request.getParameter("user");
String pw=request.getParameter("pw");
String sql="select * from user where name='"+user+"' and password='"+pw+"'";
ResultSet rs=conn.executeQuery(sql);
if(rs.next())
{
session.setAttribute("rank",rs.getString("rank"));
session.setA
verify.jsp的代码是:
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="conn" class="dbBean.DBBean" scope="session"/>
<jsp:setProperty name="conn" property="connStr" value="jdbc:odbc:bookstore"/>
<%
request.setCharacterEncoding("gb2312");
session.setMaxInactiveInterval(-1);
String user=request.getParameter("user");
String pw=request.getParameter("pw");
String sql="select * from user where name='"+user+"' and password='"+pw+"'";
ResultSet rs=conn.executeQuery(sql);
if(rs.next())
{
session.setAttribute("rank",rs.getString("rank"));
session.setA
<jsp:setProperty name="conn" property="connStr" value="jdbc:odbc:bookstore"/>
你这句 是调用的 javabean里面的 get##()方法 和 set##() 方法 来对表单的接收 这里的get##()方法 和 set##() 方法 是和页面中表单对应的,
你写的那几个 是对数据库连接用的 。
而你的javabean 里没有接收表单的get##()方法 和 set##() 方法, 是不是忘记写了?
他说
The value for the useBean class attribute dbBean.DBBean is invalid(无效)
我想是这个原因。
-------------------
你写的 这是设置数据库的 不是用来 你设置表单的。
好比:
<input type="text" name="name">
这样的是没法给他设置 和获取他内容的值的。
必须写上
setName(String name){
this.name = name;
}
public String getName(){
return name;
}
请问大哥您问的是什么问题
For Mexico and Venezuela the value of
The value for the useBean class attribute bean.StudentBean is invalid
can’t see the wood for the trees
THE VALUE OF FRIENDS
The Value of Time
people don't realize the value of health until they lose it
jsp:useBean id="sqlBean"错误 The value for the useBean class attribute sql is invalid
麻烦翻译:20 tons net inside for the fines and 20.54 t for the coarse.
I can`t bear to wait for the bus.是什么意思??
You haven’t got the face for it. 是什么意思阿?