At 11:13 PM +0800 8/26/04, PC Leung wrote:
Can I set validation on or off in ValidatorForm dynamically?
In the first place, set it off.
Later on, set it on.

Not in ValidatorForm, although you could certainly subclass it or write your own subclass of ActionForm which chose whether to validate or not based on the state of the arguments it receives in validate(mapping,request).


But trust me, the conventional way to do this is to write two separate action mappings, one for showing the form and another for processing the submission.

Joe




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]


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place."
- Carlos Santana

Reply via email to