关于servlet中类的调用
小弟是初学者,写了一个登陆程序,不知道怎么回事,在servlet里面直接调用自己写的一个类(UserBean),但是调用UserBean中的方法之后程序就不能继续运行了,在Eclipse中编写,没有报错。当我把servlet中所有有关UserBean的内容注释掉后能运行。请大家帮我看看我代码有没有写错,谢谢啦!从表单接收userId和password
import
java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import
javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)throws
ServletException,
IOException {
try{
PrintWriter out=response.getWriter();
String userId=request.getParameter( "userId ");
String password=request.getParameter( "password ");
UserBean userBean=new UserBean();
if(userBean.login(userId,password))
out.print( "success ");
else
out.print( "failure ");
&