Results 1 to 2 of 2

Thread: binding Date property in MultiActionController

  1. #1
    Join Date
    Aug 2005
    Posts
    8

    Default binding Date property in MultiActionController

    I have a multiactioncontroller in which I have registered a CustomDateEditor. In my command class I have a Date property. When I input a valid date in my form it is converted to a Date and bound to the corresponding property in the command class. However, if I input an invalid date value (such as 'aaa') I get a BindException. In the JBoss log I see that a TypeMismatch has occurred, which makes sense of course. But how to handle the BindException? I thought that Spring handled that automatically by showing the input form agian with a corresponding error message. All I get now is stack trace. Am I missing something?

  2. #2
    Join Date
    Aug 2005
    Posts
    8

    Default

    I got it working now. I have overriden the bind-method of the MultiActionController, catching ServletRequestBindingExceptions and doing nothing with them:

    Code:
    	protected void bind(ServletRequest request, Object command) throws Exception
    	{
    		try
    		{
    			super.bind(request, command);
    		}
    		catch (ServletRequestBindingException e)
    		{
    			logger.info("Caught ServletRequestBindingException");
    		}
    	}
    The binderror is part of the Errors object with code TypeMismatch and can be shown on the form.

    Is this the only way to handle this with an MultiActionController?

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  5. Replies: 2
    Last Post: May 13th, 2005, 05:42 AM

Posting Permissions

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