I am currently utilizing the Struts2 framework in my application, and I have a button on my JSP page. Here is the code for the button:
<s:submit type="button" name="btnSave" />
However, I want this button to act like a normal HTML button, meaning it should not submit the form but instead execute a scripting function on the onclick
event. This function will then submit the form using Ajax.
The issue I am facing is that Struts2 converts it to:
<input type="submit" id="add_btnSave" name="btnSave" value="Save"/>
This results in my form being submitted.
1) Using the HTML button tag will disrupt the GUI as the theme of my form is Ajax-based.
Within the head
tag, there is a script:
My body
tag is structured as follows:
If anyone has any ideas on how to handle this situation with Struts2, your assistance would be greatly appreciated.
Thank you in advance.