怎么样 让一个 手动输入进去的值 放入session中去  他按条件 分页的时候点了下一页 第二次会失去login.username的值,求解决或者放入session中

解决方案 »

  1.   

    如果用Session,就在Servlet中:String name = request.getParameter("login.username");
    if (name != null) {
      session.setAttribute("login.usename", name);
    } else {
      name = (String) session.getAttribute("login.usename");
    }
      

  2.   

    一般这样的问题不用放到session中你可以将login.username的值做为参数传递到下个页面啊
      

  3.   

    对的我传入的是Action 里面 第一次就是有值的  1楼的说法 没语法错误 但是 没用 不显示 单步 调试就报错
      

  4.   

    HttpSession session = ServletActionContext.getRequest().getSession();
    HttpServletRequest request = ServletActionContext.getRequest();  
            String usernamePaging = request.getParameter("login.username");
    if (usernamePaging != null) {
      session.setAttribute("login.usename", usernamePaging);
    } else {

            List<Login> lst=loginBizI.selectTypeusers(usernamePaging); session.setAttribute("login.usename", usernamePaging);
    这条单步就报错  usernamePaging 过来是有值
      

  5.   

    调试进去就出不来了  跳入那种class文件中了 下面的 都不运行了  对了  你的login.username下面的 重新赋值session还是 写错了
      

  6.   

    Class File Editor  Source not found 这张 报错 
      

  7.   

    Class File Editor Source not found 这个不是程序错误,是Eclipse没找到session的源码,因为你肯定也没下载Tomcat的源码;属于开发环境配置问题。另外你代码顺序可能有错:String usernamePaging = request.getParameter("login.username");
    if (usernamePaging != null) {
      session.setAttribute("login.usename", usernamePaging);
    } else {
      name = (String) session.getAttribute("login.usename");
    }
    List<Login> lst=loginBizI.selectTypeusers(usernamePaging); // 放IF后面来
      

  8.   

    感谢2楼 对了我 直接跳了INPUT 里面去