Results 1 to 4 of 4

Thread: Velocity Binding Examples

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    Sydney
    Posts
    27

    Default 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. #2
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    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,
    Darren Davison.
    Public Key: 0xE855B3EA

  3. #3
    Join Date
    Sep 2004
    Location
    Sydney
    Posts
    27

    Default

    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]

  4. #4
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    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,
    Darren Davison.
    Public Key: 0xE855B3EA

Similar Threads

  1. Replies: 4
    Last Post: Oct 26th, 2009, 08:58 AM
  2. Replies: 7
    Last Post: Sep 13th, 2005, 01:45 AM
  3. FreeMarker vs Velocity
    By Martin Kersten in forum Architecture
    Replies: 8
    Last Post: May 30th, 2005, 09:21 AM
  4. Velocity OutOfMemoryError during UnitTests
    By camach in forum Container
    Replies: 2
    Last Post: May 26th, 2005, 05:28 PM
  5. Replies: 2
    Last Post: Aug 17th, 2004, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •