Announcement Announcement Module
No announcement yet.
SimpleFormController - command object has no data Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleFormController - command object has no data

    I am using spring's SimpleFormController and html form tags in the view html.
    I don't get any data in command object of the onsubmit method of my controller.

    If I try to do request.getParameter(anyFormfieldname) I see that the values are there but don't know why the commad object does not have this data ? Am I missing something ?

    here's my configuration -

    <entry key="/**/">
    <ref local="MyController"/>

    <bean id="MyController" class="com.MyController">
    <property name="dataService">
    <ref bean="myDataService"/></property>
    <property name= "commandClass">
    <property name="commandName" value="myForm"/>
    <property name="successView"><value>MyViewInfo</value></property>

    Here's the view --

    <form id="myForm" name="myForm" action="" method="post">
    FirstName :<input type="text" name="myForm.firstName" value="AAA"/>
    LastName :<input type="text" name="myForm.lastName" value="BBB"/>
    <input type="submit" name="myForm.submitButton" id="myForm.submitButton" value="submit" />

    my controller overrides the onSubmit method -

    public class TestController extends SimpleFormController {
    protected ModelAndView onSubmit(HttpServletRequest request,
    HttpServletResponse response,
    Object commandObject, BindException exception) {


  • #2
    You need to bind the field with the domain object properties. You'll need to do this by adding the Spring form tags to your jsp-page. See documentation and examples.


    • #3
      Thanks for you reply.
      I am not using JSPs, I am using HTML and velocity. Is there a way I can get it working with html form tags ?


      • #4
        Don't know about velocity except what it's for...