It's not a secret anymore!
The moose likes Struts and the fly likes Subit the form with html:link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Subit the form with html:link" Watch "Subit the form with html:link" New topic

Subit the form with html:link

manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Dear frinds
I have a submit button and Link in a JSP.
If I click on the Submit button , it will validatev the data with validation framework. and if data is fine , it will insert/update the data.
and go next page ...thats fine
I have a link ( Next>> in the same JSp page. The user can either click on Submit button or on this link to go second page. So, when I click on the Link , it shoudl do teh same process, whatever teh submit button is doing..
means, it should submit teh form, validate the data with validaton framewor, and call teh action class, and insert the data..
I tried with java ascrtipt , but its not weorking peoperly.. Canany throwe some light on this..

sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
Click of a link is not equivalent to submitting a button. When you click a submit button, the request gets sent to the RP as a submit request and the RP knows that if validation is turned on, it should run thru the Validation fwk and take the necc steps but when you click on a link, all the RP does is to forward it to the right action. I am sure that upon the click of the link, the Action is getting called, just that the step of the validation fwk is getting skipped.
If you really wanna use the link to submit the form, what you should do is call the submit method of the form on the onclick event of the link. That will solve all problems for you.

I agree. Here's the link:
subject: Subit the form with html:link
It's not a secret anymore!