0

我一直在努力解决以下错误。

java.lang.IllegalArgumentException: The field type is required

我有一个设置了 3 个屏幕的基本屏幕流程。

  • 屏幕一:身份

  • 屏幕二:联系方式

  • 屏幕 3:摘要

在屏幕 1 中,我输入如下文本字段:

<form:form modelAttribute="booking" action="${flowExecutionUrl}" method="post">
     User Name: 
     <form:input type="text" id="username" name="username" path="username"/>
     <input type="submit" name="_eventId_next" value="next" />
     <input type="submit" name="_eventId_cancel" value="Cancel" />
</form:form>

这在它到达摘要时有效,因为我能够在摘要屏幕上显示 ${booking.username} 的内容。

但是在屏幕 2 上,当我尝试完全相同的事情但使用不同的数据字段时,会出现上面指定的错误。

屏幕 2:

<form:form modelAttribute="booking" action="${flowExecutionUrl}" method="post">
     Address 1:
     <form:input type="text" id="address1" name="address1" path="address1"/>
     <input type="submit" name="_eventId_next" value="Next"/>
     <input type="submit" name="_eventId_cancel" value="Cancel"/>
</form:form>

表单标签指定如下:

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

大部分代码可以在我之前的问题上查看:

完整代码

当我尝试将表单标签添加到选项下拉框字段时,也会发生同样的错误。

<form:select id="requestType" name="requestType" path="requestType">
    <form:option value="0"></option> 
    <form:option value="1">Oprion 1</option>
    <form:option value="2">Option 2</option>
</form:select> 

而不是选项标签我也试过

<form:input type="text" label="" value="0"/>

都提出了相同的错误,将这些行作为错误。

谢谢你。

编辑:

堆栈跟踪:异常

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'enterContactDetails' of flow 'flow-config'
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'enterContactDetails' of flow 'flow-config'
    org.springframework.webflow.engine.impl.FlowExecutionImpl.wrap(FlowExecutionImpl.java:571)
    org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:262)
    org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
    org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
    org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

java.lang.IllegalStateException: Exception occurred rendering view org.springframework.web.servlet.view.JstlView: name 'account/BookingContactDetailsScreen'; URL [/WEB-INF/views/account/BookingContactDetailsScreen.jsp]
    org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:191)
    org.springframework.webflow.engine.ViewState.render(ViewState.java:296)
    org.springframework.webflow.engine.ViewState.refresh(ViewState.java:243)
    org.springframework.webflow.engine.ViewState.resume(ViewState.java:221)
    org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258)
    org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
    org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
    org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

org.apache.jasper.JasperException: java.lang.IllegalArgumentException: The field type is required
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:50)
    org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:187)
    org.springframework.webflow.engine.ViewState.render(ViewState.java:296)
    org.springframework.webflow.engine.ViewState.refresh(ViewState.java:243)
    org.springframework.webflow.engine.ViewState.resume(ViewState.java:221)
    org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258)
    org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
    org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
    org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

java.lang.IllegalArgumentException: The field type is required
    org.springframework.util.Assert.notNull(Assert.java:112)
    org.springframework.webflow.mvc.view.ConvertingPropertyEditorAdapter.<init>(ConvertingPropertyEditorAdapter.java:48)
    org.springframework.webflow.mvc.view.BindingModel.findSpringConvertingPropertyEditor(BindingModel.java:277)
    org.springframework.webflow.mvc.view.BindingModel.getFormattedValue(BindingModel.java:235)
    org.springframework.webflow.mvc.view.BindingModel.getFieldValue(BindingModel.java:142)
    org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:127)
    org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
    org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)
    org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    org.apache.jsp.WEB_002dINF.views.account.BookingContactDetailsScreen_jsp._jspx_meth_form_005finput_005f0(BookingContactDetailsScreen_jsp.java:230)
    org.apache.jsp.WEB_002dINF.views.account.BookingContactDetailsScreen_jsp._jspx_meth_form_005fform_005f0(BookingContactDetailsScreen_jsp.java:127)
    org.apache.jsp.WEB_002dINF.views.account.BookingContactDetailsScreen_jsp._jspService(BookingContactDetailsScreen_jsp.java:85)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:50)
    org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:187)
    org.springframework.webflow.engine.ViewState.render(ViewState.java:296)
    org.springframework.webflow.engine.ViewState.refresh(ViewState.java:243)
    org.springframework.webflow.engine.ViewState.resume(ViewState.java:221)
    org.springframework.webflow.engine.Flow.resume(Flow.java:545)
    org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258)
    org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
    org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
    org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
    org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
4

1 回答 1

-1

You do not need to provide form action. You should have your form opening tag look like sample below:

<form:form method="POST" modelAttribute="booking">
于 2017-10-21T19:05:24.140 回答