You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2007/06/22 04:45:26 UTC

[jira] Resolved: (WW-1773) Annotation @Before doesn't seem to work in Struts 2.0.6 GA release

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

Musachy Barroso resolved WW-1773.
---------------------------------

    Resolution: Fixed

As Ian pointed out you need to add the interceptor, the problem is that the interceptor wasn't defined on struts-default.xml, it is now. Just for future reference:

http://cwiki.apache.org/WW/annotationworkflowinterceptor.html

> Annotation @Before doesn't seem to work in Struts 2.0.6 GA release
> ------------------------------------------------------------------
>
>                 Key: WW-1773
>                 URL: https://issues.apache.org/struts/browse/WW-1773
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Actions, Configuration
>    Affects Versions: 2.0.6
>            Reporter: Mads Riise Rasmussen
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> I have a pretty simple case with an action configured using annotation, but @Before doesn't work.
> I can see "# UserTestAction execute()" in the log but not "# UserTestAction doBefore()".
> My action class is as follows:
> import org.apache.log4j.Logger;
> import org.apache.struts2.config.Result;
> import com.opensymphony.xwork2.interceptor.annotations.Before;
> @Result(name="success", value="/user/user_edit.jsp")
> public class UserTestAction extends UserBaseAction {
> 	private static final Logger log = Logger.getLogger(UserTestAction.class);
> 	
> 	private static final long serialVersionUID = -5967061439632906203L;
> 	
> 	@Before
> 	public void doBefore() throws Exception {
> 		log.debug("# UserTestAction doBefore()");
> 		prepare();
> 	}
> 	
> 	public String execute() throws Exception {
> 		log.debug("# UserTestAction execute()");
> 		return SUCCESS;
>     }
> }

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