是否可以在 jsp scriptlet 中访问 struts2 变量? [英] Is it possible to access struts2 variable in jsp scriptlet?
本文介绍了是否可以在 jsp scriptlet 中访问 struts2 变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
jsp scriptlet中可以访问struts2变量吗?
Is it possible to access struts2 variable in jsp scriptlet?
如果我有类似 struts2 的变量
If I have struts2 variable like
<s:set var="test" value="%{'true'}"/>
我可以在 JSP scriptlet 中使用变量test"吗?
Can I use variable "test" in JSP scriptlet?
如果是.怎么可能?
谁能给点意见?
谢谢.
推荐答案
<jsp:useBean id="test" class="java.lang.String" scope="request"/>
<%
test = "false";
%>
1. outside scriptlet: <c:out value="${test}"/> <!-- will not print anything -->
<%
out.println("2. in scriptlet: " + test); // will print false
%>
<c:set var="test" value="true" />
3. outside scriptlet: <c:out value="${test}"/> <!-- will print true -->
<%
out.println("4. in scriptlet: " + test); // will print false
%>
这篇关于是否可以在 jsp scriptlet 中访问 struts2 变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文