myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: [Trinidad] Problems working with Ajax4JSF
Date Tue, 10 Jul 2007 05:16:25 GMT
But if that doesn't bear fruit, it wouldn't be that hard
to solve this entirely in Trinidad - in each component
that requires a FormData, use a hook that will
initialize it if it hasn't been rendered yet.

However, you'll still have some problems.  Since the
FormRenderer isn't involved, and Trinidad has no
obvious hooks at all into the A4J code, Trinidad
has no way to add any of the form-level Javascript
that accompanies our components.  Integration
at that layer... well, it'd either have to A4J + Trinidad
working very closely together, or JSF 2.0.

-- Adam



On 7/9/07, Adam Winer <awiner@gmail.com> wrote:
> It's a problem that has to be handled in some bit of code
> integrating the two libraries.  I'm curious in this case
> how the RenderingContext actually got created at all,
> since there's apparently no Trinidad ViewHandler on the
> stack...   If someone could track *that* down, we might
> have a good idea where to add the code to default
> the FormData.
>
> -- Adam
>
>
> On 7/9/07, mike.sauer@convergys.com <mike.sauer@convergys.com> wrote:
> >
> > I assume then that this should be considered a problem with Ajax4JSF and not
> > something to be addressed in Trinidad?
> >
> >
> > "Adam Winer" <awiner@gmail.com> wrote on 07/09/2007 12:44:50 PM:
> >
> >  > Hrm, true, but somehow there definitely is a RenderingContext;  the
> > > issue is that the FormData did not get created.
> > >
> >  > To solve this, some bit of Ajax4JSF code would need a hook
> > > point that could be subclassed/plugged-in to that would let
> > > Trinidad set up a FormData object.
> > >
> >  > -- Adam
> > >
> >
> > > On 7/9/07, Matthias Wessendorf <matzew@apache.org> wrote:
> > > I asked, because I noticed on your stack there is only this ViewHandler
> >  >
> >  > AjaxViewHandler (for ajax4jsf)
> >  >
> >  > On 7/9/07, mike.sauer@convergys.com < mike.sauer@convergys.com> wrote:
> >  > >
> >  > > Yes, I did.  I followed all of the non-seam directions (since I amnot
> > using
> >  > > seam).
> >  > >
> >  > > mwessendorf@gmail.com wrote on 07/09/2007 11:57:46 AM:
> >  > >
> >  > >
> >  > >  > have u checked this page
> >  > >  >
> >  > >  > http://wiki.apache.org/myfaces/TrinidadSeamAjax4Jsf
> >  > >  >
> >  > >  > On 7/9/07, mike.sauer@convergys.com <mike.sauer@convergys.com>
> > wrote:
> >  > >  > >
> >  > >  > > I am trying to use Ajax4Jsf with Trinidad, Facelets, and JSF
1.2.
> > (I am
> >  > >  > > considering using the RichRaces components as well) In my
demo I
> > have a
> >  > >  > > required text field, a check box and a set of fields that
are
> > enabled
> >  > > if the
> >  > >  > > checkbox is selected. I am trying to use ajax on the checkboxand
> > only
> >
> >  > >  > > refresh the fields that are associated with it.
> >  > >  > >  If the initial state of the page is that the box is not selected
> > and
> >  > > the
> >  > >  > > fields are disabled, selecting the checkbox results in the
> > following:
> >  > >  > >
> >  > >  > > WARNING: executePhase(RENDER_RESPONSE
> >  > >  > > 6,org.apache.myfaces.trinidadinternal.context.
> >  > >  > FacesContextFactoryImpl$CacheRenderKit@10e98d8)
> >  > >  > > threw exception
> >  > >  > > java.lang.NullPointerException
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  > EditableValueRenderer.
> >  > >  > addOnSubmitConverterValidators (EditableValueRenderer.java:206)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  >
> >  > > SimpleInputTextRenderer.
> >  > encodeAllAsElement(SimpleInputTextRenderer.java :105)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  > SimpleInputListOfValuesRenderer.
> >  > >  >
> >  > > renderTextField(SimpleInputListOfValuesRendere
> > r.java:197)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  > SimpleInputListOfValuesRenderer.
> >  > >  >
> >  > > encodeAllAsElement(SimpleInputListOfValuesRendere
> > r.java:154)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  >
> >  > > SimpleInputDateRenderer.
> >  > encodeAllAsElement(SimpleInputDateRenderer.java:194)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  > FormElementRenderer.encodeAll(FormElementRenderer.java:109)
> >  > >  > >         at
> >  > >  > > org.apache.myfaces.trinidad.render.CoreRenderer.
> >  > >  > delegateRenderer(CoreRenderer.java:318)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml .
> >  > >  > InputLabelAndMessageRenderer.
> >  > >  >
> >  > >
> > renderFieldCellContents(InputLabelAndMessageRenderer.java:142)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml .
> >  > >  >
> >  > >
> > LabelAndMessageRenderer._renderFieldCell(LabelAndMessageRenderer.java:375)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  >
> >  > >
> > LabelAndMessageRenderer.encodeAll(LabelAndMessageRenderer.java:270)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.
> >  > >  >
> >  > > InputLabelAndMessageRenderer .
> >  > encodeAll(InputLabelAndMessageRenderer.java:120)
> >  > >  > >         at
> >  > >  > > org.apache.myfaces.trinidad.render.CoreRenderer.
> >  > >  > encodeEnd(CoreRenderer.java:208)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidad.component.UIXComponentBase.
> >  > >  > encodeEnd(UIXComponentBase.java:733)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.renderer.RendererBase .
> >  > >  > renderChild(RendererBase.java:286)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.renderer.RendererBase.
> >  > >  > renderChildren(RendererBase.java:262)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.renderkit.html.AjaxOutputPanelRenderer.
> >  > >  > encodeChildren(AjaxOutputPanelRenderer.java:79)
> >  > >  > >         at
> >  > >  > > javax.faces.component.UIComponentBase.
> >  > >  > encodeChildren(UIComponentBase.java:812)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.renderer.RendererBase.
> >  > >  > renderChild(RendererBase.java:282)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.
> >  > >  > encodeAjaxComponent(AjaxChildrenRenderer.java:159)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.renderer.AjaxChildrenRenderer .
> >  > >  > encodeAjaxChildren(AjaxChildrenRenderer.java:97)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.
> >  > >  > encodeAjaxComponent(AjaxChildrenRenderer.java :150)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.
> >  > >  > encodeAjaxChildren(AjaxChildrenRenderer.java:97)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.
> >  > >  > encodeAjaxComponent(AjaxChildrenRenderer.java:150)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.renderer.AjaxContainerRenderer .
> >  > >  > encodeAjax(AjaxContainerRenderer.java:125)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:549)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.ajax.AjaxContext.
> >  > >  > renderAjaxRegion(AjaxContext.java:307)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.ajax4jsf.framework.ajax.AjaxContext$2.invoke(AjaxContext.java
> > :222)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.ajax.JsfOneOneInvoker.
> >  > >  > invokeOnComponent(JsfOneOneInvoker.java:75)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.ajax .AjaxContext.
> >  > >  > invokeOnComponent(AjaxContext.java:178)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.ajax.AjaxContext.
> >  > >  > renderSubmittedAjaxRegion(AjaxContext.java:236)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.ajax.AjaxViewHandler.
> >  > >  > renderView(AjaxViewHandler.java:256)
> >  > >  > >         at
> >  > >  > > com.sun.faces.lifecycle.RenderResponsePhase.
> >  > >  > execute(RenderResponsePhase.java:106)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
> >  > >  > >         at
> >  > >  > > org.apache.catalina.core.ApplicationFilterChain.
> >  > >  > internalDoFilter(ApplicationFilterChain.java:269)
> >  > >  > >         at
> >  > >  > > org.apache.catalina.core.ApplicationFilterChain.
> >  > >  > doFilter(ApplicationFilterChain.java:188)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.
> >  > >  > _invokeDoFilter(TrinidadFilterImpl.java :208)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.
> >  > >  > _doFilterImpl(TrinidadFilterImpl.java:165)
> >  > >  > >         at
> >  > >  > >
> >  > >
> > org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.
> >  > >  > doFilter(TrinidadFilterImpl.java:138)
> >  > >  > >         at
> >  > >  > >
> > org.apache.myfaces.trinidad.webapp.TrinidadFilter.
> >  > >  > doFilter(TrinidadFilter.java:92)
> >  > >  > >         at
> >  > >  > > org.apache.catalina.core.ApplicationFilterChain.
> >  > >  > internalDoFilter(ApplicationFilterChain.java:215)
> >  > >  > >         at
> >  > >  > > org.apache.catalina.core.ApplicationFilterChain.
> >  > >  > doFilter(ApplicationFilterChain.java:188)
> >  > >  > >         at
> >  > >  > >
> > org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.
> >  > >  > doXmlFilter(BaseXMLFilter.java:127)
> >  > >  > >         at
> >  > >  > > org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.
> >  > >  > doFilter(BaseFilter.java:277)
> >  > >  > >         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$Http11Conne ctionHandler.
> >  > >  > 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)
> >  > >  > >
> >  > >  > >
> >  > >  > > Here is the facelet....
> >  > >  > >
> >  > >  > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >  > >  > >
> >  > >
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >  > >  > >  <html xmlns="http://www.w3.org/1999/xhtml "
> >  > >  > >       xmlns:h="http://java.sun.com/jsf/html"
> >  > >  > >       xmlns:f="http://java.sun.com/jsf/core "
> >  > >  > >       xmlns:ui="http://java.sun.com/jsf/facelets"
> >  > >  > >       xmlns:tr="http://myfaces.apache.org /trinidad"
> >  > >  > >
> >  > > xmlns:trh="http://myfaces.apache.org/trinidad/html"
> >  > >  > >       xmlns:a4j="
> > https://ajax4jsf.dev.java.net/ajax">
> >  > >  > >   <body>
> >  > >  > >     <form name="form" jsfc="h:form"  >
> >  > >  > >       <input id="custRef" type="text" jsfc="h:inputText"
> >  > >  > >         required="true" value="#{customer.custRef}"
> >  > >  > >         label="Customer reference"/><br/>
> >  > >  > >
> >  > >  > >       <h:selectBooleanCheckbox name="hierBill" id="toSend2"
> >  > >  > >         value="#{customer.hierBill}">
> >  > >  > >         <f:selectItem itemLabel="Hierarchy Billing"
> >  > >  > >           itemValue="true"/>
> >  > >  > >         <a4j:support event="onclick" reRender="hierBillStuff"
> >  > >  > > ajaxSingle="true"/>
> >  > >  > >       </h:selectBooleanCheckbox>
> >  > >  > >       <a4j:outputPanel ajaxRendered="true">
> >  > >  > >         <h:messages/>
> >  > >  > >       </a4j:outputPanel>
> >  > >  > >       <a4j:outputPanel id="hierBillStuff">
> >  > >  > >         <label class="required">Bill period:</label><br/>
> >  > >  > >         <input type="text" name="billPer" size="10" id="billPer"
> >  > >  > >           jsfc="h:inputText" value="#{customer.billPeriod}"
> >  > >  > >           required="true"
> >  > >  > > disabled="#{!createCustBean.hierBill}"/>
> >  > >  > >         <select name="select" jsfc="h:selectOneListbox"
size="1"
> >  > >  > >           id="billPerFreq"
> >  > >  > >           value="#{customer.billPeriodFreq}"
> >  > >  > >           required="true"
> >  > >  > > disabled="#{!createCustBean .hierBill}">
> >  > >  > >           <f:selectItems
> > value="#{createCustBean.billPeriodFreqs}"/>
> >  > >  > >         </select>
> >  > >  > >
> >  > >  > >         <label class="required">Next bill date:</label><br/>
> >  > >  > >         <tr:inputDate id="nextBillDate"
> >  > >  > >           value="#{customer.nextBillDate}"
> >  > >  > >           disabled="#{!createCustBean.hierBill}"
> >  > >  > > required="true" />
> >  > >  > >
> >  > >  > >         <label class="required">Number of bills per
> >  > > statement:</label><br />
> >  > >  > >         <input type="text" name="numBills" id="numBills"
> >  > >  > >           jsfc="h:inputText" value="#{customer.numBills}"
> >  > >  > >           disabled="#{!createCustBean.hierBill}"
> >  > >  > > required="true"/>
> >  > >  > >       </a4j:outputPanel>
> >  > >  > >     </form>
> >  > >  > >     <ui:debug hotkey="p" rendered="#{initParam.debugMode}"/>
> >  > >  > >     <a4j:log hotkey="o"/>
> >  > >  > >   </body>
> >  > >  > >  </html>
> >  > >  > >
> >  > >  > >
> >  > >  > > The problem seems to be that the Trinidad EditableValueRender
> > class
> >  > > (which
> >  > >  > > is the base class of the input field renderers) expects a
> > reference to
> >  > > a
> >  > >  > > FormData object in a rendering context. The FormData object
is
> >  > > established
> >  > >  > > in the context when the form element is rendered. In the suggested
> >  > > approach
> >  > >  > > of just rendering the affected fields the form component does
not
> > get
> >  > >  > > rerendered so as a result the FormData object reference does
not
> > get
> >  > > set and
> >  > >  > > therefore a null pointer results.
> >  > >  > >
> >  > >  > >  It appears that Trinidad and Ajax4JSF are incompatible for
this
> > type
> >  > > of
> >  > >  > > thing.
> >  > >  > >
> >  > >  >
> >  > >  >
> >  > >  > --
> >  > >  > Matthias Wessendorf
> >  > >  >
> >  > >  > further stuff:
> >  > >  > blog: http://matthiaswessendorf.wordpress.com/
> >  > >  > mail: matzew-at-apache-dot-org
> >  > >
> >  >
> >  >
> >  > --
> >  > Matthias Wessendorf
> >  >
> >  > further stuff:
> >  > blog: http://matthiaswessendorf .wordpress.com/
> >  > mail: matzew-at-apache-dot-org
>

Mime
View raw message