0

I am a Spring beginner and was recently looking at this tutorial http://www.mkyong.com/spring-mvc/spring-mvc-form-handling-annotation-example/

(There's a download link at the bottom of the page and with a quick maven install you should be able to run the project very easily.)

I noticed that when I pressed the submit button on the 1st page and it goes to the 2nd page, the URL stays the same. Now, I modified the 2nd page to have its own form. Unfortunately, because the URL is still the same on the 2nd page, Spring picks the controller for the 1st page when I click the 2nd page's submit button. Why does this happen and how can I override this behavior?

Apologies if I am not being clear enough. Feel free to ask for certain clarification.

Thanks for your time Regards Steve

EDIT : My 2nd page's form looks like this

<form:form method="POST" commandName="step2">

    <table width="800" align="center"
        style="border-width: 5px; border-style: solid; border-color: gray;">
        <caption>
            <b>STEP 2</b>
        </caption>
        <tr>
            <td></td>
            <td colspan="3"><input type="submit" value="Submit Page 2"
                cssClass="field" /></td>
        </tr>
    </table>
</form:form>
4

1 回答 1

0

如果您希望在使用 Page2 url 从 Page1 导航到 Page2 时更新 url。然后在服务器端使用重定向而不是转发。我不是你在 Spring MVC 中的做法,你可能想查看 Spring MVC 参考手册。

于 2013-04-08T10:13:02.573 回答