1

我有一个包含 netbiscuits 代码的 JSP,我现在正在删除该 netbiscuits 代码,但删除后我无法从上一页获取会话,因此我无法继续前进。我正在使用struts 1。请为我的问题提出解决方案,我将不胜感激。提前致谢。

4

1 回答 1

0

我不确定你的问题。

你能解释一下吗?

通常为了访问 jsp 页面中的会话,我们使用脚本中的代码,例如

String x=(String)session.getAttribute("uname");

需要类型转换。或使用

String x=""+session.getAttribute("uname");

如果你想在jsp页面的某个地方打印它,

<%= session.getAttribute("uname")%>

它将在 jsp 页面中打印会话值。

否则使用like

 <% String x=""+session.getAttribute("uname"); %>
 <%=x %>

用于访问 java 页面

Map session = ActionContext.getContext().getSession();
String uname=""+session.get("uname");
于 2011-12-05T13:34:25.530 回答