This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Form submission problem in some browsers, using struts tag in form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Form submission problem in some browsers, using struts tag in form" Watch "Form submission problem in some browsers, using struts tag in form" New topic
Author

Form submission problem in some browsers, using struts tag in form

Priyanshu Chauhan
Greenhorn

Joined: Jul 24, 2012
Posts: 9
Hi, I'm using struts tag in my JSP page for form submission. I'm using two images for boolean input from the user (image names are YES and NO).
So there is no submit button in the page because the form get submitted as soon as user clicks any of the two images.
This JSP page is only working properly in the Google Chrome whereas Clicking the images 'Yes' or 'No' on Mozilla,IE etc form doesn't get submitted to the Structs action (hence no change in my database).

Here is the JSP:




jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Priyanshu,

How it automatically submits the form once you click on the image? Are you using any script to submit the form?


Regards
Jatan
Priyanshu Chauhan
Greenhorn

Joined: Jul 24, 2012
Posts: 9
the struts tag <h: image> itself act as the submit button.
So no script is required for autosubmission of form.

And i found the answer myself.
since the <h: image> act as a image version of submit button therefore i use two <h: form> and the property in hidden form tag
i.e <h: hidden property=" ">

I don't know if this the best way to submit form using images but this is working for me.





<h:form action="/VoteAction" method="post">
<h: hidden property= "vote" value="true">
<h:image "images/logo/yes.png"></h:image>
</h:form>

<h:form action="/VoteAction" method="post">
<h: hidden property= "vote" value="false">
<h:image "images/logo/NO.png"></h:image>
</h:form>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form submission problem in some browsers, using struts tag in form
 
Similar Threads
Collections and Struts...
Display an image when the request is processing
Multiple image buttons on a Struts Form
JSP form submission with drop-down menu in Struts 1.3
Struts upload not working