0

我正在尝试创建一个显示下拉列表的页面,但是一旦添加了下拉代码,我的系统就无法工作。我一直试图让这个工作一段时间。有人可以帮助我并告诉我我得到了什么错误

这是我的 JSP:

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>School Visit Report</TITLE>
</HEAD>
<BODY>
<H1 align=left>UFT SCHOOL VISIT REPORT</H1>
<form:form commandName="visit">

<form:select path="reporter" items="${selectableReports}" />

</form:form>
</BODY>
</HTML>

这是我的流程:

<on-start>
<evaluate expression="flowActions.initializeSelectableReport s()" 
result="flowScope.selectableReports" />
</on-start>


<view-state id="SchoolVisitReport" view="SchoolVisitReportSmall.jsp">

<transition on="submit" to="endState" />
<transition on="cancel" to="endState" bind="false"/>
</view-state>

这是我的错误:

org.springframework.web.util.NestedServletExceptio n: Request processing failed; nested exception is org.springframework.webflow.execution.FlowExecutio nException: Exception thrown in state 'SchoolVisitReport' of flow 'visit'
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:894)
org.springframework.web.servlet.FrameworkServlet.d oGet(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.FlowExecutio nException: Exception thrown in state 'SchoolVisitReport' of flow 'visit'
org.springframework.webflow.engine.impl.FlowExecut ionImpl.wrap(FlowExecutionImpl.java:571)
org.springframework.webflow.engine.impl.FlowExecut ionImpl.resume(FlowExecutionImpl.java:262)
org.springframework.webflow.executor.FlowExecutorI mpl.resumeExecution(FlowExecutorImpl.java:169)
org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(FlowHandlerAdapter.java:183)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.d oGet(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: unnamed; URL [/WEB-INF/flows/visit/SchoolVisitReportSmall.jsp]
org.springframework.webflow.mvc.view.AbstractMvcVi ew.render(AbstractMvcView.java:191)
org.springframework.webflow.engine.ViewState.rende r(ViewState.java:296)
org.springframework.webflow.engine.ViewState.refre sh(ViewState.java:243)
org.springframework.webflow.engine.ViewState.resum e(ViewState.java:221)
org.springframework.webflow.engine.Flow.resume(Flo w.java:545)
org.springframework.webflow.engine.impl.FlowExecut ionImpl.resume(FlowExecutionImpl.java:258)
org.springframework.webflow.executor.FlowExecutorI mpl.resumeExecution(FlowExecutorImpl.java:169)
org.springframework.webflow.mvc.servlet.FlowHandle rAdapter.handle(FlowHandlerAdapter.java:183)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.d oGet(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: An exception occurred processing JSP page /WEB-INF/flows/visit/SchoolVisitReportSmall.jsp at line 15

12: <H1 align=left>UFT SCHOOL VISIT REPORT</H1>
13: <form:form commandName="visit">
14: 
15: <form:select path="reporter" items="${selectableReports}" />
16: 
17: </form:form>
18: </BODY>
4

1 回答 1

2

您可能需要model在视图状态声明中包含 。

<view-state id="SchoolVisitReport" view="SchoolVisitReportSmall.jsp" model="visit">

<transition on="submit" to="endState" />
<transition on="cancel" to="endState" bind="false"/>
</view-state>

注意模型属性。此外,您必须确保声明visit模型。

现在来看看为什么。您错过了一条重要的错误消息,解释了渲染失败的原因。我打赌您会收到一条错误消息,指出command/modelAttribute在您的请求范围内未找到。这将通过model属性来实现。

于 2012-08-27T15:26:14.170 回答