You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Anderson M. C. de Souza (JIRA)" <ji...@apache.org> on 2007/05/22 18:07:43 UTC

[jira] Updated: (WW-1866) Add annotation support for Action Method

     [ https://issues.apache.org/struts/browse/WW-1866?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anderson M. C. de Souza updated WW-1866:
----------------------------------------


The idea is have some annotation support for this xml configuration:
<code>
<action name="index" class="com.aurifa.struts2.tutorial.action.EmployeeAction" method="list">
	<result name="success">/WEB-INF/jsp/employees.jsp</result>
	<!-- we don't need the full stack here -->
	<interceptor-ref name="basicStack"/>
</action>
<action name="crud" class="com.aurifa.struts2.tutorial.action.EmployeeAction" method="input">
	<result name="success" type="redirect-action">index</result>
	<result name="input">/WEB-INF/jsp/employeeForm.jsp</result>
	<result name="error">/WEB-INF/jsp/error.jsp</result>
</action>
</code>

Something like that:

<code>
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class EmployeeAction extends ActionSupport implements Preparable {

    @Action(results = {@Result(name="success", value="WEB-INF/jsp/employees.jsp")},
          interceptor="basicStack")
    public String list(){
    }

    @Action(results = {
          @Result(name="success", type="redirect-action", value="index"),
          @Result(name="input", value="/WEB-INF/jsp/employeeForm.jsp"),
          @Result(name="error", value="/WEB-INF/jsp/error.jsp"))
    public String input(){
    }
}
</code>

In this "Action" annotation the attribute "name" could be the method name.

Thank's,
Anderson Souza 

> Add annotation support for Action Method
> ----------------------------------------
>
>                 Key: WW-1866
>                 URL: https://issues.apache.org/struts/browse/WW-1866
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Configuration
>    Affects Versions: 2.0.6
>            Reporter: Anderson M. C. de Souza
>
> Annotation support for action methods would be a very nice feature to have. I know it's not a basic configuration cenario, but I think it would help a lot "use case" based applications, which many times use one class per use case to handle actions.
> Thanks,
> Anderson Souza

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