You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by PC Leung <pc...@gmail.com> on 2004/08/26 16:50:17 UTC

How to stop the first validation when a web page first displays?

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to stop the first validation when a web page first displays?

Posted by PC Leung <pc...@gmail.com>.
Same path and single form.

On Thu, 26 Aug 2004 11:05:30 -0400, Erik Weber <er...@mindspring.com> 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 <er...@mindspring.com> 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: 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
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >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
> 
>

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


Re: How to stop the first validation when a web page first displays?

Posted by Erik Weber <er...@mindspring.com>.
If you are using ValidatorForm with declarative form validation, I think 
you are going to have to do it this way, or similar:

1) Define your "add" form at the top of struts-config.xml 
(name=userProfileForm, type=YourFormType)
2) Define two action mappings, the first being a "setup" or "view" 
action, the second being a "process" or "save" action. Each has a 
different path, but they will both have the same form (specified by the 
"name" attribute). Set validation to true in the "view" action mapping, 
false in the "save" action mapping.
3) (More than one way to do this) Make sure your Action class acts 
appropriately depending on whether the user has triggered it using the 
"setup" path or the "save" path. The way I do this is to use the 
"parameter" attribute to an action mapping. I set the parameter to be 
"view" for the first mapping, "save" for the second. Then your Action 
class can invoke mapping.getParameter in the execute method. If the 
parameter is "view", you really don't need to do anything, just forward 
on to "success" (the blank form). If the parameter is "save", process 
the user's form input. This becomes a little more complicated when you 
begin using "update" forms in contrast to "add" forms, but tackle that 
when you get to it.

As an alternative to #2 that makes #3 easier, just make the "setup" 
action mapping very simple, with no form at all:

<action path="/viewUserProfileForm" type="YourFormType" 
forward="/AddUserProfile.jsp">

Now you have no form bean associated with the "setup" action, because 
you probably don't need it anyway (unless you need to prepopulate the 
form in some way), so your Action class is only going to be invoked when 
/addUserProfile is the action mapping).

Hope that helps.


Erik



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.
>
>
>On Thu, 26 Aug 2004 11:05:30 -0400, Erik Weber <er...@mindspring.com> 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 <er...@mindspring.com> 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: 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
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>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
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>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


Re: How to stop the first validation when a web page first displays?

Posted by Shyam Anand <st...@yahoo.com>.
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 <pc...@gmail.com> 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
> <er...@mindspring.com> 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
> <er...@mindspring.com> 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:
> 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
> > >>
> > >>
> > >>
> > >>
> > >
> >
>
>---------------------------------------------------------------------
> > >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
> > 
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



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

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


Re: How to stop the first validation when a web page first displays?

Posted by PC Leung <pc...@gmail.com>.
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 <er...@mindspring.com> 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 <er...@mindspring.com> 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: 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
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >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
> 
>

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


Re: How to stop the first validation when a web page first displays?

Posted by Erik Weber <er...@mindspring.com>.
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 <er...@mindspring.com> 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: 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
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>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


Re: How to stop the first validation when a web page first displays?

Posted by PC Leung <pc...@gmail.com>.
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 <er...@mindspring.com> 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: 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
> 
>

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


Re: How to stop the first validation when a web page first displays?

Posted by Erik Weber <er...@mindspring.com>.
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: 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


Re: How to stop the first validation when a web page first displays?

Posted by Research labs <re...@yahoo.co.uk>.
As Joe Germuska advised, it is more conventional to to
have two different Actions mappings.  set
validation=false in one and use it for the displaying
the JSP the first time.  Use the other Actions
mappings (with validation set to true) for subsequent
displays of the JSP.

Ola.

the  --- Bryce Fischer <br...@berzerker-soft.com>
wrote: 
> This is similar to the issue I had last night. What
> was suggested to me, 
> and it worked, was to turn automatic validation off
> by specifying 
> validate=false in the action mapping, and manually
> validating in my 
> DispatchAction.
> 
> 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:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
>  


	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

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


Re: How to stop the first validation when a web page first displays?

Posted by Bryce Fischer <br...@berzerker-soft.com>.
This is similar to the issue I had last night. What was suggested to me, 
and it worked, was to turn automatic validation off by specifying 
validate=false in the action mapping, and manually validating in my 
DispatchAction.

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org