Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while using <a4j:support>

 
Murali Pen
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using richfaces Ajax4Jsf tag library and getting an exception with the following code.

<h:selectOneMenu id="payperiodDates"
value="#{manageShiftSessionData.selectedPayperiodDate}"
valueChangeListener="#{manageShiftDailyDurationBean.onPayperiodDateChanged}"
><f:selectItems value="#{manageShiftSessionData.payperiodDatesItemList}" />
<a4j:support event="onchange" reRender="shiftElementsPanel"/>
</h:selectOneMenu>

However, if I don't use <a4j:support>, I don't see any errors but I need the Ajax behavior, not the total page refresh. Can someone please help me?


SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at org.ajax4jsf.org.w3c.tidy.Node.trimInitialSpace(Node.java:946)
at org.ajax4jsf.org.w3c.tidy.Node.trimSpaces(Node.java:1012)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseInline.parse(ParserImpl.java:1125)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:203)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseRow.parse(ParserImpl.java:3012)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:203)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseRowGroup.parse(ParserImpl.java:2885)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:203)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseTableTag.parse(ParserImpl.java:2629)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:203)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseInline.parse(ParserImpl.java:1587)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:203)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseBody.parse(ParserImpl.java:978)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:203)
at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseHTML.parse(ParserImpl.java:486)
at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseDocument(ParserImpl.java:3409)
at org.ajax4jsf.org.w3c.tidy.Tidy.parse(Tidy.java:363)
at org.ajax4jsf.org.w3c.tidy.Tidy.parse(Tidy.java:261)
at org.ajax4jsf.org.w3c.tidy.Tidy.parseDOM(Tidy.java:604)
at org.ajax4jsf.webapp.tidy.TidyParser.parseHtmlByTidy(TidyParser.java:182)
at org.ajax4jsf.webapp.tidy.TidyParser.parseHtml(TidyParser.java:264)
at org.ajax4jsf.webapp.FilterServletResponseWrapper.parseContent(FilterServletResponseWrapper.java:594)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:367)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
 
Murali Pen
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did further research and found that the problem is with trying to rerender an <h:panelGroup> inside an <a4j:repeat>. The ajax4jsf developer recommended wrapping <h:panelGroup> with an <a4j:outputPanel>. When I did this, the nullpointer exception is gone. But the problem is still unresolved. The <a4j:outputPanel> that is wrapping the <h:panelGroup> simply won't render. This is because I can't refer to its id in the rerender value because it is inside an <a4j:repeat>. For each iteration of the repeat, this id will be different. Can someone please suggest a new approach? Please help me.

Here is the sample code for what I am trying to do.

<a4j:outputPanel id="topPanel">
<a4j:repeat value="#{activityTimeEntries}"
var="activityTimeEntry"
rowKeyVar="index">

<a4j:outputPanel id="outerPanel" ajaxRendered="true">
<h:panelGroup id="innerPanel" rendered="#{index == 0}">
<h:outputText value="#{activityTimeEntry.duration}" />
</h:panelGroup>
</a4j:outputPanel>

</a4j:repeat>
</a4j:outputPanel>

<a4j:commandButton reRender="topPanel" value="save" />
 
Khushwant patidar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sir i am also facing same issue in my jsf page.
Can you please help how to resolve this below error.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic