Announcement Announcement Module
No announcement yet.
newbie - help with springapp-servlet Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • newbie - help with springapp-servlet

    i have a page to be displayed which contains 1-2 lines of dynamic data. i have a controller containing a model which passes the data to the page at runtime. i have registered the controller and the page in the springapp-servlet.xml. its just a display page with no user interaction. when i try to load the page, i get an error saying

    " Cannot create command without commandClass being set - either set commandClass or override formBackingObject "

    can someone pl help me with this?
    thank you

  • #2
    Sounds like you are using one of the command controllers. This is perfectly fine but if you have a web page that doesn't use a form, you are better off extending org.springframework.web.servlet.mvc.AbstractContro ller which doesn't require a command object.

    If you are using a form, then that commandClass is going to be the object in which you wish to bind. Then you would use the Spring Tag libraray to bind the object to form tags (<input>, <textarea>, etc). You can either specify this class in your *-servlet.xml file or you can do what is says and override formBackingObject and create an instance there.

    If you are just starting out with Spring, I would work with the AbstractController first to get the hang of using the MVC framework first; get some pages going with some dynamic data and then move on to form processing. Also refer to the documentation and the sample web applications as they can be very helpful for someone just starting out.



    • #3
      thank you that'll help