请你检查 /login.jsp ;其中你用了userBean 可能写错了东西;不然把代码发上来才能研究

解决方案 »

  1.   

    java文件
    package com.chapter2;public class Login
    {
    public String userName;
    public String password;
    public Login()
    {
    this.userName=null;
    this.password=null;
    }
    public void setUserName(String s)
    {
    this.userName = s;
    }
    public String getUserName()
    {
    return this.userName;
    }
    public void setPassword(String s)
    {
    this.password = s;
    }
    public String getPassword()
    {
    return this.password;
    }
    }JSP 文件
    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <jsp:useBean id="login" class="com.chapter2.Login" scope="page"/>
    <jsp:setProperty name="login" property="userName" param="userName"/>
    <jsp:setProperty name="login" property="password" param="password"/>
    <!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>javabean</title>
    </head><body>
    <div align="center">
    <h2>用户登陆信息如下:</h2>
    <p>用户名:<font color="#0099CC"><%=login.getUserName()%></font></p>
    <p>密码:<font color="#0099CC"><%=login.getPassword()%></font></p>
    </div>
    </body>
    </html>