action
String a = this.admin.getUsername();
ServletActionContext.getRequest().getSession().setAttribute("username", a);//把值存入session
jsp <tr>
<% String username = (String)ServletActionContext.getRequest().getSession().getAttribute("username");%>
<td height="69" align="right" valign="bottom">当前登录用户:<%=username %></td>
</tr>登录后能显示用户名,跳转到其它页面就显示上面2条jsp语句出错org.apache.jasper.JasperException: An exception occurred processing JSP page我这样写不是已经把username存入session了吗,页面跳转应该也不影响之前存入的参数啊?
String a = this.admin.getUsername();
ServletActionContext.getRequest().getSession().setAttribute("username", a);//把值存入session
jsp <tr>
<% String username = (String)ServletActionContext.getRequest().getSession().getAttribute("username");%>
<td height="69" align="right" valign="bottom">当前登录用户:<%=username %></td>
</tr>登录后能显示用户名,跳转到其它页面就显示上面2条jsp语句出错org.apache.jasper.JasperException: An exception occurred processing JSP page我这样写不是已经把username存入session了吗,页面跳转应该也不影响之前存入的参数啊?
直接用session.getAttribute("username");内置对象,前面加那么多,解析成java文件的时候会不会出错,你去服务器 里面work文件夹看看.java