Hello,
I'm attempting to use Web Flow's JS module to perform AJAX calls to tile views, so far I can't seem to get individual Tile's to refresh via the AJAX calls...the AJAX calls are being performed all right, some calls are effectively executing the instructions on the server, but the tile never refreshes. On another AJAX call using Web Flow's JS module I get a NullPointerException on the class
org.springframework.js.ajax.tiles2.AjaxTilesView.f lattenAttributeMap(AjaxTilesView.java:116)
Here is the setup, in case someone has experienced a similar issue and can give me a head's on the issue.
My Tiles file is as follows:
<tiles-definitions>
<definition name="home" template="/jsp/home.jsp">
<put-attribute name="title" value="Hello World"/>
<put-attribute name="header" value="/jsp/tiles/header.jsp"/>
<put-attribute name="body" value="index.body"/>
<put-attribute name="footer" value="/jsp/tiles/footer.jsp" />
</definition>
<definition name="index.body" template="/jsp/tiles/body.jsp">
<put-attribute name="helloMessages" value="/jsp/tiles/messages.jsp" />
<put-attribute name="helloTranslators" value="/jsp/tiles/translators.jsp" />
<put-attribute name="translator" value="/jsp/tiles/translator.jsp" />
</definition>
</tiles-definitions>
Now, the helloMessage tile ( messages.jsp ) which is part of index.body has the following AJAX call inside:
<a id="deleteMessage_${hello.id}" href="deleteMessage?id=${hello.id}">Delete Message </a>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId:"deleteMessage_${hello.id}",
event:"onclick",
params: {fragments:"index.body"}
}));
</script>
The actual call to the controller URL is working upon the click on the link ( it is deleting a message and I can see it in the server logs) however the 'index.body' tile never refreshes automatically to reflect these changes ( I have to hit reload ) , isn't the: params: { fragments:"index.body"} suppose to re-render the index.body tile automatically once the AJAX call is performed ?
On a similar note, I have this other AJAX call inside the helloTranslators tile ( translators.jsp ):
<a id="showTranslator_${hello.id}" href="translator?id=${hello.id}">Translator Details </a>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId:"showTranslator_${hello.id}",
event:"onclick",
params: {fragments:"helloTranslators"}
}));
Here again, the actual call to the controller is being perfromed, but it seems once the controller attempts to relinquish control over the 'translator' tile logical name ( which is nested as a put-attirbute value ) the following error is thrown :
SEVERE: Servlet.service() for servlet helloworld threw exception
java.lang.NullPointerException
at org.springframework.js.ajax.tiles2.AjaxTilesView.f lattenAttributeMap(AjaxTilesView.java:116)
at org.springframework.js.ajax.tiles2.AjaxTilesView.r enderMergedOutputModel(AjaxTilesView.java:91)
at org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:252)
at org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1173)
at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:901)
at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
BTW, the -servlet.xml file contains the following resolvers:
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2 .TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
<bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedVie wResolver">
<property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAj axTilesView"></property>
</bean>
Any ideas ? Per the docs, I understood the AjaxUrlBasedViewResolver made logical tile names out of every attribute name...similarly as I understood in the docs, the params: value in Spring.AjaxEventDecoration is there to refresh a tile by that name.....but I can't seem to either to work.
Thanks in advance for any guidance or help on the issue.


Reply With Quote
