Hello everybody,
I've got a problem with the dateChooser component:
When I try to dynamically show the component, the value won't change in the BackingBean.
In the jsp I've got:
...
<q:dateChooser id="statisticsStart"
dateFormat="medium"
showWeekNumber="true"
value="#{GroupStatisticsBackingBean.dataStart}"
todayText="today"
noneText="none"
weekText="week"
dayStyle="border: 1px solid white;"
>
</q:dateChooser>
<a4j:commandButton value="update" action="#{GroupStatisticsBackingBean.makeData}"
onclick="q_showPopupLayerCentered('loadingPopup')"
oncomplete="q_hidePopupLayer('loadingPopup');"
reRender="a4jGroupStatisticsChart, a4jVehicleStatisticsChart"
rendered="#{GroupStatisticsBackingBean.groupSelected}"
></a4j:commandButton>
...
in the method GroupStatisticsBackingBean.makeData() I've put a system.out.println which prints out "dataStart". It all works fine as long as I do not include the line rendered="#{GroupStatisticsBackingBean.groupSelected}" in the DateChooser Tag. From now on, only the initial Date-Value will be printed, although I've set a completely different date in the browser.
dataStart is of type "Date" in the BackingBean.
In short: if the DateChooser is shown right from the beginning, everything works fine. But if the DateChooser is shown only when triggered by a certain event, it doesn't work at all, because "dataStart" isn't updated anymore.
Is there anything wrong?
Hello Tatyana,
I've attached the files you requested.
The file 'statisticsGroupDetail.jsp' is being included by the file 'statistics.jsp', which itself is being included by a TabbedPane.
In the main.jsf, I've got a form-tag surrounding the whole content.
QuipuKit version is 1.2.2 and JSF implementation is myfaces 1.1.1.
Thank you!
Regards,
Matthias
Hello Matthias,
I have several questions about your problem since I don't fully understand some of your sentences:
- "When I try to dynamically show the component". What component are you showing? What do your mean by "dynamically"? As I can see from the page source, the DateChooser is always rendered.
- "It all works fine as long as I do not include the line rendered="#{GroupStatisticsBackingBean.groupSelected}" in the DateChooser Tag." As seen from the code, I can see that the rendered attribute is specified for the a4j:commandButton, not for the DateChooser. And, can you please clarify whether the DateChooser's value is updated in the backing bean if you just remove this attribute?
- Looking at your code, I don't see updating the DateChooser by some event. Is there something that is not included in the files you provided?
Another point is the "loadingPopup" that should be shown when clicking the a4j:commandButton component. As a parameter for the q_shouwPopupCentered JavaScript function, you should specify the client ID of the PopupLayer component, for example "formId:popupLayerId". Does this popupLayer work fine?
Regards,
Tatyana
Hello Tatyana,
it's quite a bit difficult to explain. But I'll try to explain the wohle situation:
On the left side of the page, I've got a DataTable in which you can select a group.
On the right side, there is the Chart component and the two DataChooser components (shown in statisticsGroupDetail.jsp), which should only be rendered when a group is selected on the left side.
This is realized by the rendered="#{GroupStatisticsBackingBean.groupSelected}" tag, which is set by clicking on an item in the TreeTable.
This is shown here:
<q:singleRowSelection rowData="#{StatisticsGroupDataTableBackingBean.selectedGroup}"
styleClass="groupDataTableSelectedRow"
>
<a4j:support event="onchange"
action="#{StatisticsGroupDataTableBackingBean.processRowDataSelection}"
actionListener="#{GroupStatisticsBackingBean.dropdownActionListener}"
onsubmit="q_showPopupLayerCentered('loadingPopup');"
oncomplete="q_hidePopupLayer('loadingPopup');"
reRender="a4jGroupStatistics, a4jVehicleStatistics"
></a4j:support>
</q:singleRowSelection>
You're right, when you say, that the DataChooser is always shown in my example files, because this is the working copy. So just insert the rendered="#{GroupStatisticsBackingBean.groupSelected}" tag in the blank space within the DataChooser tags ![]()
The first DataChoosers is bound to the GroupStatisticsBackingBean.dataStart and the second to GroupStatisticsBackingBean.dataEnd. When I change the value of the DateChooser by selecting a Date from the dropdown calendar, the value in the backing bean should also changed, or am I wrong?
(Well, this is actually done, when I remove the rendered="..." tag, mentioned above.
Now in the method GroupStatisticsBackingBean.makeData triggered by the a4j:commandButton ("update" button, file statisticsGroupDetail.jsp) I've inserted a sysout for dataStart and dataEnd which prints me the current values of the two attributes when clicking the "update" button.
The problem is, when I insert the rendered="..." tag in the DateChooser tags, the two dates won't update anymore. On the console there is always the same output no matter what I select in the dropdown calender.
If the rendered="..." tag is removed from the DataChoosers the console shows exactly the dates I've selected before clicking on the button.
console output if DataChoosers are always rendered, after clicking the "update" button:
INFO GroupStatisticsBackingBean.makeData() - start date: 2007-10-15 00:00:00
INFO GroupStatisticsBackingBean.makeData() - end date: 2007-10-21 00:00:00
console output if DataChoosers are only rendered when a group is selected, after clicking the "update" button:
INFO GroupStatisticsBackingBean.makeData() - start date: 2007-10-26 08:33:20
INFO GroupStatisticsBackingBean.makeData() - end date: 2007-10-26 08:33:20
--> nothing is upated here
(In both cases I selected 2007-10-15 as start date and 2007-10-21 as end date. The time doesn't matter for my application)
I hope this rather long answer helps to explain my problem.
Thank you,
regards
Matthias
Hello Matthias,
It seems that the problem is not related to QuipuKit. We reproduced the same problem in application without QuipuKit at all. However, if you change scope of your backing bean from "request" to "session", everything should work fine.
Feel free to contact us if you have any further questions.
Regards,
Tatyana
Hi Tatyana,
the scope of the backing bean is already set to "session". Changing it to "request" also didn't solve my problem.
I tried the same site with a "normal" dropdown field (q:dropDownField). In this case, the BackingBean is updated normally. So I think the problem is somehow related to the DateChooser component.
Regards,
Matthias
Message was edited by: Matthias Bartel
Hi Tatyana,
I also get an exception under the following conditions:
- the DateChooser is rendered dynamically (when the group was selected on the left side)
- I click the update button after selecting start and end date (--> the dates in the backing bean don't change)
- I select another group --> the followinf exception is thrown:
2007-10-29 12:35:03,770 ERROR [jsp].invoke() - Servlet.service() for servlet jsp threw exception
java.lang.ClassCastException: java.lang.String
at teamdev.jsf.renderkit.datechooser.DateChooserRenderer.d(SourceFile:185)
at teamdev.jsf.renderkit.dropdown.DropDownComponentRenderer.e(SourceFile:208)
at teamdev.jsf.renderkit.dropdown.DropDownComponentRenderer.encodeEnd(SourceFile:168)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:256)
at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:232)
at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:79)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:252)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:127)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:536)
at org.ajax4jsf.framework.ajax.AjaxViewRoot$4.invokeRoot(AjaxViewRoot.java:367)
at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:382)
at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:607)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
at com.sun.faces.taglib.jsf_core.ViewTag.doEndTag(ViewTag.java:214)
at org.apache.jsp.jsp.main_jsp._jspx_meth_f_005fview_005f0(main_jsp.java:269)
at org.apache.jsp.jsp.main_jsp._jspService(main_jsp.java:134)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at teamdev.jsf.util.ResourceFilter.doFilter(SourceFile:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(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.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
2007-10-29 12:35:03,832 ERROR [Faces Servlet].invoke() - Servlet.service() for servlet Faces Servlet threw exception
java.lang.ClassCastException: java.lang.String
at teamdev.jsf.renderkit.datechooser.DateChooserRenderer.d(SourceFile:185)
at teamdev.jsf.renderkit.dropdown.DropDownComponentRenderer.e(SourceFile:208)
at teamdev.jsf.renderkit.dropdown.DropDownComponentRenderer.encodeEnd(SourceFile:168)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:256)
at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:232)
at org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:79)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:252)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:127)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:536)
at org.ajax4jsf.framework.ajax.AjaxViewRoot$4.invokeRoot(AjaxViewRoot.java:367)
at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:382)
at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:607)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
at com.sun.faces.taglib.jsf_core.ViewTag.doEndTag(ViewTag.java:214)
at org.apache.jsp.jsp.main_jsp._jspx_meth_f_005fview_005f0(main_jsp.java:269)
at org.apache.jsp.jsp.main_jsp._jspService(main_jsp.java:134)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at teamdev.jsf.util.ResourceFilter.doFilter(SourceFile:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(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.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Perhaps this may help you a little bit.
Hello Matthias,
Unfortunately, we were unable to reproduce the problem you described. The only problem we found is the problem with a request scope backing bean. Please provide us also with your web.xml file, version of Ajax4jsf and application server. The best option to reproduce the problem would be a working application (which you can send at quipukit-support AT teamdev DOT com).
Regarding the ClassCastException. Most likely this exception is not related to your problem. We are aware of this exception. It appears in case when the DateChooser was loaded using the Ajax4jsf framework. We will fix this issue in one of the nearest releases of QuipuKit.
Regards,
Tatyana
Hello Tatyana,
Unfortunately, I'm not allowed to provide you the full source code of the application. So I tried to extract the problem to a more abstract example but I was also not able to reproduce the problem. Also with a stepwise abstraction I was not able to figure out what the problem is.
Considering the time, I decided to try to create a workaround:
I've set the immediate attribute to true for both dateChooser components and added a valueChangeListener, which updates the relevant attributes in the backing bean. Now, the update of the attribute works fine.
This is where the ClassCastException comes in: when I select another group the ClassCastException described above occurs.
I hope this error will be fixed so I may test my solution.
Hello Tatyana,
the whole problem still exists. Also the class cast exception when using valueChangeListener
I've just tested it with QuipuKit 1.3.2.
Regards,
Matthias
Hello Matthias,
Unfortunately, we were unable to reproduce the problem with ClassCastException.
I know, that you provided us with some of the information that could help us reproduce the problem. But just in case that something changed, please provide us with a following information:
- JSF implementation and version;
- State saving method;
- Do you use Facelets or not, what version;
- Ajax4jsf version;
- Application server;
- Any other component libraries or framework with versions
- web.xml file;
- pages on which the problem occurs and steps to reproduce the problem.
As I understand, you still have a problem with saving the value of the DateChooser component after it was loaded with Ajax4jsf framework. And there is also ClassCastException. Is it correct?
Regards,
Tatyana