2016-04-20 11 views
0

私はデータがデータベースからポールレートであるテーブルを持っています。私はText1、Text2に値を与えてテーブルを更新し、コントローラに送信します。私はこれをします。私はこれを行うことができますどのように理解していないので、ここでSubmitボタンをクリックした後にコントローラにテーブルデータを送信する方法

HTML

<form action="/update" method="post" > 
     <table border="1"> 
      <thead> 
       <tr> 
        <th data-field="id"> ID </th> 
        <th data-field="details"> Details </th> 
        <th data-field="report"> Report </th> 
        <th data-field="value"> value </th> 
        <th data-field="destination"> Destination </th> 
       </tr> 
      </thead> 
      <c:forEach items="${List2}" var="as"> 
      <tr > 
       <td>${as.id}</td> 
       <td>${as.rulDetails}</td> 
       <td>${as.rulName}</td> 
       <td><input type="text" name ="Text1"> 
       <td>${as.rulValue}</td> 
       <td><input type="text" name ="Text2"> 
       </td> 
      </tr>       
      </c:forEach>  
</table> 
      <input type="submit" value="Update"></input> 

は、更新テーブルのための私のサーブレットですが、私は何も書き込まdid't。

@RequestMapping(value = "/update", method = RequestMethod.POST) 
public String update(@ModelAttribute("SpringWeb") AssignmentDetails asd ModelMap model) { 

     //what i should write here..? 


    return "hello"; 
} 

どうすればいいですか?私は何を修正する必要がありますか?私に助言を与えるか、これを行うのを助けてください。

答えて

0

thisチュートリアルを参照してください、ありがとうございました。

springタグライブラリを使用できます。

<form:form method="post" modelAttribute="SpringWeb" action="/update"> 
    <form:input path="Text1" type="text" /> 
    <form:input path="Text2" type="text" /> 
</form:form> 
関連する問題