jocsch
Apr 15th, 2005, 10:12 AM
Hi guys,
I'm trying arround with webflow and want to integrate into an existing struts/tiles application. One issue I had was that the tiles plugin does not allow any requestprocessors which do not extend from TilesRequestProcessor (ASF bug 22828). That wasn't that hard to solve, I simply copied your bindingRequestProcessor and make it extend the tilesrequestprocessor. Not very nice and futureproof but it works for now.
Now I face another tiles exception and I don't have a clue how to recover from this:
314142 [P1-2] WARN xyz - /register.html:
javax.servlet.jsp.JspException: ServletException in '/WEB-INF/jsp/register_step1.jspf': The errors instance must be set on this action form in order to access form properties
at org.apache.struts.taglib.tiles.InsertTag$InsertHan dler.doEndTag(InsertTag.java:921)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag( InsertTag.java:460)
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_tiles_insert_3(DefaultLayout_jsp .java:609)
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_html_html_0(DefaultLayout_jsp.ja va:305)
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspService(DefaultLayout_jsp.java:116)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:688)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:688)
at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:427)
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch(WebApplicationHandler.java:496)
at org.mortbay.jetty.servlet.Dispatcher.dispatch(Disp atcher.java:263)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispa tcher.java:157)
at org.apache.struts.action.RequestProcessor.doForwar d(RequestProcessor.java:1056)
at org.apache.struts.tiles.TilesRequestProcessor.doFo rward(TilesRequestProcessor.java:261)
at org.apache.struts.tiles.TilesRequestProcessor.proc essTilesDefinition(TilesRequestProcessor.java:237)
at org.apache.struts.tiles.TilesRequestProcessor.proc essForwardConfig(TilesRequestProcessor.java:300)
at com.xyz.tst.webapp.struts.CustomBindingRequestProc essor.process(CustomBindingRequestProcessor.java:1 31)
at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(Actio nServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:688)
at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:427)
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter(WebApplicationHandler.java:822)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:300)
at net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor.invoke(FilterSecurityInterceptor.java:8 4)
at net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter.doFilter(SecurityEnforcementFilter.java :181)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:311)
at net.sf.acegisecurity.ui.AbstractProcessingFilter.d oFilter(AbstractProcessingFilter.java:372)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:311)
at net.sf.acegisecurity.context.HttpSessionContextInt egrationFilter.doFilter(HttpSessionContextIntegrat ionFilter.java:217)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:311)
at net.sf.acegisecurity.util.FilterChainProxy.doFilte r(FilterChainProxy.java:179)
at net.sf.acegisecurity.util.FilterToBeanProxy.doFilt er(FilterToBeanProxy.java:125)
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter(WebApplicationHandler.java:813)
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch(WebApplicationHandler.java:494)
at org.mortbay.jetty.servlet.ServletHandler.handle(Se rvletHandler.java:569)
at org.mortbay.http.HttpContext.handle(HttpContext.ja va:1482)
at org.mortbay.jetty.servlet.WebApplicationContext.ha ndle(WebApplicationContext.java:624)
at org.mortbay.http.HttpContext.handle(HttpContext.ja va:1434)
at org.mortbay.http.HttpServer.service(HttpServer.jav a:896)
at org.mortbay.http.HttpConnection.service(HttpConnec tion.java:814)
at org.mortbay.http.HttpConnection.handleNext(HttpCon nection.java:981)
at org.mortbay.http.HttpConnection.handle(HttpConnect ion.java:831)
at org.mortbay.http.SocketListener.handleConnection(S ocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedSer ver.java:366)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadP ool.java:534)
As there a lot of config files I'm not sure which one are relevant for you. Basically this happend after loading the first view. That means the following steps in the workflow were executed, and the first view in the wizard (step1) started to display (until the exception):
<action-state id="setupForm">
<action bean="registerFormAction"/>
<transition on="success" to="formView"/>
</action-state>
<!--
Display the input form view.
-->
<view-state id="formView" view="page.register.step1">
<transition on="submit" to="bindAndValidateForm"/>
</view-state>
My struts-config looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- ======================================== Form Bean Definitions -->
<form-beans>
<!-- A single action form adapter for your entire app is all you need, if you
wish to take advantage of Spring's POJO-based data binding and validation. -->
<form-bean name="actionForm" type="org.springframework.web.struts.BindingActionForm"/>
</form-beans>
<!-- =================================== Global Exception Definitions -->
<global-exceptions>
<exception key="error.required"
type="org.springframework.dao.DataAccessException"
path="page.error.dataAccessFailure" />
</global-exceptions>
<!-- =================================== Global Forward Definitions -->
<global-forwards></global-forwards>
<!-- =================================== Action Mapping Definitions -->
<action-mappings>
<!-- flow actions -->
<action path="/register"
type="org.springframework.web.flow.struts.FlowAction"
name="actionForm" scope="request"
className="org.springframework.web.flow.struts.FlowActionMapp ing">
<set-property property="flowId" value="registerFlow" />
</action>
</action-mappings>
<!-- A custom request processor is neccessary for deferred, POJO-based binding and validation
No more Action Form proliferation! :-) -->
<!-- controller processorClass="org.springframework.web.struts.BindingRequestProce ssor"/ -->
<controller processorClass="com.example.app.webapp.struts.CustomBindingRequest Processor"/>
<!-- ================================ Message Resources Definitions -->
<message-resources parameter="messages" />
<!-- ======================================= Plug Ins Configuration -->
<!-- plugin neccessary for making Commons BeanUtils aware of the BindingActionForm adapter -->
<plug-in className="org.springframework.web.struts.BindingPlugin"/>
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
</plug-in>
<!-- plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml" />
</plug-in -->
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="definitions-debug" value="0" />
<set-property property="definitions-parser-details" value="1" />
<set-property property="definitions-parser-validate"
value="true" />
</plug-in>
</struts-config>
In my Action I set the POJO formobject as follows:
public RegisterFormAction() {
super();
// use you could also do this in the application context XML ofcourse
setFormObjectName("RegisterActionForm");
setFormObjectClass(RegisterFlowActionForm.class);
setValidator(new RegisterFormValidator());
}
public Event calculateAge(RequestContext context) throws Exception {
// pull the date from the model
RegisterFlowActionForm flowForm = (RegisterFlowActionForm)context.getRequestScope(). get("RegisterActionForm");
// put it in the model for display by the view
//context.getRequestScope().setAttribute(AGE_NAME, ageStr);
return success();
}
As it is a little bit unclear to me how the object is mapped to the actionForm definition in the struts-config and the settings in the Action class I changed the name from "RegisterActionForm" to "actionForm" but this resulted into a
60467 [P1-9] ERROR org.apache.struts.taglib.tiles.InsertTag - ServletException in '/WEB-INF/jsp/register_step1.jspf': null
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:372)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
So, that's all I have. It's not simple to explain as I have yet started with the webflow. Can't you use my description?
Thanks,
Markus
I'm trying arround with webflow and want to integrate into an existing struts/tiles application. One issue I had was that the tiles plugin does not allow any requestprocessors which do not extend from TilesRequestProcessor (ASF bug 22828). That wasn't that hard to solve, I simply copied your bindingRequestProcessor and make it extend the tilesrequestprocessor. Not very nice and futureproof but it works for now.
Now I face another tiles exception and I don't have a clue how to recover from this:
314142 [P1-2] WARN xyz - /register.html:
javax.servlet.jsp.JspException: ServletException in '/WEB-INF/jsp/register_step1.jspf': The errors instance must be set on this action form in order to access form properties
at org.apache.struts.taglib.tiles.InsertTag$InsertHan dler.doEndTag(InsertTag.java:921)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag( InsertTag.java:460)
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_tiles_insert_3(DefaultLayout_jsp .java:609)
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_html_html_0(DefaultLayout_jsp.ja va:305)
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspService(DefaultLayout_jsp.java:116)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:688)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:688)
at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:427)
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch(WebApplicationHandler.java:496)
at org.mortbay.jetty.servlet.Dispatcher.dispatch(Disp atcher.java:263)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispa tcher.java:157)
at org.apache.struts.action.RequestProcessor.doForwar d(RequestProcessor.java:1056)
at org.apache.struts.tiles.TilesRequestProcessor.doFo rward(TilesRequestProcessor.java:261)
at org.apache.struts.tiles.TilesRequestProcessor.proc essTilesDefinition(TilesRequestProcessor.java:237)
at org.apache.struts.tiles.TilesRequestProcessor.proc essForwardConfig(TilesRequestProcessor.java:300)
at com.xyz.tst.webapp.struts.CustomBindingRequestProc essor.process(CustomBindingRequestProcessor.java:1 31)
at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(Actio nServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:688)
at org.mortbay.jetty.servlet.ServletHolder.handle(Ser vletHolder.java:427)
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter(WebApplicationHandler.java:822)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:300)
at net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor.invoke(FilterSecurityInterceptor.java:8 4)
at net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter.doFilter(SecurityEnforcementFilter.java :181)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:311)
at net.sf.acegisecurity.ui.AbstractProcessingFilter.d oFilter(AbstractProcessingFilter.java:372)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:311)
at net.sf.acegisecurity.context.HttpSessionContextInt egrationFilter.doFilter(HttpSessionContextIntegrat ionFilter.java:217)
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:311)
at net.sf.acegisecurity.util.FilterChainProxy.doFilte r(FilterChainProxy.java:179)
at net.sf.acegisecurity.util.FilterToBeanProxy.doFilt er(FilterToBeanProxy.java:125)
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter(WebApplicationHandler.java:813)
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch(WebApplicationHandler.java:494)
at org.mortbay.jetty.servlet.ServletHandler.handle(Se rvletHandler.java:569)
at org.mortbay.http.HttpContext.handle(HttpContext.ja va:1482)
at org.mortbay.jetty.servlet.WebApplicationContext.ha ndle(WebApplicationContext.java:624)
at org.mortbay.http.HttpContext.handle(HttpContext.ja va:1434)
at org.mortbay.http.HttpServer.service(HttpServer.jav a:896)
at org.mortbay.http.HttpConnection.service(HttpConnec tion.java:814)
at org.mortbay.http.HttpConnection.handleNext(HttpCon nection.java:981)
at org.mortbay.http.HttpConnection.handle(HttpConnect ion.java:831)
at org.mortbay.http.SocketListener.handleConnection(S ocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedSer ver.java:366)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadP ool.java:534)
As there a lot of config files I'm not sure which one are relevant for you. Basically this happend after loading the first view. That means the following steps in the workflow were executed, and the first view in the wizard (step1) started to display (until the exception):
<action-state id="setupForm">
<action bean="registerFormAction"/>
<transition on="success" to="formView"/>
</action-state>
<!--
Display the input form view.
-->
<view-state id="formView" view="page.register.step1">
<transition on="submit" to="bindAndValidateForm"/>
</view-state>
My struts-config looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- ======================================== Form Bean Definitions -->
<form-beans>
<!-- A single action form adapter for your entire app is all you need, if you
wish to take advantage of Spring's POJO-based data binding and validation. -->
<form-bean name="actionForm" type="org.springframework.web.struts.BindingActionForm"/>
</form-beans>
<!-- =================================== Global Exception Definitions -->
<global-exceptions>
<exception key="error.required"
type="org.springframework.dao.DataAccessException"
path="page.error.dataAccessFailure" />
</global-exceptions>
<!-- =================================== Global Forward Definitions -->
<global-forwards></global-forwards>
<!-- =================================== Action Mapping Definitions -->
<action-mappings>
<!-- flow actions -->
<action path="/register"
type="org.springframework.web.flow.struts.FlowAction"
name="actionForm" scope="request"
className="org.springframework.web.flow.struts.FlowActionMapp ing">
<set-property property="flowId" value="registerFlow" />
</action>
</action-mappings>
<!-- A custom request processor is neccessary for deferred, POJO-based binding and validation
No more Action Form proliferation! :-) -->
<!-- controller processorClass="org.springframework.web.struts.BindingRequestProce ssor"/ -->
<controller processorClass="com.example.app.webapp.struts.CustomBindingRequest Processor"/>
<!-- ================================ Message Resources Definitions -->
<message-resources parameter="messages" />
<!-- ======================================= Plug Ins Configuration -->
<!-- plugin neccessary for making Commons BeanUtils aware of the BindingActionForm adapter -->
<plug-in className="org.springframework.web.struts.BindingPlugin"/>
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
</plug-in>
<!-- plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml" />
</plug-in -->
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="definitions-debug" value="0" />
<set-property property="definitions-parser-details" value="1" />
<set-property property="definitions-parser-validate"
value="true" />
</plug-in>
</struts-config>
In my Action I set the POJO formobject as follows:
public RegisterFormAction() {
super();
// use you could also do this in the application context XML ofcourse
setFormObjectName("RegisterActionForm");
setFormObjectClass(RegisterFlowActionForm.class);
setValidator(new RegisterFormValidator());
}
public Event calculateAge(RequestContext context) throws Exception {
// pull the date from the model
RegisterFlowActionForm flowForm = (RegisterFlowActionForm)context.getRequestScope(). get("RegisterActionForm");
// put it in the model for display by the view
//context.getRequestScope().setAttribute(AGE_NAME, ageStr);
return success();
}
As it is a little bit unclear to me how the object is mapped to the actionForm definition in the struts-config and the settings in the Action class I changed the name from "RegisterActionForm" to "actionForm" but this resulted into a
60467 [P1-9] ERROR org.apache.struts.taglib.tiles.InsertTag - ServletException in '/WEB-INF/jsp/register_step1.jspf': null
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:372)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
So, that's all I have. It's not simple to explain as I have yet started with the webflow. Can't you use my description?
Thanks,
Markus