开发者

How to test a jsp param parameter with a string at Struts?

开发者 https://www.devze.com 2023-02-18 08:57 出处:网络
${param.type} is the variable that I send it from one jsp to included jsp. I tried that <s:if test开发者_如何学运维=\"${param.type} == \'message_error\'\">

${param.type} is the variable that I send it from one jsp to included jsp.

I tried that

<s:if test开发者_如何学运维="${param.type} == 'message_error'">

or

<s:if test="'message_error'.equas(${param.type})">

Non of them works. How I can check it with struts?

EDIT 1:

I send parameter like that:

<jsp:include page="/file.jsp">
    <jsp:param name="type" value="message_error"/>
</jsp:include>

I will do that struts control at file.jsp

EDIT 2:

Here is one step to answer. http://struts.apache.org/2.x/docs/why-doesnt-the-if-tag-evaluate-params-properly.html parameters are in a Map at Struts2. However my type param is not at request I think struts2 cannot see it after request parameters set at first.


Also try something like this

<s:if test='%{(param.type) == "message_error"}'>
0

精彩评论

暂无评论...
验证码 换一张
取 消