title: changing spring jsp date input bind in a form to use freemarker
body: <p>I´m trying to change a spring jsp example to use freemarker. </p>
  
  <p>I changed all fields in a form with something like this:
  &lt;@spring.formInput "account.name" /></p>
  
  <p>Everything worked nicely. Form binded to the object and everything was validated, but I can`t get this part to work.</p>
  
  <p>&lt;@spring.formInput "account.renewalDate" />
  In jsp it was
  </p>
  
  <p>renewalDate is a java.util.Date object. The page opens and the error starts where the date input field should be.</p>
  
  <blockquote>
    <p>Method public
    org.springframework.web.servlet.support.BindStatus
    org.springframework.web.servlet.support.RequestContext.getBindStatus(java.lang.String)
    throws java.lang.IllegalStateException
    threw an exception when invoked on
    org.springframework.web.servlet.support.RequestContext@1b5c22f
    with arguments of types
    [java.lang.String,] The problematic
    instruction: ---------- ==>
    assignment:
    status=springMacroRequestContext.getBindStatus(path)
    [on line 120, column 9 in spring.ftl]
    in user-directive bind [on line 159,
    column 5 in spring.ftl] in
    user-directive spring.formInput [on
    line 36, column 41 in createForm.ftl]
    ---------- Java backtrace for programmers: ----------
    freemarker.template.TemplateModelException:
    Method public
    org.springframework.web.servlet.support.BindStatus
    org.springframework.web.servlet.support.RequestContext.getBindStatus(java.lang.String)
    throws java.lang.IllegalStateException
    threw an exception when invoked on
    org.springframework.web.servlet.support.RequestContext@1b5c22f
    with arguments of types
    [java.lang.String,] at
    freemarker.ext.beans.OverloadedMethodModel.exec(OverloadedMethodModel.java:134)
    at
    freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
    at
    freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
    at
    freemarker.core.Assignment.accept(Assignment.java:90)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.IfBlock.accept(IfBlock.java:82)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.Macro$Context.runMacro(Macro.java:172)
    at
    freemarker.core.Environment.visit(Environment.java:603)
    at
    freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.Macro$Context.runMacro(Macro.java:172)
    at
    freemarker.core.Environment.visit(Environment.java:603)
    at
    freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.MixedContent.accept(MixedContent.java:92)
    at
    freemarker.core.Environment.visit(Environment.java:210)
    at
    freemarker.core.Environment.process(Environment.java:190)
    at
    freemarker.template.Template.process(Template.java:237)
    at
    org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:366)
    at
    org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:283)
    at
    org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:233)
    at
    org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167)
    at
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    at
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
    at
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
    at
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    at
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    at
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at
    org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:530)
    at
    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:427)
    at
    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    at
    org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:494)
    at
    org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:182)
    at
    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:933)
    at
    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:362)
    at
    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867)
    at
    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at
    org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
    at
    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
    at
    org.eclipse.jetty.server.Server.handle(Server.java:330)
    at
    org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559)
    at
    org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:992)
    at
    org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:541)
    at
    org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:203)
    at
    org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406)
    at
    org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462)
    at
    org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
    at java.lang.Thread.run(Unknown
    Source) Caused by:
    org.springframework.core.convert.ConversionFailedException:
    Unable to convert value Sat Mar 05
    15:49:22 EET 2011 from type
    'java.util.Date' to type
    'java.lang.String'; nested exception
    is java.lang.IllegalStateException:
    JodaTime library not available -
    @DateTimeFormat not supported at
    org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40)
    at
    org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:138)
    at
    org.springframework.validation.AbstractPropertyBindingResult.formatFieldValue(AbstractPropertyBindingResult.java:122)
    at
    org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:227)
    at
    org.springframework.web.servlet.support.BindStatus.(BindStatus.java:120)
    at
    org.springframework.web.servlet.support.RequestContext.getBindStatus(RequestContext.java:726)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method) at
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
    Source) at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
    Source) at
    java.lang.reflect.Method.invoke(Unknown
    Source) at
    freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:840)
    at
    freemarker.ext.beans.OverloadedMethodModel.exec(OverloadedMethodModel.java:104)
    ... 54 more Caused by:
    java.lang.IllegalStateException:
    JodaTime library not available -
    @DateTimeFormat not supported at
    org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory.getPrinter(FormattingConversionServiceFactoryBean.java:131)
    at
    org.springframework.format.support.FormattingConversionServiceFactoryBean$NoJodaDateTimeFormatAnnotationFormatterFactory.getPrinter(FormattingConversionServiceFactoryBean.java:1)
    at
    org.springframework.format.support.FormattingConversionService$1.convert(FormattingConversionService.java:78)
    at
    org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:37)
    ... 65 more</p>
  </blockquote>