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

ASF GitHub Bot commented on WW-4590:
------------------------------------

Github user aleksandr-m commented on a diff in the pull request:

    https://github.com/apache/struts/pull/75#discussion_r50079358
  
    --- Diff: 
core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
 ---
    @@ -777,11 +777,21 @@ protected Class verifyResultType(String className, 
Location loc) {
                     }
                     params.putAll(resultParams);
     
    -                ResultConfig resultConfig = new 
ResultConfig.Builder(resultName, resultClass)
    -                        .addParams(params)
    -                        .location(DomHelper.getLocationObject(element))
    -                        .build();
    -                results.put(resultConfig.getName(), resultConfig);
    +                Set<String> resultNamesSet;
    +                if (",".equals(resultName.trim())) {
    +                    resultNamesSet = new HashSet<>(1);
    +                    resultNamesSet.add(resultName);
    --- End diff --
    
    Currently it is allowed to have a result name as a `,`. And 
`TextParseUtil.commaDelimitedStringToSet` will produce empty set in that case. 
Note that it is trimmed so the result name can be something like 
"&nbsp;&nbsp;&nbsp;," also.


> Allow to use multiple names in result
> -------------------------------------
>
>                 Key: WW-4590
>                 URL: https://issues.apache.org/jira/browse/WW-4590
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Convention, XML Configuration
>    Affects Versions: 2.3.24
>            Reporter: Aleksandr Mashchenko
>            Assignee: Aleksandr Mashchenko
>             Fix For: 2.5
>
>
> Allow to use multiple values in {{result}} tag {{name}} attribute and in 
> {{Result}} annotation {{name}}.
> So this typical configuration:
> {code:xml}
> <action name="save">
>     <result>success.jsp</result>
>     <result name="error">input-form.jsp</result>
>     <result name="input">input-form.jsp</result>
> </action>
> {code}
> Can be shorten to that:
> {code:xml}
> <action name="save">
>     <result>success.jsp</result>
>     <result name="error, input">input-form.jsp</result>
> </action>
> {code}
> And this annotations:
> {code:java}
> @Action(results = {
>     @Result(name="error", location="input-form.jsp"),
>     @Result(name="input", location="input-form.jsp"),
>     @Result(name="success", location="success.jsp")
> })
> {code}
> To that:
> {code:java}
> @Action(results = {
>     @Result(name="error, input", location="input-form.jsp"),
>     @Result(name="success", location="success.jsp")
> })
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to