【发布时间】:2014-04-19 16:34:06
【问题描述】:
大家好,我遇到了一个非常奇怪的问题,迫使我在这里提问
我有两页说 register 和 validate 。 在注册页面上,我在会话中设置值并希望它们在其他页面上,即验证页面,所以我可以访问这些值。
我尝试访问但没有得到正确的结果。
有没有其他方法可以做到这一点。
任何帮助将不胜感激。
会话集
HttpSession session=request.getSession(true);
User_Registration urbean=new User_Registration();
urbean.setUser_mobile(userMobile);
urbean.setUser_email(userEmail);
urbean.setUser_name(userName);
urbean.setUser_country(usercountry);
session.setAttribute("userbean",urbean);
会话获取
HttpSession session =request.getSession(); //also tried to getSession(true)
System.out.println("session---"+session);
//getting error at this point getUsr_mobile is not defined
System.out.println(session.getAttribute("userbean").getUser_mobile()));
我必须在我的 android 程序中单独点击这些链接,我无法维护任何 reponse.sendredirect() 或任何重定向方法。
【问题讨论】:
-
投反对票的请评论投反对票
-
如果页面在同一个应用程序中,会话将被共享。请包含代码以显示您如何设置和获取值
-
是的,页面在同一个应用程序中。
-
RemoteCodeInspectionException 导致 NoClassDefFoundError 消息:无法初始化类 net.my.body.mind.util.ReadMindRemotely.class
-
另外,是的...您没有检索在第二个代码 sn-p 中作为“userbean”放入的 bean。这显然行不通。