java - Why is my post not give data to my controller from my form? -


i developing sprin mvc application , have form containing table in 1 of ui jsp's, (welcome.jsp) , when submit button clicked, trying print out data in form web applications console.from there intend parse checkboxes selected , have controller send 'selected' data databased updated next status in applications flow.

so far form 'successfully' posting in no error or exceptions being thrown, printed statement in console blank makes me think no data being sent, , welcome fix this.

here setup of have, not actual code rough set of elements , methods.

welcome.jsp:

   <form action="<c:url value="/postpage" />"method="post" modelattribute="rtable">        <br/>        <table>            <thead>                <tr>                    <th>title1</th>                    <th>title2</th>                    <th>title3</th>                    <th><select>                         <option>option1</option>                         <option>option2</option>                    </select></th>                  </tr>            </thead>            <tbody>                <tr>                    <td>value1</td>                    <td>value1</td>                    <td>value1</td>                    <td><input type="checkbox" value="row_data_id" /></td>                </tr>            </tbody>            <tfoot>                <tr><td colspan="4"></td>            </tfoot>         </table>         <br/>     </form> 

my controller has following method in necessary libraries imported:

controller.java

    @requestmapping(value="/postpage", method = requestmethod.post)     public string processupdate(@modelattribute("rtable") string table, modelmap model) {         system.out.println(table);         return "postpage";      } 

the console line print this:

    .     .     .     [3/19/14 16:36:53:625 edt] 0000006a systemout     o      .     .     . 

does know why not printing anything? not sending controller?

after deal of reading , trial , error found answer. explain in terms spring framework forms. in order pass data through form front-end end, first every input need tied form using spring form jstl tag

ex.

form => form:form

input=> form:input

in form:form isn;t necessary should have modelattribute linked java class, in each input need path attribute linked variable in modelattribute class , value assign variable. on submit values linked end via getters , setters on java class used in back-end. hope explained clearly.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -