如何在struts标记中获取JSP scriptlet值
这是我的代码:
如果我这样做,我没有得到价值:
有什么建议么?
这完美地工作..
<% request.setAttribute("lcItem", LeftContentItem); %>
注意:根据我们使用的范围,我们应该指定#request ..等
您可以通过2种方式编写代码
-
<% request.setAttribute("lcItem", "Hello"); %>
-
<% pageContext.setAttribute("lcItem", "Hello"); %>
那么如果你想在Struts2组件中访问这些值,你可以使用#attr。 作为前缀。
例
注意:它可以正常处理请求和“pageContext” 。
will not work because "lcItem" is not available in the Value Stack.