struts
2013-01-09 21 views 0 likes 
0

在我的行動:設置在一個標籤請求變量支柱

..... 
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> 

我曾嘗試:

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

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

和其他工作。我該怎麼做呢?

回答

0

試試這個:

兩種方式

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> 
+0

不,我得到: mike628

+0

@ mike628然後,您並未在JSP 2.0容器中運行;使用EL標籤庫。 –

+0

當我這樣做:我可以訪問該值 – mike628

相關問題