Spring Form: Submitting extra parameter on submit buttons
I am working on a form with a bunch of selection criteria that will generate a report when the form is submitted. I also have a number of different reports that can be generated form this same criteria, an开发者_开发知识库d want the type of report to be selectable by using a tab system where each tab clicked on submits the form and generates the correct report. I was to do this by passing an extra parameter into the form to switch onto the right form type
I am new to Spring, and from the guidance of an elder was told to use an input button for each tab with the following approximate syntax:
<input type="submit" name="${form.selectionValues.tabSelection}" value="1" />
tabSelection form property of the SelectionValues object is not being set. I wasn't surprised ;) DIdn't think this would work.
So I am wondering how can I can submit a post back from a button in Spring containing the form values plus an extra tabSelection parameter and value? How should I mark up this mechanism? Will I have to do anything to the form controller to register this extra parameter?
The original markup I was using to build this page, was using HTML anchor tags instead of buttons for the tab links, which would be much better for the CSS, is there any way to trigger a full form submit using an anchor href? I know this will be a GET request instead of a POST, and not associated with the form.. so I dont expect this to work.. just trying to think of solutions! I would prefer to use the priginal markup, as the styles are there.
Any help would be appreciated
if the spring form tag is used like this, an example is working as the following:
<form:form commandName="someCommand">
...
<input type="submit" name="${someCommand.selectionValues.tabSelection}" value="1"/>
</form:form>
${}
is not a binding field, so you need to use the command object as a regular model object.
精彩评论