2016-08-19 55 views
1

我想從使用Struts2的URL獲取參數,但它不工作。我可以使用EL,但不能使用Struts2。如何使用Strust2在JSP中獲取URL參數OGNL

showReport在URL中傳遞。

使用JSTL和EL它的工作原理

<c:choose> 
    <c:when test="${param.showReport eq true}"> 
     <a href="#x" style="width:155px" title="This function will provide you a 30 day download of all your eSign transactions." onclick="document.getElementById('viewIntegrationReport').submit()"><span>Export E-Sign Information</span></a> 
    </c:when> 
    <c:when test="${param.showReport eq false}"></c:when> 
     <c:when test="${empty param.showReport}"></c:when> 
</c:choose> 

S2方式

<s:if test="%{param.showReport=='true'}"> 
     <a href="#x" style="width:155px" title="This function will provide you a 30 day download of all your eSign transactions." onclick="document.getElementById('viewIntegrationReport').submit()"><span>Export E-Sign Information</span></a> 
</s:if> 

我需要使用S2 OGNL不知道我錯了洞做呢?

回答

1

我想通了。

<s:if test="%{#parameters.showReport}"> 
    <a href="#x" style="width:155px" title="This function will provide you a 30 day download of all your eSign transactions." onclick="document.getElementById('viewIntegrationReport').submit()"><span>Export E-Sign Information</span></a> 
</s:if> 
<s:else> 
    <h4>Hello World</h4> 
</s:else>