I'm running Spring 3.0 GA and Webflow 2.0.8... I have spring EL in the classpath along with ongl...
I have a strategy used for reading data from a file. I have several instances of these strategies defined as spring beans.
I have several <a href=".."/> tags in a jsp file that passes a parameter into webflow that identifies the bean id of one of these strategy instances. The webflow xml references the variable and makes a call to the read method.
Here is the html code:
Here is the flow code:Code:<tr> <td><a href="${flowExecutionUrl}&_eventId=viewAuditMessages&reader=vaLogInboundReader&listingName=View Messages" title="View">View</a></td> </tr>
Here is the viewAuditMessages subflow:Code:<?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"> <!-- If not specified, the start state is the first state specified. --> <view-state id="viewAuditManager" view="audit/auditManager"> <transition on="viewAuditMessages" to="viewAuditMessagesSubflow"/> </view-state> <subflow-state id="viewAuditMessagesSubflow" subflow="viewAuditMessages"> <input name="reader" value="requestParameters.reader"/> <input name="listingName" value="requestParameters.listingName"/> </subflow-state> </flow>
Note above the reference #{reader}.read()Code:<?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"> <var name="pageModel" class="gov.va.med.datasharing.th.model.PageModel"/> <input name="reader" /> <input name="listingName" /> <!-- If not specified, the start state is the first state specified. --> <view-state id="viewInboundAuditMessages" model="pageModel" view="file/viewMessages"> <!-- Put listing name and messages on request scope for jsp access --> <on-render> <set name="flowScope.messages" value="#{reader}.read()"/> <set name="requestScope.messages" value="flowScope.messages"/> </on-render> <transition on="newPage" to="viewInboundAuditMessages"/> </view-state> </flow>
This exception occurs:
vaLogInboundReader is the value of reader. I think the issue is that EL is evaluating it as a string literal instead of the bean id reference. Is there a way in EL to specify reader so that it is interpreted as a Spring bean Id reference? Is there a way to explicitly do a 'applicationContext.getBean() in Spring EL? Or must I write a java class to do a lookup and call it in the webflow?Code:org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction@13bd737 targetAction = [SetAction@18c6634 name = flowScope.messages, value = #{reader}.read(), type = [null]], attributes = map[[empty]]] in state 'viewInboundAuditMessages' of flow 'viewAuditMessages' -- action execution attributes were 'map[[empty]]' at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60) at org.springframework.webflow.engine.ActionList.execute(ActionList.java:155) at org.springframework.webflow.engine.ViewState.render(ViewState.java:280) at org.springframework.webflow.engine.ViewState.refresh(ViewState.java:241) at org.springframework.webflow.engine.ViewState.resume(ViewState.java:219) at org.springframework.webflow.engine.Flow.resume(Flow.java:545) at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259) at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:163) at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183) at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) 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 weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(Unknown Source) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) Caused by: org.springframework.binding.expression.EvaluationException: An OgnlException occurred getting the value for expression '#{reader}.read()' on context [class org.springframework.webflow.engine.impl.RequestControlContextImpl] at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:92) at org.springframework.webflow.action.SetAction.doExecute(SetAction.java:75) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) ... 28 more Caused by: ognl.MethodFailedException: Method "read" failed for object {vaLogInboundReader=null} [java.lang.NoSuchMethodException: read()] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:837) at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:61) at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:860) at ognl.ASTMethod.getValueBody(ASTMethod.java:73) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) at ognl.ASTChain.getValueBody(ASTChain.java:109) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) at ognl.SimpleNode.getValue(SimpleNode.java:210) at ognl.Ognl.getValue(Ognl.java:333) at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85) ... 32 more Caused by: java.lang.NoSuchMethodException: read() at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:824) ... 42 more


Reply With Quote