struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] Commented: (WW-3355) s:form tag render action URL with query string incorrectly
Date Wed, 06 Jan 2010 10:53:43 GMT

    [ https://issues.apache.org/struts/browse/WW-3355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47224#action_47224
] 

Lukasz Lenart commented on WW-3355:
-----------------------------------

I checked it and if you specify empty extension like this
struts.action.extension=
you will get the same problem again.

Maybe it will be better to move params.length() > 0 ... outside extension checking condition?

right now:
        if (extension != null) {

            if (extension.length() == 0 || (extension.length() > 0 && uri.indexOf('.'
+ extension) == -1)) {
                if (extension.length() > 0) {
                    uri.append(".").append(extension);
                }
                if (params.length() > 0) {
                    uri.append(params);
                }
            }
        }

after:
        if (extension != null) {

            if (extension.length() == 0 || (extension.length() > 0 && uri.indexOf('.'
+ extension) == -1)) {
                if (extension.length() > 0) {
                    uri.append(".").append(extension);
                }
            }
        }
        if (params.length() > 0) {
           uri.append(params);
         }

Patch provided


Regards
--
Lukasz

> s:form tag render action URL with query string incorrectly
> ----------------------------------------------------------
>
>                 Key: WW-3355
>                 URL: https://issues.apache.org/struts/browse/WW-3355
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.1.8
>            Reporter: Iwasa Kazmi
>         Attachments: DefaultActionMapper-WW-3355.patch, DefaultActionMapper.java.diff
>
>
> Normally,
> <s:form action="%{'Simple?a=123&b=234'}">
> would be rendered as:
> <form action="/mysite/Simple.action?a=123&amp;b=234" ... >
> But if the ".action" suffix is omitted in the request URL,
> (e.g. http://localhost/mysite/Simple )
> it will be rendered as:
> <form action="/mysite/Simple" ... >
> The query string is not appended.
> In org.apache.struts2.dispatcher.mapper.DefaultActionMapper#getUriFromActionMapping(),
> query string is appended only in case that the extension is provided.

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


Mime
View raw message