struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Actions without extending ActionSupport?
Date Wed, 20 Feb 2008 17:26:49 GMT
Hi David,

Thanks again for the reply. I'm comparing MVC frameworks right now, and 
wondering if struts2 has a similar feature to JSF. In JSF, an action can 
look like this:

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.
Just wondering if struts2 has a way to decouple actions in this manner. 
Spring-MVC does not and, of course, struts1 does not.

Thank you.

--- tom_brokaw <> wrote:
> I said:
>> You don't *need* to extend ActionSupport to implement ValidationAware,
>> it's just much easier.
> So I *must* implement an interface (ValidationAware) or extend a struts2
> class in order to add errors messages from an action. Is that accurate?

If you want the framework to recognize those errors, be able to use them 
tags, etc. or make decisions based on their presence (or not), use the
validation framework (which expects to be able to add messages based on 
ValidationAware interface) then yes.

If you want to create your own framework for handling errors then you can 
whatever you want.


To unsubscribe, e-mail:
For additional commands, e-mail:

*************************** IMPORTANT
NOTE***************************** The opinions expressed in this
message and/or any attachments are those of the author and not
necessarily those of Brown Brothers Harriman & Co., its
subsidiaries and affiliates ("BBH"). There is no guarantee that
this message is either private or confidential, and it may have
been altered by unauthorized sources without your or our knowledge.
Nothing in the message is capable or intended to create any legally
binding obligations on either party and it is not intended to
provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message