Struts2中的 # 和 % 分别是做什么的?
(1)使用#获取context里面数据
<s:iterator value = “list” var=”user”> <s:property value = “#user.username”> </s:iterator>
(2)向 request域放值(获取context里面数据,写ognl时候,首先添加符号#context的key名称.域对象名称)
(3)在页面中使用ognl获取
<s:property value = “#request.req”>
(4)%在struts2标签中表单标签
在struts2标签里面使用ognl表达式,如果直接在struts2表单标签里面使用ognl表达式不识别,只有%之后才
会识别。
<s:textfield name=”username” value=”%{#request.req}”>
文章来自www.wityx.com,转载请注明出处!原文地址http://www.wityx.com/post/1363_1_1.html
java面试题交流群:327440556