2014-11-01 21 views
0

应用程序:Spring MVC,Hibernate,JSP修改表单。传递id作为隐藏值

查询:在修改表单时,我传递了预填充的RECIPE对象,但id列返回为NULL。

食谱类只有2列 - ID和NAME;

JSP页面

<body> 
    <s:url value="/recipe/modify" var="recipe_modify" /> 
    <h2> 
     Modify 
     <c:out value="${fn:toUpperCase(recipe.name)}" /> 
    </h2> 
    <sf:form modelAttribute="recipe" method="POST" 
     action="${recipe_modify}"> 
     <fieldset> 
      <table> 
       <tr> 
        <th><sf:label path="name">Name of Recipe</sf:label></th> 
       </tr> 
       <tr> 
        <td><sf:input path="name" size="30" /> <br /> <sf:errors 
          path="name" cssClass="error"></sf:errors><br /></td> 
       </tr> 

当JSP提交以下是获取传递到Spring 信息2014年11月1日22:21:32342 com.recipe.mvc.RecipeController - 从JSP [食谱[id = null,name = sandwich]

为什么id不能通过这里?

回答