You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mosho <ro...@gmail.com> on 2006/07/12 16:15:46 UTC

Does validator work with Lookup dispatch action

Hi,

I am using struts for my application. I have 3 buttons in my form i.e
prev,next,clear.
I read few articles and found that Lookup dispatch action will be the best
option to use.

I have few concerns using lookupdispatch action,
1. Will I be able to validate using struts validator?
2. I need to validate only when next button is hit, is that possible?

Is there any tutorial avialable for using lookup dispatch action.

Thanks
Mosho
-- 
View this message in context: http://www.nabble.com/Does-validator-work-with-Lookup-dispatch-action-tf1931125.html#a5289472
Sent from the Struts - User forum at Nabble.com.


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


Re: Does validator work with Lookup dispatch action

Posted by mosho <ro...@gmail.com>.
I have two submit buttons previous and next.
I need to validate only when I hit next button. I can control this by using
page attribute in valdation.xml.
This works for server-side. It doesn't work for client side validation. 
How can I do client side validation only when i hit next button. 
Is there any solution for it?

Thanks for your help.
-- 
View this message in context: http://www.nabble.com/Does-validator-work-with-Lookup-dispatch-action-tf1931125.html#a5314885
Sent from the Struts - User forum at Nabble.com.


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


Re: Does validator work with Lookup dispatch action

Posted by mosho <ro...@gmail.com>.
Hi Wendy,

As per my requirement, I need to validate only when next button is hit. I
can validate manually for server-side validation, it is working. How do I
control for clients-side validation?
If I include javascript tag in my jsp, it is going to validate even if I hit
previous or next button. 

Thanks for your help
-- 
View this message in context: http://www.nabble.com/Does-validator-work-with-Lookup-dispatch-action-tf1931125.html#a5291882
Sent from the Struts - User forum at Nabble.com.


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


Re: Does validator work with Lookup dispatch action

Posted by Wendy Smoak <ws...@gmail.com>.
On 7/12/06, mosho <ro...@gmail.com> wrote:

> I am using struts for my application. I have 3 buttons in my form i.e
> prev,next,clear.
> I read few articles and found that Lookup dispatch action will be the best
> option to use.

There's a *much* better option in EventDispatchAction.  It's available
in Struts 1.2.9
http://struts.apache.org/1.2.9/api/org/apache/struts/actions/EventDispatchAction.html

> I have few concerns using lookupdispatch action,
> 1. Will I be able to validate using struts validator?
> 2. I need to validate only when next button is hit, is that possible?

Yes, Validator works fine with dispatch actions.  For 2, take a look
at this tutorial on calling validation manually:
   http://www.learntechnology.net/validate-manually.do

It sounds like you have a wizard-type form, so you can make use of the
<field> 'page' attribute in validation.xml to validate the fields on
all pages up to the current one.

-- 
Wendy

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


Re: Does validator work with Lookup dispatch action

Posted by Juergen Kopper <ju...@uni-koblenz.de>.
Hi,

mosho schrieb:
> I have another question, I was just trying to use LookupDispatchAction. It
> looks like if I am extending LookupDispatchAction, I don't have to use
> excute method. Is that right? 

That's right.
> I can do all the processing in the respective
> previous and next methods.
>
> Previous methods looks like ..for ex:
>
>   public ActionForward previous(ActionMapping mapping,
>           ActionForm form,
>           HttpServletRequest request,
>           HttpServletResponse response)
>           throws IOException, ServletException {
>       // do add
>       return mapping.findForward("previous");
>   }
>
> Wendy,you are right my application is a wizard.
>   
You also need to override the
    protected Map getKeyMethodMap(){
    }
to map the buttons to the dispatch methods.

Hope that helps
Juergen



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


RE: Does validator work with Lookup dispatch action

Posted by mosho <ro...@gmail.com>.
I have another question, I was just trying to use LookupDispatchAction. It
looks like if I am extending LookupDispatchAction, I don't have to use
excute method. Is that right? I can do all the processing in the respective
previous and next methods.

Previous methods looks like ..for ex:

  public ActionForward previous(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException {
      // do add
      return mapping.findForward("previous");
  }

Wendy,you are right my application is a wizard.
-- 
View this message in context: http://www.nabble.com/Does-validator-work-with-Lookup-dispatch-action-tf1931125.html#a5290575
Sent from the Struts - User forum at Nabble.com.


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


RE: Does validator work with Lookup dispatch action

Posted by mosho <ro...@gmail.com>.
Thanks for all the replies.

Wendy, I am using struts 1.1 so I don't think I can use EventDispatchAction.

Adam,

what is the difference between MappingDispatchAction and
LookupDispatchAction. Any advantages over LookupDispatchAction?

Also, do you have an example of how to set page attribute and use client
side script to set the page request parameter. 

I am new to this, all your help is appreciated.

Mosho
 
-- 
View this message in context: http://www.nabble.com/Does-validator-work-with-Lookup-dispatch-action-tf1931125.html#a5290199
Sent from the Struts - User forum at Nabble.com.


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


Re: Does validator work with Lookup dispatch action

Posted by David Durham <dd...@vailsys.com>.
mosho wrote:
> I have few concerns using lookupdispatch action,
> 1. Will I be able to validate using struts validator?
> 2. I need to validate only when next button is hit, is that possible?
> 
> Is there any tutorial avialable for using lookup dispatch action.

I've done something similar by explicitly calling form.validate() from 
within the "execute" method, but this has a bad smell.  Someone else 
probably has a better approach.


-Dave


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