是说在.java文件中怎么写。不是JSP中哦。

解决方案 »

  1.   

    就是普通的类,不需要什么包
    只要有一个没有参数的构造函数,然后有setter和getter就好了
      

  2.   

    是这么写的啊 。编译不过也。
    pacakge ch02.bean;
    public class UserObject{
    private String userId;
    private String userName;
    private String sex;
    private int age;
    public UserObject(){
    super();
    }
    public UserObject(
    String userId,
    String userName,
    String sex,
    int age){
    this.userId=userId;
    this.userName=userName;
    this.sex=sex;
    this.age=age;
    }
    public int getAge(){
    return age;