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

Struts Form is not getting Submitted

shiva shanker

Joined: Sep 02, 2007
Posts: 3
Im trying to submit a form using a image button.

Below are the snippets of struts config and the code for html image submit button.I have included the get and setsave code.

Struts Config:
type="com.yourcompany.struts.action.MnSeaLvlPressureAction" >
<forward name="report" path="/MnSeaLvlPressureout.jsp" />
<forward name="output" path="/MnSeaLvlPressureIn.jsp" />

HTML code:
<%String goImage = renderRequest.getContextPath() + "/crystalreportviewers115/images/toolbar/ed_gl_ls_go.gif" ;%>
<tr><td colspan="2" align="center"><html:image property="save" src='<%= goImage %>' onclik="return fnsubmit();" value="View" ></html:image></td></tr>

Form code:

private ImageButtonBean save = new ImageButtonBean();

public ImageButtonBean getSave() {
return save;
public void setSave(ImageButtonBean button) {
System.out.println("calling the setSave method"); = button;

public String getval(){
System.out.println("save is "+getSave());
System.out.println("save = getSave()" + (save.equals(getSave())));
System.out.println("X value = " + getSave().getX() + "; Y value = " + getSave().getY());
System.out.println("Get Selected in Form"+getSave().isSelected());
if (getSave().isSelected())
{ return "save";
return "False";

public String getStationcode() {
return stationcode;

when i tried to print the getSave().getX() and getSave().getY() sometimes it's printing null and sometimes its printing integer, its not consistent.

Hope you can guys can help me out..

Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
onclik -> onclick ??
shiva shanker

Joined: Sep 02, 2007
Posts: 3
its onclick. Was not able to post in this forum as onclick, So,have had to change.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Your code will cause a double submit to occur. An html:image tag is already a submit button, so you don't need to put a submit in the onclick event to make the submit occur. That's why you're getting strange results: For the submit caused by the button itself, there will be a value in x and y. For the submit caused by the onclick event, these values will be null.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Struts Form is not getting Submitted
It's not a secret anymore!