javabean问题
最近做一个JSP的课程设计,在用到JAVABEAN时每次都会报错,找了书上的一些javabean的源代码都会报出同样的错误:type Exception reportmessage
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /webshopping/WebRoot/loginCheck.jsp (line: 9, column: 0) The value for the useBean class attribute com.wy.member.user is invalid.
程序源代码如下:
loginCheck.jsp:
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*,com.wy.member.*," %>
<HTML>
<HEAD>
<title>网上商品交易平台</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY>
<jsp:useBean id="user" scope="session" class="com.wy.member.user" />
<%
String userName=request.getParameter("txtloginName");
String userPassword=request.getParameter("txtpassword");
if (user.isValidUser(userName,userPassword))
{
%>
<center><font size="5" color="#FF0000"><b>登陆成功</b></font></center>
<br><br>
<center><input type="button" name="goback" value="返回" onClick="javascript:window.history.go(-1)"></center>
<%
}
else
{
%>
<center><font size="5" color="#FF0000"><b>登陆失败,请检查您的用户名和密码</b></font></center>
<br><br>
<center><input type="button" name="goback" value="返回" onClick="javascript:window.history.go(-1)"></center>
<%
}
%>
</BODY>
</HTML>
UserLogin.jsp:
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>网上商品交易平台</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function form1_onsubmit()
{
if (form1.txtloginName.value =="")
{
alert("请填写用户名!");
form1.txtloginName.focus();
return false;
}
if (form1.txtpassword.value =="")
{
alert("请填写密码!");
form1.txtpassword.focus();
return false;
}
}
function userRegister()
{
window.open("userRegister.jsp");
}
function getmypassword()
{
window.open("getPassword.jsp");
}
//-->
</SCRIPT>
</head>
<table border="0" width="100%" height="299">
<tr>
<td width="10%" height="183"></td>
<td width="80%" height="183" align=center valign="middle">
<form name=form1 method="post" target="_top" action="loginCheck.jsp" onSubmit="return form1_onsubmit()">
<div align="center">
<table width="346" height="68" border="0">
<tr>
<td width="100">
<font color="#000099" size="3" face="Arial, Helvetica, sans-serif"><strong>用户名:</strong></font>
</td>
<td width="155">
<input name="txtloginName" style="HEIGHT: 20px; WIDTH: 150px" size="50" maxlength="50">
</td>
<td width="77" valign="middle">
</td>
</tr>
<tr>
<td height="39">
<font color="#000099" size="3" face="Arial, Helvetica, sans-serif"><strong>密码:</strong></font>
</td>
<td>
<input name="txtpassword" style="HEIGHT: 20px; WIDTH: 150px" size="20" maxlength="20" type="password">
</td>
<td> </td>
</tr>
<tr>
<td>
<font color="#000099" size="3" face="Arial, Helvetica, sans-serif"><strong>用户类型:</strong></font>
</td>
<td colspan="2">
<select name="userType">
<option value="1" selected>普通用户</option>
<option value="2">商家</option>
<option value="0">管理员</option>
</select>
</td>
</tr>
</table>
<br>
<br>
<input type="submit" name="btnSubform" value="登录">
<input type="reset" name="reset" value="重填">
</div>
</form>
</td>
<td width="10%" height="183"></td>
</tr>
</table>
</html>
user.java:
package com.wy.member;
import com.wy.tool.*;
import java.sql.*;
import java.text.*;
public class user extends executeWay{
private int id;;
private String number;
private String password;
private String name;
private Integer age;
private String telphone;
private String email;
private String strSql;
public user(){
id=0;
number="";
password="";
name="";
age=1;
telphone="";
email="";
}
public boolean isValidUser(String number,String password){
strSql="select * from tb_member where number='"+number+"' and password='"+password+"'";
try{
ResultSet rs = super.exeSqlQuery(strSql);
if (rs.next()){
id=rs.getInt("id");
number=rs.getString("number");
password=rs.getString("password");
name=rs.getString("name");
age=rs.getInt("age");
telphone=rs.getString("telphone");
email=rs.getString("email");
return true;
}
else{
return false;
}
}
catch(Exception ex){
return false;
}
finally{
}
}
}
在Myeclipse里是没有错误的,但是在TOMCAT里一运行就出现错误,这是为什么呢?(路径应该没有问题,user类的.class文件也存在)
请JSP技术牛人帮忙看一下是什么原因。谢谢!
搜索更多相关主题的帖子:
java invalid 源代码 server
----------------解决方案--------------------------------------------------------