Hi,

If you are doing validation in the validate() method
of your Action Form, just check for "submit" action
inside the method. i.e,

 public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest
request) 

{
if( method.equals("submit"))
{
//do validation
}

}

I guess this should take care of your problem.

HTH,
Shyam

--- PC Leung <[EMAIL PROTECTED]> wrote:

> Can I set validation on or off in ValidatorForm
> dynamically?
> In the first place, set it off.
> Later on, set it on.
> 
> 
> On Thu, 26 Aug 2004 11:05:30 -0400, Erik Weber
> <[EMAIL PROTECTED]> wrote:
> > Well, that looks fine -- /addUserProfile is the
> path the user will
> > access to submit the form, but what path does your
> user access to view
> > the blank form in the first place?
> > 
> > Erik
> > 
> > 
> > 
> > 
> > PC Leung wrote:
> > 
> > >How can I define it in struts-config.xml as you
> suggest.
> > >
> > >my current fragment of struts-config.xml is the
> following.
> > >
> > >    <action    path="/addUserProfile"
> > >              
> type="com.erp.quotation.AddUserProfileAction"
> > >               name="addUserProfileForm"
> > >                  scope="request"
> > >                  validate="true"
> > >                  parameter="method"
> > >               input="/AddUserProfile.jsp">
> > >      <forward name="success"
> path="/AddUserProfile.jsp"/>
> > >      <forward name="failure"
> path="/AddUserProfile.jsp"/>
> > >      <forward name="cancel"
> path="/UserMaint.jsp"/>
> > >    </action>
> > >
> > >
> > >On Thu, 26 Aug 2004 10:55:13 -0400, Erik Weber
> <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >>Is validation turned on in the action mapping
> for your setup action? If
> > >>you are using the same form bean for both setup
> and save actions, the
> > >>action mappings should have validation turned
> off for the former and on
> > >>for the latter.
> > >>
> > >>Erik
> > >>
> > >>
> > >>
> > >>
> > >>PC Leung wrote:
> > >>
> > >>
> > >>
> > >>>The web page displays at the first time with
> the following error.
> > >>>
> > >>>java.lang.NullPointerException
> > >>>     
>
java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1108)
> > >>>     
> java.text.DateFormat.parse(DateFormat.java:333)
> > >>>     
>
com.erp.quotation.AddUserProfileForm.getSqlJoinDate(AddUserProfileForm.java:68)
> > >>>     
>
com.erp.quotation.AddUserProfileForm.validate(AddUserProfileForm.java:80)
> > >>>     
>
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
> > >>>
> > >>>
> > >>>When it first displays, I want it to show with
> a token.
> > >>>Then I make a setup DispatchAction like the
> following.
> > >>>
> > >>>public final class AddUserProfileAction extends
> DispatchAction {
> > >>>   public ActionForward setup (ActionMapping
> mapping,
> > >>>      ActionForm form,
> > >>>      HttpServletRequest request,
> > >>>      HttpServletResponse response)
> > >>>        throws Exception {
> > >>>        saveToken(request);
> > >>>        return mapping.findForward("success");
> > >>>      }
> > >>>
> > >>>How it get a validation error message?
> > >>>Actually submit button has not been clicked.
> > >>>
> >
>
>>>---------------------------------------------------------------------
> > >>>To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > >>>For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> >
>
>>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > >>For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >>
> > >>
> > >>
> > >>
> > >
> >
>
>---------------------------------------------------------------------
> > >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > >For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



                
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

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

Reply via email to