--- [EMAIL PROTECTED] wrote:
> public class MyAction {
>   public String deleteUser() {
>     // Here I can inject errors for display on the JSP by writing:
>     FacesContext.getCurrentInstance().addMessage("userNameField", "Sorry, 
> that username is unknown");
>     return "input";
>   }
> }
> 
> Notice MyAction inherits no JSF-specific interfaces and extends no 
> JSF-specific classes, which is I find very desirable.

Well... Obviously code-coupling is bad. You're still coupled to the
FacesContext, though, and in some ways I like being coupled to static methods
even less because it's not injectable.

> Just wondering if struts2 has a way to decouple actions in this manner. 

Not that I know of, although it has some appeal. The ActionContext docs
pretty much state what is available in the current iteration of S2/XWork.

An action's errors / messages / etc. are part of the action itself, and the
validation framework and the tags that retrieve those messages rely on
calling those action methods for adding / retrieving the collection of
messages etc.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to