reset password
Author Message
abhishek_sharma
Posts: 79
Posted 10:08 May 07, 2009 |

If I am not wrong formBackingObject forward us to the mapped .JSP, do we need to set any attribute for an object or just return that object in order to print the values of tht object ?

Because

System.out.println(blogentry.getBlog().getIntBlogId()) is giving me the desire output but

${blogentry.blog.intBlogId} is neither printing/giving any value nor even an error 

 

Attachments:
Last edited by abhishek_sharma at 10:11 May 07, 2009.
cysun
Posts: 2935
Posted 11:21 May 07, 2009 |

This is roughly how a SimpleFormController works:

  1. formBackingObject creates a command object.
  2. The formView is displayed.
  3. The user enters information and submits form.
  4. The command object properties are set to the request parameter values if the property name matches the parameter name.
  5. A validator (optional) examines the command object. If validation fails, the formView is displayed again; if validation succeeds, the onSubmit() method of the controller is called.
  6. The command object is processed in the onSubmit() method.

The formBackingObject() in SimpleFormController will create a command object by calling the default constructor (i.e. the constructor with no argument) of the command class. If that's enough, you do not need to overrride formBackingObject(). Sometimes you want to use a different constructor or initialize some fields that are not initialized in the default constructor. In those cases you need to override formBackingObject() in your controller. See csns.spring.controller.forum.CreateTopicController for example.

I don't quite get why you want to print out the command object.