PDA

View Full Version : struts & tiles plugin & webflow



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&#58;//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! &#58;-&#41; -->
<!-- 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&#40;&#41; &#123;
super&#40;&#41;;
// use you could also do this in the application context XML ofcourse
setFormObjectName&#40;"RegisterActionForm"&#41;;
setFormObjectClass&#40;RegisterFlowActionForm.class&#41;;
setValidator&#40;new RegisterFormValidator&#40;&#41;&#41;;
&#125;

public Event calculateAge&#40;RequestContext context&#41; throws Exception &#123;
// pull the date from the model
RegisterFlowActionForm flowForm = &#40;RegisterFlowActionForm&#41;context.getRequestScope&#40;&#41;. get&#40;"RegisterActionForm"&#41;;
// put it in the model for display by the view
//context.getRequestScope&#40;&#41;.setAttribute&#40;AGE_NAME, ageStr&#41;;
return success&#40;&#41;;
&#125;


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 &#91;P1-9&#93; ERROR org.apache.struts.taglib.tiles.InsertTag - ServletException in '/WEB-INF/jsp/register_step1.jspf'&#58; null
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.servic e&#40;JspServletWrapper.java&#58;372&#41;
at org.apache.jasper.servlet.JspServlet.serviceJspFil e&#40;JspServlet.java&#58;292&#41;


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

Keith Donald
Apr 15th, 2005, 11:25 AM
Yeah its unfortunate you have to subclass RequestProcessor to customize it.

Hmmmm... the error you're getting is coming from the BindingActionForm class - the Errors instance it adapts to the ActionForm model is not set, so it's complaining. It is expected that it be set before the ActionForward is returned when a ViewState is entered -- see the code in FlowAction that does it:



protected FlowExecutionListener createActionFormAdapter&#40;final HttpServletRequest request, final ActionForm form&#41; &#123;
return new FlowExecutionListenerAdapter&#40;&#41; &#123;
public void requestProcessed&#40;RequestContext context, Event triggeringEvent&#41; &#123;
if &#40;context.isFlowExecutionActive&#40;&#41;&#41; &#123;
if &#40;form instanceof BindingActionForm&#41; &#123;
BindingActionForm bindingForm = &#40;BindingActionForm&#41;form;
bindingForm.setErrors&#40;&#40;Errors&#41;context.getRequestSc ope&#40;&#41;.getAttribute&#40;FormObjectAccessor.FORM_OBJECT_ ATTRIBUTE_NAME, Errors.class&#41;&#41;;
bindingForm.setRequest&#40;request&#41;;
&#125;
&#125;
&#125;;
&#125;


Hmm... this looks incorrect, actually, looking at it. Essentially what the above code is doing is exporting a Spring Errors instance in the model for use by the BindingActionForm after the flow request is processed. This allows Struts to delegate to the Spring data binding and validation subsystem.

However, I see two problems: 1st there is no fallback if the instance is not set, and second, it looks like the FORM_OBJECT_ATTRIBUTE_NAME property is just wrong -- it should be FORM_OBJECT_ERRORS_ATTRIBUTE_NAME. That looks like a bug.

I'll look at correcting this promptly.

Keith Donald
Apr 15th, 2005, 07:35 PM
I just committed a fix for this problem: can you try it out in about 24 hrs? You'll need to checkout the spring project from CVS and build the 'webflow.jar' target to create the spring-webflow.jar with the fix. It'll also be in PR3, but it'd be great to see if this problem is resolved in a Struts/Tiles environment.

jocsch
Apr 18th, 2005, 11:00 AM
Hi keith,
Your fix solved the problem that I previously had.

But it leaves me with another one. I get this error:


1226663 &#91;P1-8&#93; ERROR org.apache.struts.taglib.tiles.InsertTag - ServletException in '/WEB-INF/jsp/register_step3.jspf'&#58; null
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.servic e&#40;JspServletWrapper.java&#58;372&#41;
at org.apache.jasper.servlet.JspServlet.serviceJspFil e&#40;JspServlet.java&#58;292&#41;
at org.apache.jasper.servlet.JspServlet.service&#40;JspSe rvlet.java&#58;236&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.mortbay.jetty.servlet.ServletHolder.handle&#40;Ser vletHolder.java&#58;427&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch&#40;WebApplicationHandler.java&#58;496&#41;
at org.mortbay.jetty.servlet.Dispatcher.dispatch&#40;Disp atcher.java&#58;263&#41;
at org.mortbay.jetty.servlet.Dispatcher.include&#40;Dispa tcher.java&#58;149&#41;
at org.apache.jasper.runtime.JspRuntimeLibrary.includ e&#40;JspRuntimeLibrary.java&#58;966&#41;
at org.apache.jasper.runtime.PageContextImpl.include&#40; PageContextImpl.java&#58;581&#41;
at org.apache.struts.tiles.TilesUtilImpl.doInclude&#40;Ti lesUtilImpl.java&#58;101&#41;
at org.apache.struts.tiles.TilesUtil.doInclude&#40;TilesU til.java&#58;137&#41;
at org.apache.struts.taglib.tiles.InsertTag.doInclude &#40;InsertTag.java&#58;758&#41;
at org.apache.struts.taglib.tiles.InsertTag$InsertHan dler.doEndTag&#40;InsertTag.java&#58;890&#41;
at org.apache.struts.taglib.tiles.InsertTag.doEndTag&#40; InsertTag.java&#58;460&#41;
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_tiles_insert_3&#40;DefaultLayout_jsp .java&#58;613&#41;
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_html_html_0&#40;DefaultLayout_jsp.ja va&#58;308&#41;
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspService&#40;DefaultLayout_jsp.java&#58;119&#41;
at org.apache.jasper.runtime.HttpJspBase.service&#40;Http JspBase.java&#58;94&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.apache.jasper.servlet.JspServletWrapper.servic e&#40;JspServletWrapper.java&#58;324&#41;
at org.apache.jasper.servlet.JspServlet.serviceJspFil e&#40;JspServlet.java&#58;292&#41;
at org.apache.jasper.servlet.JspServlet.service&#40;JspSe rvlet.java&#58;236&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.mortbay.jetty.servlet.ServletHolder.handle&#40;Ser vletHolder.java&#58;427&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch&#40;WebApplicationHandler.java&#58;496&#41;
at org.mortbay.jetty.servlet.Dispatcher.dispatch&#40;Disp atcher.java&#58;263&#41;
at org.mortbay.jetty.servlet.Dispatcher.forward&#40;Dispa tcher.java&#58;157&#41;
at org.apache.struts.action.RequestProcessor.doForwar d&#40;RequestProcessor.java&#58;1056&#41;
at org.apache.struts.tiles.TilesRequestProcessor.doFo rward&#40;TilesRequestProcessor.java&#58;261&#41;
at org.apache.struts.tiles.TilesRequestProcessor.proc essTilesDefinition&#40;TilesRequestProcessor.java&#58;237&#41;
at org.apache.struts.tiles.TilesRequestProcessor.proc essForwardConfig&#40;TilesRequestProcessor.java&#58;300&#41;
at com.zys.xyz.webapp.struts.CustomBindingRequestProc essor.process&#40;CustomBindingRequestProcessor.java&#58;1 31&#41;
at org.apache.struts.action.ActionServlet.process&#40;Act ionServlet.java&#58;1164&#41;
at org.apache.struts.action.ActionServlet.doPost&#40;Acti onServlet.java&#58;415&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;615&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.mortbay.jetty.servlet.ServletHolder.handle&#40;Ser vletHolder.java&#58;427&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter&#40;WebApplicationHandler.java&#58;822&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;300&#41;
at net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor.invoke&#40;FilterSecurityInterceptor.java&#58;8 4&#41;
at net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter.doFilter&#40;SecurityEnforcementFilter.java &#58;181&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;311&#41;
at net.sf.acegisecurity.ui.AbstractProcessingFilter.d oFilter&#40;AbstractProcessingFilter.java&#58;372&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;311&#41;
at net.sf.acegisecurity.context.HttpSessionContextInt egrationFilter.doFilter&#40;HttpSessionContextIntegrat ionFilter.java&#58;217&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;311&#41;
at net.sf.acegisecurity.util.FilterChainProxy.doFilte r&#40;FilterChainProxy.java&#58;179&#41;
at net.sf.acegisecurity.util.FilterToBeanProxy.doFilt er&#40;FilterToBeanProxy.java&#58;125&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter&#40;WebApplicationHandler.java&#58;813&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch&#40;WebApplicationHandler.java&#58;494&#41;
at org.mortbay.jetty.servlet.ServletHandler.handle&#40;Se rvletHandler.java&#58;569&#41;
at org.mortbay.http.HttpContext.handle&#40;HttpContext.ja va&#58;1482&#41;
at org.mortbay.jetty.servlet.WebApplicationContext.ha ndle&#40;WebApplicationContext.java&#58;624&#41;
at org.mortbay.http.HttpContext.handle&#40;HttpContext.ja va&#58;1434&#41;
at org.mortbay.http.HttpServer.service&#40;HttpServer.jav a&#58;896&#41;
at org.mortbay.http.HttpConnection.service&#40;HttpConnec tion.java&#58;814&#41;
at org.mortbay.http.HttpConnection.handleNext&#40;HttpCon nection.java&#58;981&#41;
at org.mortbay.http.HttpConnection.handle&#40;HttpConnect ion.java&#58;831&#41;
at org.mortbay.http.SocketListener.handleConnection&#40;S ocketListener.java&#58;244&#41;
at org.mortbay.util.ThreadedServer.handle&#40;ThreadedSer ver.java&#58;366&#41;
at org.mortbay.util.ThreadPool$PoolThread.run&#40;ThreadP ool.java&#58;534&#41;
1238040 &#91;P1-8&#93; WARN xyz - /register.html&#58;
javax.servlet.jsp.JspException&#58; ServletException in '/WEB-INF/jsp/register_step3.jspf'&#58; null
at org.apache.struts.taglib.tiles.InsertTag$InsertHan dler.doEndTag&#40;InsertTag.java&#58;921&#41;
at org.apache.struts.taglib.tiles.InsertTag.doEndTag&#40; InsertTag.java&#58;460&#41;
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_tiles_insert_3&#40;DefaultLayout_jsp .java&#58;613&#41;
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspx_meth_html_html_0&#40;DefaultLayout_jsp.ja va&#58;308&#41;
at org.apache.jsp.WEB_002dINF.jsp.layouts.DefaultLayo ut_jsp._jspService&#40;DefaultLayout_jsp.java&#58;119&#41;
at org.apache.jasper.runtime.HttpJspBase.service&#40;Http JspBase.java&#58;94&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.apache.jasper.servlet.JspServletWrapper.servic e&#40;JspServletWrapper.java&#58;324&#41;
at org.apache.jasper.servlet.JspServlet.serviceJspFil e&#40;JspServlet.java&#58;292&#41;
at org.apache.jasper.servlet.JspServlet.service&#40;JspSe rvlet.java&#58;236&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.mortbay.jetty.servlet.ServletHolder.handle&#40;Ser vletHolder.java&#58;427&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch&#40;WebApplicationHandler.java&#58;496&#41;
at org.mortbay.jetty.servlet.Dispatcher.dispatch&#40;Disp atcher.java&#58;263&#41;
at org.mortbay.jetty.servlet.Dispatcher.forward&#40;Dispa tcher.java&#58;157&#41;
at org.apache.struts.action.RequestProcessor.doForwar d&#40;RequestProcessor.java&#58;1056&#41;
at org.apache.struts.tiles.TilesRequestProcessor.doFo rward&#40;TilesRequestProcessor.java&#58;261&#41;
at org.apache.struts.tiles.TilesRequestProcessor.proc essTilesDefinition&#40;TilesRequestProcessor.java&#58;237&#41;
at org.apache.struts.tiles.TilesRequestProcessor.proc essForwardConfig&#40;TilesRequestProcessor.java&#58;300&#41;
at com.zys.xyz.webapp.struts.CustomBindingRequestProc essor.process&#40;CustomBindingRequestProcessor.java&#58;1 31&#41;
at org.apache.struts.action.ActionServlet.process&#40;Act ionServlet.java&#58;1164&#41;
at org.apache.struts.action.ActionServlet.doPost&#40;Acti onServlet.java&#58;415&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;615&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet .java&#58;688&#41;
at org.mortbay.jetty.servlet.ServletHolder.handle&#40;Ser vletHolder.java&#58;427&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter&#40;WebApplicationHandler.java&#58;822&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;300&#41;
at net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor.invoke&#40;FilterSecurityInterceptor.java&#58;8 4&#41;
at net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter.doFilter&#40;SecurityEnforcementFilter.java &#58;181&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;311&#41;
at net.sf.acegisecurity.ui.AbstractProcessingFilter.d oFilter&#40;AbstractProcessingFilter.java&#58;372&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;311&#41;
at net.sf.acegisecurity.context.HttpSessionContextInt egrationFilter.doFilter&#40;HttpSessionContextIntegrat ionFilter.java&#58;217&#41;
at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter&#40;FilterChainProxy.java&#58;311&#41;
at net.sf.acegisecurity.util.FilterChainProxy.doFilte r&#40;FilterChainProxy.java&#58;179&#41;
at net.sf.acegisecurity.util.FilterToBeanProxy.doFilt er&#40;FilterToBeanProxy.java&#58;125&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler$Ca chedChain.doFilter&#40;WebApplicationHandler.java&#58;813&#41;
at org.mortbay.jetty.servlet.WebApplicationHandler.di spatch&#40;WebApplicationHandler.java&#58;494&#41;
at org.mortbay.jetty.servlet.ServletHandler.handle&#40;Se rvletHandler.java&#58;569&#41;
at org.mortbay.http.HttpContext.handle&#40;HttpContext.ja va&#58;1482&#41;
at org.mortbay.jetty.servlet.WebApplicationContext.ha ndle&#40;WebApplicationContext.java&#58;624&#41;
at org.mortbay.http.HttpContext.handle&#40;HttpContext.ja va&#58;1434&#41;
at org.mortbay.http.HttpServer.service&#40;HttpServer.jav a&#58;896&#41;
at org.mortbay.http.HttpConnection.service&#40;HttpConnec tion.java&#58;814&#41;
at org.mortbay.http.HttpConnection.handleNext&#40;HttpCon nection.java&#58;981&#41;
at org.mortbay.http.HttpConnection.handle&#40;HttpConnect ion.java&#58;831&#41;
at org.mortbay.http.SocketListener.handleConnection&#40;S ocketListener.java&#58;244&#41;
at org.mortbay.util.ThreadedServer.handle&#40;ThreadedSer ver.java&#58;366&#41;
at org.mortbay.util.ThreadPool$PoolThread.run&#40;ThreadP ool.java&#58;534&#41;



The odd thing was that this exception does sometimes disappear if I used an exception breakpoint on the ServletException.

After investigating I found that the exception is thrown in the Tiles InsertTag line 890 (Struts 1.2).
This seems related to the known tiles bug/enhancement http://issues.apache.org/bugzilla/show_bug.cgi?id=21972

There seem to be some flushing issues. Before using webflow I never experienced this error. Even with the combination struts/tiles/struts-validator/webflow I don't have this issue (I removed the bindingcontrollers and stuff from the struts-config). So I think it has something to do with how things are handled by the struts/validator adapter. It makes the struts/tiles combination unusable. A possible workaround would be to precompile the jsps I think. But that would contradict our "rapid and easy JSP changes" developement philosophy.

I would love to use the more flexible spring validator as the struts validator is not flexible enough for the flow I have in mind.

Any thoughts towards this?
BTW, thanks for doing this work. Webflow really looks like a promising piece of software.

Markus

Keith Donald
Apr 18th, 2005, 12:06 PM
Ok, so you're saying it works except when you use the BindingActionForm adapter?

What a wonderful error message tiles is providing!

jocsch
Apr 19th, 2005, 11:48 AM
yup. I think it works. But I'm fighting with a lot of issues in the moment. But this is caused more by my lack of knowledge about webflow. I will inform you about my progress ;-)

jocsch
Apr 19th, 2005, 01:54 PM
what I forgot: Currently the bindingformadapter works for me. I have no clue why it does know.
After having the problems I switched to a strutsvalidator/webflow combination which works fine. Then I deleted the jetty jsp cache and tried the version with the bindingformadapter again and it works fine now. Don't ask me why.
So your adapter seems to work even in a struts/tiles environment. Not sure if there is a "hidden cache" so the jsps must not compile again. Or, and that's what I hope, clearing the JSP cache (and adding flush=false to the tiles:insert tag) resolved the issue for me.
Time (or the next jsps I have to touch) will tell what' s the issue with this.

jocsch
Apr 20th, 2005, 09:39 AM
Me again. I encountered an mismatch between the ways the validator of struts put errors in the request and the bindingformadaptor from webflow does.

I faced the problem when I tried to display the errormessage generated from a webflow validator in my jsp with the following statement (which worked perfectly with the struts validator):


<%-- Error Messages --%>
<logic&#58;messagesPresent>
<div class="error">
<html&#58;messages id="error">
$&#123;error&#125;<br/>
</html&#58;messages>
</div>
</logic&#58;messagesPresent>

<%-- Success Messages --%>
<logic&#58;messagesPresent message="true">
<div class="message">
<html&#58;messages id="message" message="true">
$&#123;message&#125;<br/>
</html&#58;messages>
</div>
</logic&#58;messagesPresent>

Nothing is displayed dispact the fact that there is an actionerror in the request. I did a quick System.out on request.getAttribute(org.apache.struts.Globals.ERR OR_KEY)
and found the following difference:


struts validator&#58;
&#123;lastName=&#91;errors.required&#91;Lastname, null, null, null&#93;&#93;&#125;

webflow validator&#58;
&#123;lastName=&#91;Lastname must not be null&#91;&#93;&#93;&#125;


In the latest CVS you removed the error handling from the birthday example. How would you do the errorhandling especially if you don't want to loose the ability to mark the wrong fields in the form?

Thanks,
Markus

Keith Donald
Apr 20th, 2005, 12:21 PM
Markus,

I checked Birthdate and the errors handling is still there:


<TR>
<TD colspan="2">
<html&#58;errors/>
</TD>
</TR>


I'd recommend turning on the debug log level for the org.springframwork.web.struts.BindingActionForm class. It will show you exactly the process it is going through to resolve error message key to use with the ActionError.

jocsch
Apr 21st, 2005, 11:53 AM
sorry keith for bothering. I had overlooked it completely. I was fixed on finding something more verbose.

I had also solved my problem why the errors aren't displayed by the struts tags. Using freetext instead of keys in the error descriptions(as I tried because I was too lazy to look for a key and then had to search the bug for hours) causes problems. Struts will not show the errormessage because it could not resolve it in its properties. That is working for me:


errors.reject&#40;"street","register.mustExist"&#41;;