Re: Validation is called before form is populated from my database

2005-07-20 Thread William Shief
Finally, I found two valuable solutions to my problem.

The first one is MappingDispatchAction, as suggested
by Hubert. It is efficient but I dislike to have so
much entries in my struts-config (my application is
going big enough)
I found a good explanation for it by the frustrated
programmer (who gives us some remarks about Struts
which were helpful for me)
http://frustratedprogrammer.blogspot.com/2004/07/struts-121-mappingdispatchaction.html

The second one is to redefine the methode "validate"
in my form-bean (EditionPersonneForm, which extends
validator.ValidateForm) and add a condition in it,
which enables validation or not, according to my
dispatch parameter "do".
public ActionErrors validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
{
if (someCondition)
{ 
return new ActionErrors(); 
}

return super.validate(mapping, request);
}

Thanks again, Hubert !

Billy


--- Hubert Rabago <[EMAIL PROTECTED]> wrote:

> Another option is to switch to
> MappingDispatchAction* so you can set
> different attributes for the different situations
> that your Action
> needs to handle.
> 
> Hubert
> 
>
*http://struts.apache.org/api/org/apache/struts/actions/MappingDispatchAction.html
> 
> On 7/19/05, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > No, always respond to the user list when it's
> relevant to the question
> > you posted.  This way, other people can offer
> solutions as well, and
> > those having the same problems will get to
> hear/read what the solution
> > is.
> > 
> > Since you're extending DispatchAction, you
> probably should turn off
> > automatic validation and handle it yourself. 
> Search the archives for
> > discussion on automatic validation, it's been
> discussed a lot the past
> > few months.
> > 
> > Mail archives are available at
> > http://marc.theaimsgroup.com/?l=struts-user and
> >
> http://www.mail-archive.com/user@struts.apache.org/
> > 
> > Hubert
> > 
> > On 7/19/05, William Shief
> <[EMAIL PROTECTED]> wrote:
> > > Unfortunately EditerPersonneAction do extend
> > > DispatchAction (using parameter "do") !
> (Otherwise
> > > your solution would be good)
> > >
> > > (I answer you personally because I assume such a
> > > message is not useful for the list)
> > >
> > > Billy
> > >
> > > --- Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > > It seems that you're trying to prepopulate a
> form
> > > > with values from the
> > > > DB before showing it to the user.
> > > >
> > > > So, you have
> > > > 1) call /EditionPersonne to prepopulate the
> form
> > > > 2) show EditerPersonne.jsp to display the form
> > > > 3) submit the form to
> /SomePathLikeSubmitPersonne
> > > >
> > > > If so, you don't need to specify the "form"
> > > > attribute in
> > > > /EditionPersonne.  The "form" attribute
> identifies
> > > > the input form for
> > > > that Action, to carry the data being submitted
> to
> > > > that Action.
> > > >
> > > > Try removing the "scope", "form" and "input"
> > > > attributes to
> > > > /EditionPersonne, and specify them instead on
> the
> > > > Action to which the
> > > > form will be submitted to.
> > > >
> > > > On the other hand, if EditerPersonneAction
> extends a
> > > > DispatchAction
> > > > class, send another message and we'll offer a
> > > > different solution.
> > > >
> > > > Hubert
> > > >
> > > >
> > > > On 7/19/05, William Shief
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Hello,
> > > > > I'm currently having a problem with the
> Struts
> > > > > validator.
> > > > > I have a very simple Struts bean
> > > > "EditionPersonneForm"
> > > > > (extending
> > > > > ValidatorForm) associated with an action
> > > > > "EditerPersonneAction" and a
> > > > > JSP form "EditerPersonne.jsp"
> > > > >
> > > > > [From struts-config.xml]
> > > > >  path="/EditionPersonne"
> > > > >
> > > > >
> type="com.myproject.actions.EditerPersonneAction"
> > > > > scope="session"
> > > > > name="EditerPersonneForm"
> > > > >
> > > > > input="/pages/EditerPersonne.jsp"
> > > > > parameter="do"
> > > > > validate="true">
> > > > >  > > > > name="afficherEditionPersonne"
> > > > > path="/pages/EditionPersonne.jsp"/>
> > > > >  > > > > name="afficherAjoutPersonne"
> > > > >
> > > > > path="/pages/AjoutPersonne.jsp" />
> > > > > 
> > > > > [end of listing]
> > > > >
> > > > > The matter is that the method validate() is
> called
> > > > > BEFORE the form is
> > > > > displayed. So if the Struts bean is filled
> in with
> > > > > wrong values at this
> > > > >
> > > > > very moment, the validator causes an error
> and
> > > > Struts
> > > > > redirects me to
> > > > > the "input" error page, and the action
> (which
> > > > > populates the form
> > > > > with the right data from the database) is
> never
> > > > called
> > > > > !
> > > > > Does anyone have a clue ?
> > > > > Thanks in advance,
> > > 

Re: Validation is called before form is populated from my database

2005-07-19 Thread Hubert Rabago
Another option is to switch to MappingDispatchAction* so you can set
different attributes for the different situations that your Action
needs to handle.

Hubert

*http://struts.apache.org/api/org/apache/struts/actions/MappingDispatchAction.html

On 7/19/05, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> No, always respond to the user list when it's relevant to the question
> you posted.  This way, other people can offer solutions as well, and
> those having the same problems will get to hear/read what the solution
> is.
> 
> Since you're extending DispatchAction, you probably should turn off
> automatic validation and handle it yourself.  Search the archives for
> discussion on automatic validation, it's been discussed a lot the past
> few months.
> 
> Mail archives are available at
> http://marc.theaimsgroup.com/?l=struts-user and
> http://www.mail-archive.com/user@struts.apache.org/
> 
> Hubert
> 
> On 7/19/05, William Shief <[EMAIL PROTECTED]> wrote:
> > Unfortunately EditerPersonneAction do extend
> > DispatchAction (using parameter "do") ! (Otherwise
> > your solution would be good)
> >
> > (I answer you personally because I assume such a
> > message is not useful for the list)
> >
> > Billy
> >
> > --- Hubert Rabago <[EMAIL PROTECTED]> wrote:
> >
> > > It seems that you're trying to prepopulate a form
> > > with values from the
> > > DB before showing it to the user.
> > >
> > > So, you have
> > > 1) call /EditionPersonne to prepopulate the form
> > > 2) show EditerPersonne.jsp to display the form
> > > 3) submit the form to /SomePathLikeSubmitPersonne
> > >
> > > If so, you don't need to specify the "form"
> > > attribute in
> > > /EditionPersonne.  The "form" attribute identifies
> > > the input form for
> > > that Action, to carry the data being submitted to
> > > that Action.
> > >
> > > Try removing the "scope", "form" and "input"
> > > attributes to
> > > /EditionPersonne, and specify them instead on the
> > > Action to which the
> > > form will be submitted to.
> > >
> > > On the other hand, if EditerPersonneAction extends a
> > > DispatchAction
> > > class, send another message and we'll offer a
> > > different solution.
> > >
> > > Hubert
> > >
> > >
> > > On 7/19/05, William Shief
> > > <[EMAIL PROTECTED]> wrote:
> > > > Hello,
> > > > I'm currently having a problem with the Struts
> > > > validator.
> > > > I have a very simple Struts bean
> > > "EditionPersonneForm"
> > > > (extending
> > > > ValidatorForm) associated with an action
> > > > "EditerPersonneAction" and a
> > > > JSP form "EditerPersonne.jsp"
> > > >
> > > > [From struts-config.xml]
> > > >  > > >
> > > > type="com.myproject.actions.EditerPersonneAction"
> > > > scope="session"
> > > > name="EditerPersonneForm"
> > > >
> > > > input="/pages/EditerPersonne.jsp"
> > > > parameter="do"
> > > > validate="true">
> > > >  > > > name="afficherEditionPersonne"
> > > > path="/pages/EditionPersonne.jsp"/>
> > > >  > > > name="afficherAjoutPersonne"
> > > >
> > > > path="/pages/AjoutPersonne.jsp" />
> > > > 
> > > > [end of listing]
> > > >
> > > > The matter is that the method validate() is called
> > > > BEFORE the form is
> > > > displayed. So if the Struts bean is filled in with
> > > > wrong values at this
> > > >
> > > > very moment, the validator causes an error and
> > > Struts
> > > > redirects me to
> > > > the "input" error page, and the action (which
> > > > populates the form
> > > > with the right data from the database) is never
> > > called
> > > > !
> > > > Does anyone have a clue ?
> > > > Thanks in advance,
> > > > Billy Bob
> > > >
> > > >
> > >
> > >
> > -
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > __
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>

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



Re: Validation is called before form is populated from my database

2005-07-19 Thread Hubert Rabago
No, always respond to the user list when it's relevant to the question
you posted.  This way, other people can offer solutions as well, and
those having the same problems will get to hear/read what the solution
is.

Since you're extending DispatchAction, you probably should turn off
automatic validation and handle it yourself.  Search the archives for
discussion on automatic validation, it's been discussed a lot the past
few months.

Mail archives are available at
http://marc.theaimsgroup.com/?l=struts-user and
http://www.mail-archive.com/user@struts.apache.org/

Hubert

On 7/19/05, William Shief <[EMAIL PROTECTED]> wrote:
> Unfortunately EditerPersonneAction do extend
> DispatchAction (using parameter "do") ! (Otherwise
> your solution would be good)
> 
> (I answer you personally because I assume such a
> message is not useful for the list)
> 
> Billy
> 
> --- Hubert Rabago <[EMAIL PROTECTED]> wrote:
> 
> > It seems that you're trying to prepopulate a form
> > with values from the
> > DB before showing it to the user.
> >
> > So, you have
> > 1) call /EditionPersonne to prepopulate the form
> > 2) show EditerPersonne.jsp to display the form
> > 3) submit the form to /SomePathLikeSubmitPersonne
> >
> > If so, you don't need to specify the "form"
> > attribute in
> > /EditionPersonne.  The "form" attribute identifies
> > the input form for
> > that Action, to carry the data being submitted to
> > that Action.
> >
> > Try removing the "scope", "form" and "input"
> > attributes to
> > /EditionPersonne, and specify them instead on the
> > Action to which the
> > form will be submitted to.
> >
> > On the other hand, if EditerPersonneAction extends a
> > DispatchAction
> > class, send another message and we'll offer a
> > different solution.
> >
> > Hubert
> >
> >
> > On 7/19/05, William Shief
> > <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > > I'm currently having a problem with the Struts
> > > validator.
> > > I have a very simple Struts bean
> > "EditionPersonneForm"
> > > (extending
> > > ValidatorForm) associated with an action
> > > "EditerPersonneAction" and a
> > > JSP form "EditerPersonne.jsp"
> > >
> > > [From struts-config.xml]
> > >  > >
> > > type="com.myproject.actions.EditerPersonneAction"
> > > scope="session"
> > > name="EditerPersonneForm"
> > >
> > > input="/pages/EditerPersonne.jsp"
> > > parameter="do"
> > > validate="true">
> > >  > > name="afficherEditionPersonne"
> > > path="/pages/EditionPersonne.jsp"/>
> > >  > > name="afficherAjoutPersonne"
> > >
> > > path="/pages/AjoutPersonne.jsp" />
> > > 
> > > [end of listing]
> > >
> > > The matter is that the method validate() is called
> > > BEFORE the form is
> > > displayed. So if the Struts bean is filled in with
> > > wrong values at this
> > >
> > > very moment, the validator causes an error and
> > Struts
> > > redirects me to
> > > the "input" error page, and the action (which
> > > populates the form
> > > with the right data from the database) is never
> > called
> > > !
> > > Does anyone have a clue ?
> > > Thanks in advance,
> > > Billy Bob
> > >
> > >
> >
> >
> -
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

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



Re: Validation is called before form is populated from my database

2005-07-19 Thread William Shief
Unfortunately EditerPersonneAction do extend
DispatchAction (using parameter "do") ! (Otherwise
your solution would be good)

(I answer you personally because I assume such a
message is not useful for the list)

Billy

--- Hubert Rabago <[EMAIL PROTECTED]> wrote:

> It seems that you're trying to prepopulate a form
> with values from the
> DB before showing it to the user.
> 
> So, you have
> 1) call /EditionPersonne to prepopulate the form
> 2) show EditerPersonne.jsp to display the form
> 3) submit the form to /SomePathLikeSubmitPersonne
> 
> If so, you don't need to specify the "form"
> attribute in
> /EditionPersonne.  The "form" attribute identifies
> the input form for
> that Action, to carry the data being submitted to
> that Action.
> 
> Try removing the "scope", "form" and "input"
> attributes to
> /EditionPersonne, and specify them instead on the
> Action to which the
> form will be submitted to.
> 
> On the other hand, if EditerPersonneAction extends a
> DispatchAction
> class, send another message and we'll offer a
> different solution.
> 
> Hubert
> 
> 
> On 7/19/05, William Shief
> <[EMAIL PROTECTED]> wrote:
> > Hello,
> > I'm currently having a problem with the Struts
> > validator.
> > I have a very simple Struts bean
> "EditionPersonneForm"
> > (extending
> > ValidatorForm) associated with an action
> > "EditerPersonneAction" and a
> > JSP form "EditerPersonne.jsp"
> > 
> > [From struts-config.xml]
> >  > 
> > type="com.myproject.actions.EditerPersonneAction"
> > scope="session"
> > name="EditerPersonneForm"
> > 
> > input="/pages/EditerPersonne.jsp"
> > parameter="do"
> > validate="true">
> >  > name="afficherEditionPersonne"
> > path="/pages/EditionPersonne.jsp"/>
> >  > name="afficherAjoutPersonne"
> > 
> > path="/pages/AjoutPersonne.jsp" />
> > 
> > [end of listing]
> > 
> > The matter is that the method validate() is called
> > BEFORE the form is
> > displayed. So if the Struts bean is filled in with
> > wrong values at this
> > 
> > very moment, the validator causes an error and
> Struts
> > redirects me to
> > the "input" error page, and the action (which
> > populates the form
> > with the right data from the database) is never
> called
> > !
> > Does anyone have a clue ?
> > Thanks in advance,
> > Billy Bob
> > 
> >
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: Validation is called before form is populated from my database

2005-07-19 Thread Hubert Rabago
It seems that you're trying to prepopulate a form with values from the
DB before showing it to the user.

So, you have
1) call /EditionPersonne to prepopulate the form
2) show EditerPersonne.jsp to display the form
3) submit the form to /SomePathLikeSubmitPersonne

If so, you don't need to specify the "form" attribute in
/EditionPersonne.  The "form" attribute identifies the input form for
that Action, to carry the data being submitted to that Action.

Try removing the "scope", "form" and "input" attributes to
/EditionPersonne, and specify them instead on the Action to which the
form will be submitted to.

On the other hand, if EditerPersonneAction extends a DispatchAction
class, send another message and we'll offer a different solution.

Hubert


On 7/19/05, William Shief <[EMAIL PROTECTED]> wrote:
> Hello,
> I'm currently having a problem with the Struts
> validator.
> I have a very simple Struts bean "EditionPersonneForm"
> (extending
> ValidatorForm) associated with an action
> "EditerPersonneAction" and a
> JSP form "EditerPersonne.jsp"
> 
> [From struts-config.xml]
>  
> type="com.myproject.actions.EditerPersonneAction"
> scope="session"
> name="EditerPersonneForm"
> 
> input="/pages/EditerPersonne.jsp"
> parameter="do"
> validate="true">
>  name="afficherEditionPersonne"
> path="/pages/EditionPersonne.jsp"/>
>  name="afficherAjoutPersonne"
> 
> path="/pages/AjoutPersonne.jsp" />
> 
> [end of listing]
> 
> The matter is that the method validate() is called
> BEFORE the form is
> displayed. So if the Struts bean is filled in with
> wrong values at this
> 
> very moment, the validator causes an error and Struts
> redirects me to
> the "input" error page, and the action (which
> populates the form
> with the right data from the database) is never called
> !
> Does anyone have a clue ?
> Thanks in advance,
> Billy Bob
> 
>

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



Re: Validation is called before form is populated from my database

2005-07-19 Thread mah bub
Hi,
 As much I know if you need to load data when the page is load before the 
validation is called.
 You may load data when the action is called and there could be another 
action associated with the Submit button's page which will check the 
validation.
 I'm not sure whether it make you clear or not or solve the problem you 
asked for. Let me know if you need more clear explanation about my 
procedure.
 Thanks
 Mahbub


Validation is called before form is populated from my database

2005-07-19 Thread William Shief
Hello,
I'm currently having a problem with the Struts
validator.
I have a very simple Struts bean "EditionPersonneForm"
(extending
ValidatorForm) associated with an action
"EditerPersonneAction" and a
JSP form "EditerPersonne.jsp"

[From struts-config.xml]




[end of listing]

The matter is that the method validate() is called
BEFORE the form is
displayed. So if the Struts bean is filled in with
wrong values at this

very moment, the validator causes an error and Struts
redirects me to
the "input" error page, and the action (which
populates the form
with the right data from the database) is never called
!
Does anyone have a clue ?
Thanks in advance, 
Billy Bob




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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