开发者

Custom "Next" Buttons for Spring MVC AbstractWizardFormController

开发者 https://www.devze.com 2023-01-17 13:06 出处:网络
Currently, a spring application I am working on has several wizards that it is using with Spring\'s AbstractWizardFormController. During the early stages of development(pre-design phase), the type of

Currently, a spring application I am working on has several wizards that it is using with Spring's AbstractWizardFormController. During the early stages of development(pre-design phase), the type of "next" button did not matter.

Just to refresh, the Next and Back button are submit buttons with target attributes. So a next button on the first page of a wizard would look like the following.

<input type="submit" name="_target1" value="Next"/>

This is the standard way Spring does wizards on the view. This works fine, given that you want your Next button to be a standard HTML submit button. Otherwise, in my case, If I want a custom button, I am not sure how to do this. I know it is possible, but haven't found any documentation.

I imagine I will need to do a javascript subm开发者_如何学Pythonit, but I am not sure how to set the name of the button, of if something else needs to be done.

I just need to know how I can still extend AbstractWizardFormController, and use custom buttons.


When clicked, HTML submit button submits a form with additional parameter {name}={value}, that is _target1=Next. I guess the value doesn't matter here, controller looks at the name. So, if you want to emulate this with Javascript, you may, for example, dynamically add a hidden field with name = "_target1" before submit.

0

精彩评论

暂无评论...
验证码 换一张
取 消