You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Sam Sorrell (JIRA)" <ji...@apache.org> on 2010/01/12 16:11:46 UTC

[jira] Created: (WW-3375) inside is not being processed -- entire conditional is ignored.

<s:if> inside <s:url> is not being processed -- entire conditional is ignored.
------------------------------------------------------------------------------

                 Key: WW-3375
                 URL: https://issues.apache.org/struts/browse/WW-3375
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - Tags
    Affects Versions: 2.1.8
         Environment: Glassfish v2.1.1
            Reporter: Sam Sorrell
            Priority: Minor


When an "if" tag is placed within a "url" tag, the "if" tag is completely ignored.  For the following example the resulting url will not have a "page" parameter regradless of the value of "parameter". 

    <s:url id="myHelpUrl" action="myHelpAction" namespace="/myNamespace">
        <s:param name="section" value="%{'Section'}"/>
        <s:param name="component" value="%{'Component'}"/>
        <s:if test="%{bean.primaryKey != null">
            <s:param name="page" value="%{'Update'}"/>
        </s:if>
        <s:else>
            <s:param name="page" value="%{'Add'}"/>
        </s:else>
    </s:url>

By contrast, the following less concise version has the "page" parameter:

<s:if test="%{bean.primaryKey != null}">
    <s:url id="myHelpUrl" action="myHelpAction" namespace="/myNamespace">
        <s:param name="section" value="%{'Section'}"/>
        <s:param name="component" value="%{'Component'}"/>
        <s:param name="page" value="%{'Update'}"/>
    </s:url>
</s:if>
<s:else>
    <s:url id="myHelpUrl" action="myHelpAction" namespace="/myNamespace">
        <s:param name="section" value="%{'Section'}"/>
        <s:param name="component" value="%{'Component'}"/>
        <s:param name="page" value="%{'Add'}"/>
    </s:url>
</s:else>



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-3375) inside is not being processed -- entire conditional is ignored.

Posted by "Sam Sorrell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47231#action_47231 ] 

Sam Sorrell commented on WW-3375:
---------------------------------

The "parameter" metioned in the text is the if's "bean.primaryKey".  This was tested with null and non-null, but not with other conditions.

> <s:if> inside <s:url> is not being processed -- entire conditional is ignored.
> ------------------------------------------------------------------------------
>
>                 Key: WW-3375
>                 URL: https://issues.apache.org/struts/browse/WW-3375
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.1.8
>         Environment: Glassfish v2.1.1
>            Reporter: Sam Sorrell
>            Priority: Minor
>
> When an "if" tag is placed within a "url" tag, the "if" tag is completely ignored.  For the following example the resulting url will not have a "page" parameter regradless of the value of "parameter". 
>     <s:url id="myHelpUrl" action="myHelpAction" namespace="/myNamespace">
>         <s:param name="section" value="%{'Section'}"/>
>         <s:param name="component" value="%{'Component'}"/>
>         <s:if test="%{bean.primaryKey != null">
>             <s:param name="page" value="%{'Update'}"/>
>         </s:if>
>         <s:else>
>             <s:param name="page" value="%{'Add'}"/>
>         </s:else>
>     </s:url>
> By contrast, the following less concise version has the "page" parameter:
> <s:if test="%{bean.primaryKey != null}">
>     <s:url id="myHelpUrl" action="myHelpAction" namespace="/myNamespace">
>         <s:param name="section" value="%{'Section'}"/>
>         <s:param name="component" value="%{'Component'}"/>
>         <s:param name="page" value="%{'Update'}"/>
>     </s:url>
> </s:if>
> <s:else>
>     <s:url id="myHelpUrl" action="myHelpAction" namespace="/myNamespace">
>         <s:param name="section" value="%{'Section'}"/>
>         <s:param name="component" value="%{'Component'}"/>
>         <s:param name="page" value="%{'Add'}"/>
>     </s:url>
> </s:else>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.