Announcement Announcement Module
Collapse
No announcement yet.
Velocity Binding Examples Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Velocity Binding Examples

    Hi,
    I'm wondering if someone can provide me with some examples of how to do form binding and validation using velocity.

    Thanks.

  • #2
    there's info on form binding in the ref docs at http://www.springframework.org/docs/...velocity-forms

    Is there something specific you need?

    Regards,

    Comment


    • #3
      Yes, that's what I'm reading, but I'm getting this error, and I don't know how my classes should be set up.

      Code:
      avax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'loginFormController' defined in resource
      [/WEB-INF/subt-servlet.xml] of ServletContext: Error setting
      property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException:
      PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions
      are: [org.springframework.beans.TypeMismatchException: Failed to convert
      property value of type [java.lang.String] to required type [java.lang.Class]
      for property 'commandClass'; nested exception is java.lang.IllegalArgumentException:
      Invalid class name: com.me.domain.Login]
      	at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:598)
      	at com.caucho.server.dispatch.ServletManager.init(ServletManager.java:153)
      	at com.caucho.server.webapp.Application.start(Application.java:1535)
      	at com.caucho.server.deploy.Entry.startImpl(Entry.java:469)
      	at com.caucho.server.webapp.WebAppEntry.startImpl(WebAppEntry.java:94)
      	at com.caucho.server.deploy.Entry.redeployIfModifiedImpl(Entry.java:428)
      	at com.caucho.server.webapp.WebAppEntry.redeployIfModifiedImpl(WebAppEntry.java:94)
      	at com.caucho.server.deploy.Entry.handleAlarm(Entry.java:535)
      	at com.caucho.util.Alarm.handleAlarm(Alarm.java:323)
      	at com.caucho.util.Alarm.run(Alarm.java:293)
      	at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:464)
      	at com.caucho.util.ThreadPool.run(ThreadPool.java:408)
      	at java.lang.Thread.run(Thread.java:595)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error
      [/quote]

      Comment


      • #4
        at the moment your Controller is failing to be instantiated because you're trying to set a String property where a java.lang.Class is required as shown by the message;

        Code:
        Failed to convert
        property value of type [java.lang.String] to required type [java.lang.Class]
        for property 'commandClass'
        Try setting the command class in your controller's constructor instead:
        Code:
        public LoginFormController() {
          setCommandClass(com.me.domain.Login.class);
        }
        alternatively, override formBackingObject() in your controller to provide a new or pre-populated command object for the form..

        Regards,

        Comment

        Working...
        X