在标记struts中设置一个Request变量



在我的行动中:

.....
String status = "add";
servletRequest.setAttribute("button", status);
....

在我的JSP中:

<c:if test='${button == "add"}'>
  <c:set var="edittype" value="add" />
</c:if>
<c:if test='${button == "update"}'>
  <c:set var="edittype" value="update" />
</c:if>

I have try:

<html:hidden property ="" value="edittype" />

<html:hidden property ="" value="${button}" /> 

和两者都不行。我该怎么做呢?

试试这个:

两种方式

1>

    <html:hidden property ="reqButtonValue" value="${param.button}" /> 
    <c:if test="${reqButtonValue=='add'}">
  <c:set var="edittype" value="add" />
</c:if>

2>

<c:if test="${param.button=='add'}">
      <c:set var="edittype" value="add" />
</c:if>

最新更新