Announcement Announcement Module
No announcement yet.
binding Date property in MultiActionController Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I got it working now. I have overriden the bind-method of the MultiActionController, catching ServletRequestBindingExceptions and doing nothing with them:

    	protected void bind(ServletRequest request, Object command) throws Exception
    			super.bind(request, command);
    		catch (ServletRequestBindingException e)
    		{"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?