File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes trying to submit a form using hyperlink (href) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "trying to submit a form using hyperlink (href)" Watch "trying to submit a form using hyperlink (href)" New topic
Author

trying to submit a form using hyperlink (href)

Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
Hi, am not being successful in submitting values of a radio button after clicking a link with the help of JavaScript

parts of jsp code


The <a href> part (link) does two things ...
1. Submits the 4 params to the action class
2. Attempts to submit the form (which has a selected radio button) using the following JavaScript


postId is a property of the form bean (searchForm) accessible to this JSP, and i have postId set as a hidden property

In my action class, form.getPostId() is always 0 ... ???
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
You missed a semi-colon [;] in line number 09.
Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
Dawn Charangat wrote:You missed a semi-colon [;] in line number 09.


Thought that was optional in Javascript ???
Lei Guoguo
Greenhorn

Joined: Mar 31, 2009
Posts: 26

you can debug like this:


I'm a chinese, my english is so bad, I need help. If you want to help me, you can send your question to my e-mail: lgg860911@yahoo.com.cn, I will help you, and improve my english. Thanks everyone.
Songezo Nkukwana
Ranch Hand

Joined: Nov 27, 2008
Posts: 51
But i don't have issues with the debugging, issue is getting the value set to postId within the action class or the actual form bean.. seems to be always 0. But after this line on JavaScript

there value is set successfully alert shows a non 0 value
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trying to submit a form using hyperlink (href)