You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by To...@LafayetteLife.com on 2005/01/13 15:37:47 UTC

Action Chaining

Hi all.  I have a question that I cannot find the answer to, and hopefully
someone has run in to this.

I have 3 Actions and 2 Forms

AnnuityAction <-> AnnuityForm ,   BasicAction <-> BasicForm

I have an abstract class called LaserAction that extends LookupDispatchAction.
Both AnnuityAction and Basicform extend LaserAction.  LaserAction overrides g
etMethodName(mapping, form,request, response, parameter)and defines the abstract
method load.  If no method is specified in the request then it calls load by
default. This works perfectly, but I am running into issues with validation and
forwarding.

Here is my problem,

When the user clicks "previous" on the AnnuityAction, the previous method is
called.  Previous saves the page, then forwards to /basic.do, which by default
will call load.   Is there any way to set validate=false for the forward?
I know you can do it for the action declaration, but I only want to disable it
for this particular forward.  The problem is that struts is calling
BasicForm.validate(mapping, request)  before it reaches
BasicAction.load(mapping, form, request, response).  I would like to not have to
declare an action such as /basicLoad that disables validation.  I'm trying to
introduce struts at my new position, and adding more mappings would just make
things more confusing for the other developers.

Thanks,
Todd





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action Chaining

Posted by Dakota Jack <da...@gmail.com>.
<snip>
On Thu, 13 Jan 2005 09:37:47 -0500, Todd_Nine@lafayettelife.com 
> Here is my problem,
> 
> When the user clicks "previous" on the AnnuityAction, the previous method is
> called.  Previous saves the page, then forwards to /basic.do, which by default
> will call load.   
</snip>

I would begin by not doing this.  I would also not use
LookupDispatchAction.  That is a really inefficient solution which is
outdated.

Jack

-- 
------------------------------

"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

-----------------------------------------------

"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Action Chaining

Posted by Kishore Senji <ks...@gmail.com>.
In your BasicForm's validate() you could do check for the
"parameter"'s value and return "ActionErrors" based on that value;

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
  /* if load or unspecified return null */
  if(org.apache.commons.lang.StringUtils.isEmpty((String)request.getParameter(mapping.getParameter()))
||   if(org.apache.commons.lang.StringUtils.equals((String)request.getParameter(mapping.getParameter()),
"load")){
    return null;
  }
  
  ActionErrors errors = new ActionErrors();
  
  // do the validation
   
  return errors;
}



On Thu, 13 Jan 2005 09:37:47 -0500, Todd_Nine@lafayettelife.com
<To...@lafayettelife.com> wrote:
> Hi all.  I have a question that I cannot find the answer to, and hopefully
> someone has run in to this.
> 
> I have 3 Actions and 2 Forms
> 
> AnnuityAction <-> AnnuityForm ,   BasicAction <-> BasicForm
> 
> I have an abstract class called LaserAction that extends LookupDispatchAction.
> Both AnnuityAction and Basicform extend LaserAction.  LaserAction overrides g
> etMethodName(mapping, form,request, response, parameter)and defines the abstract
> method load.  If no method is specified in the request then it calls load by
> default. This works perfectly, but I am running into issues with validation and
> forwarding.
> 
> Here is my problem,
> 
> When the user clicks "previous" on the AnnuityAction, the previous method is
> called.  Previous saves the page, then forwards to /basic.do, which by default
> will call load.   Is there any way to set validate=false for the forward?
> I know you can do it for the action declaration, but I only want to disable it
> for this particular forward.  The problem is that struts is calling
> BasicForm.validate(mapping, request)  before it reaches
> BasicAction.load(mapping, form, request, response).  I would like to not have to
> declare an action such as /basicLoad that disables validation.  I'm trying to
> introduce struts at my new position, and adding more mappings would just make
> things more confusing for the other developers.
> 
> Thanks,
> Todd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org