dcsimg
Struts html:link tag
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   oneworld_oneworld
Posted On:   Thursday, April 4, 2002 07:07 AM

How can I use the html:link tag to reference a page, without trigerring the validation process. e.g. This will trigger the validate() operation in the userAddForm and the perform() operation in userAddAction, BEFORE displaying the page userAdd.jsp. The problem here is that I have added a check in the validate() operation so that it adds an ActionError if the user did not fill in the username text box. But this check is meant for when the user hits the submit button, not when the page is first loaded. When referencing the page with: how can I differentiate, in the ActionForm and Action operations, between the case when the page is first loaded and the case when the user hits the submit button   More>>

How can I use the html:link tag to reference a page, without trigerring the validation process.

e.g.



This will trigger the validate() operation in the userAddForm and the perform() operation in userAddAction, BEFORE displaying the page userAdd.jsp.

The problem here is that I have added a check in the validate() operation so that it adds an ActionError if the user did not fill in the username text box. But this check is meant for when the user hits the submit button, not when the page is first loaded.

When referencing the page with:

how can I differentiate, in the ActionForm and Action operations, between the case when the page is first loaded and the case when the user hits the submit button??

I know I can solve the problem by referencing the page as follows:

but I want to try to do it the "Struts" way so that I can load the page with templates that are derived in the Action.

   <<Less

Re: Struts html:link tag

Posted By:   Haining_Mu  
Posted On:   Thursday, April 4, 2002 08:49 AM


looks like that you have your userAddAction class forward to userAdd.jsp, and userAdd.jsp submit to the same userAddAction class. If it is true, I believe you have validate=true set up in action mapping because you need to validate data when form submitted. Therefore, you may try to skip validate method in formbean class by checking if "submit" parameter exist or equal null.

Or, you may choose "Struts" way to have two action class with one form. you may have "editUserAddAction" forward to "userAdd.jsp" and then submit to "saveUserAddAction", then you specify validate=false for "editUserAddAction" and validate=true for "saveUserAddAction" in action mapping. Then your link can be just

hope this helps

About | Sitemap | Contact