Spring MVC JSP表单未预填充(或刚刚返回)

Spring MVC JSP表单未预填充(或刚刚返回),spring,jsp,spring-mvc,Spring,Jsp,Spring Mvc,我对SpringMVC(以及前端)是新手。我有一个带有表单的jsp。在控制器的GET方法中,我将命令添加到ModelMap。该页面进行了一些验证(单击复选框时显示为灰色,等等)。然后我进入下一页。假定用户能够单击后退按钮(显然,出于图形原因,该按钮连接在标签中),然后对其表单进行更改。除了…表格是空的 <input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amo

我对SpringMVC(以及前端)是新手。我有一个带有表单的jsp。在控制器的GET方法中,我将命令添加到ModelMap。该页面进行了一些验证(单击复选框时显示为灰色,等等)。然后我进入下一页。假定用户能够单击后退按钮(显然,出于图形原因,该按钮连接在标签中),然后对其表单进行更改。除了…表格是空的

<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
因此,我的主要问题是:返回(my.do)并保留表单中所有值的最佳方法是什么?在我的GET方法上运行了一些东西…所以这仍然需要发生

<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
我尝试的是:我在某处读到命令应该预先填充表单?所以我准备好了一个命令,我用它来获取信息……这就是我所做的(但它不起作用)。(我已调试,命令中填充了这些值)

<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
setSessionAttribute(aHttpServletRequest,“goalDetailCommand”,goalDetailCommand); //然后做一些重定向

@RequestMapping(method = RequestMethod.GET)
public String show(ModelMap model, HttpServletRequest aHttpServletRequest, @ModelAttribute MyCommand myCommand) throws Exception {
    myCommand = (MyCommand)WebUtils.getSessionAttribute(aHttpServletRequest, "myCommand");
    model.addAttribute("myCommand", myCommand);
<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
谢谢

<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
编辑: 我没有加入路径部分。添加了它,但仍然没有运气。还有什么不对劲吗

<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">

我进行了调试,命令中填充了这些值

<form class="form-horizontal" commandName="myCommand" name="formdetail" id="formdetail" method="post">
<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
其工作原理与预期一样,只需在表单中引用command对象的值/字段,如果command对象具有getTitle,请执行以下操作:

<input type="text" class="amount input-medium" path= "amountToSave" id="amountToSave" name="amountToSave" placeholder="0000.00">
<form:input path="title" maxlength="90" id="title"/>

我在问题中添加了编辑。尝试了上述操作…但不确定是否有其他问题:(