struts2?变量都有set、get方法吗。能不能说明点/

解决方案 »

  1.   

    前:
    <input type="text" id="userid" name="userid"  value="1">action:
    public String demo() throws Exception {
    String id=request.getParameter("id");
    Map map = new HashMap();
    User  user= new User();
    docDto.setid(id);
    System.out.println(id);//这块有值。但是只有id有
    map.put("user", user);
    }我现在想在另一个前台页面,通过map,${user.name}拿到值。初始化setget的包我就不写了
      

  2.   

    前:
    <input type="text" id="userid" name="userid"  value="1">action:
    public String demo() throws Exception {
    String id=request.getParameter("id");
    Map map = new HashMap();
    User  user= new User();
    docDto.setid(id);
    System.out.println(id);//这块有值。但是只有id有
    map.put("user", user);
    }我现在想在另一个前台页面,通过map,${user.name}拿到值。
      

  3.   

    前:
    <input type="text" id="userid" name="userid"  value="1">action:
    public String demo() throws Exception {
    String id=request.getParameter("id");
    Map map = new HashMap();
    User  user= new User();
    docDto.setid(id);
    System.out.println(id);//这块有值。但是只有id有
    map.put("user", user);
    }我现在想在另一个前台页面,通过map,${user.name}拿到值。
      

  4.   

    前:
    <input type="text" id="id" name="id"  value="1">action:
    public String demo() throws Exception {
    String id=request.getParameter("id");
    Map map = new HashMap();
    User  user= new User();
    docDto.setid(id);
    System.out.println(id);//这块有值。但是只有id有
    map.put("user", user);
    }我现在想在另一个前台页面,通过map,${user.name}拿到值。上面id写错了,我更正下,是这样的。具体接下来怎么取值?
      

  5.   

    private User user;
    get set省略 public User find(String id)
    throws Exception {
    String sql ="select * from  user where id='"+user.getPid()+"'";
    this.findBySql(sql);
    return user;
    }
    谁能给我改一下
      

  6.   

    前:
    <input type="text" id="userid" name="userid"  value="1">action:
    public String demo() throws Exception {
    String id=request.getParameter("id");
    Map map = new HashMap();
    User  user= new User();
    docDto.setid(id);
    System.out.println(id);//这块有值。但是只有id有
    map.put("user", user);
    }我现在想在另一个前台页面,通过map,${user.name}拿到值。这样的话,你那个user可以通过id到数据库查出来,然后传到前台,而不用set就行
      

  7.   

    只setid当然只有id的值了,“其他值”可以通过set完成,也可以通过ORM完成,看业务需要了。
    PS:需要好好学习下了。
      

  8.   

     你前台只传回来一个id 你还想要什么东西··
    你前台那个页面有其他的东西吗?
    如果只给的到id的话就通过id从数据库查出来对应的记录
      

  9.   

    String id=request.getParameter("id");
    user = userService.selectUserInfo(id);
    user可以get你所有需要的字段值。selectUserInfo 方法获取 表对象。详情要看你的底层是怎么写的了