Struts2---OGNL表达式和EL表达式

在action里放入actioncontext的变量值

ActionContext.getContext().put("forumList", forumList);

在jsp里如何取出, OGNL方式:

<s:iterator value="#forumList">
<s:property value="#request.name"/>

EL方式:

<s:iterator value="#forumList">
  ${name}

在action里放入valuestack的值

ActionContext.getContext().getValueStack().push(forum);

在jsp里取出

 <td><s:textfield name="name" cssClass="InputStyle" /> *</td>
 <td><s:textarea name="description" cssClass="TextareaStyle"></s:textarea></td>

  

在action里放入session

ActionContext.getContext().getSession().put("user", user);

jsp里取出

<s:if test="#session.user.hasPrivilegeByName(name)">

  

 

 

  

  

原文地址:https://www.cnblogs.com/wujixing/p/5552394.html