You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by "Bertrand, Shawn R" <sh...@tycoelectronics.com> on 2007/03/09 17:58:18 UTC

PPR effects on custom component

Hi all,

 

I have a custom component I've developed that I'd like to be able to
refresh with PPR as a result of a selectOneChoice component trigger.
The custom component simply outputs an HTML table at this point, so
wouldn't I need to just wrap the custom tag with a panelGroup or some
other component and make that component trigger off of the
selectOneChoice?  Are there any requirements on the custom component
side in order for PPR to work?

 

Thanks in advance,

 

Shawn

 


RE: PPR effects on custom component

Posted by "Bertrand, Shawn R" <sh...@tycoelectronics.com>.
After a little more thought, it would be really cool to implement a
partialTriggers attribute on the custom component, and in the decode
method, add the component as PPR:

 

    public void decode(FacesContext context)

    {

        Map<String, String> parameters = 

          context.getExternalContext().getRequestParameterMap();

        Object source = parameters.get("source");

        String id = this.getClientId(context);

        if (id.equals(source))

        {

 
RequestContext.getCurrentInstance().addPartialTarget(component);

        }

    }

 

Is that possible?

 

Shawn

 

 

________________________________

From: Bertrand, Shawn R 
Sent: Friday, March 09, 2007 12:58 PM
To: adffaces-user@incubator.apache.org
Subject: PPR effects on custom component

 

Hi all,

 

I have a custom component I've developed that I'd like to be able to
refresh with PPR as a result of a selectOneChoice component trigger.
The custom component simply outputs an HTML table at this point, so
wouldn't I need to just wrap the custom tag with a panelGroup or some
other component and make that component trigger off of the
selectOneChoice?  Are there any requirements on the custom component
side in order for PPR to work?

 

Thanks in advance,

 

Shawn

 


trouble with a kind of trinidad filter

Posted by Juan Giovanolli <ju...@santexgroup.com>.
Hi:
I'm getting this error when I try to enter to a page of my app.
Which can be the reasons of that??

Thanks in advance

Should I use <tr:form> instead of <h:form> to solve this problem???


13:51:30,062 ERROR [STDERR] Mar 14, 2007 1:51:30 PM
com.sun.facelets.FaceletViewHandler handleRenderException
SEVERE: Error Rendering View[/notification/createNotification.xhtml]
java.lang.NullPointerException
 at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormRenderer.encode
End(FormRenderer.java:211)
 at
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:
188)
 at
org.apache.myfaces.trinidadinternal.renderkit.htmlBasic.HtmlFormRenderer.enc
odeEnd(HtmlFormRenderer.java:64)
 at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
 at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:252)
 at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:249)
 at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:249)
 at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:249)
 at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:249)
 at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:249)
 at
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
 at
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(V
iewHandlerImpl.java:182)
 at
org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java
:101)
 at
org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:
221)
 at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:97)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:181)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilte
r(TrinidadFilterImpl.java:210)
 at
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(
TrinidadFilterImpl.java:167)
 at
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(Trini
dadFilterImpl.java:140)
 at
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.ja
va:93)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at
org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilte
r.java:75)
 at
org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:21
3)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
va:96)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
 at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:175)
 at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
74)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
 at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionVa
lve.java:156)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
 at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)
 at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
 at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre
ad.java:112)
 at java.lang.Thread.run(Unknown Source)





Juan Giovanolli
System Developer


RE: (Update) PPR effects on custom component

Posted by "Bertrand, Shawn R" <sh...@tycoelectronics.com>.
Hey again,

Looks like the PPR code on my custom component is working now, and the
UI now updates but places the updated rendering above the original
content. My page is simple:

- uses document tag
- has a tableLayout with 2 rows: selectOneChoice in one row and custom
component in the other row

The updated content is reflected in the DOM as expected (DOM Inspector
in FireFox shows correct layout after PPR), but the original HTML page
shows the updated content between the selectOneChoice and the initial
custom component render content.

Thanks for any insight you might have into this.

Shawn





-----Original Message-----
From: Bertrand, Shawn R 
Sent: Wednesday, March 14, 2007 9:00 AM
To: 'Adam Winer'; adffaces-user@incubator.apache.org
Subject: RE: PPR effects on custom component

Hey Adam,

My component does extend UIXComponentBase, I had implemented the
partialTriggers attribute and added the addPartialTriggerListeners code
below to my decode method in my renderer, and I see my renderer encode
methods called on the PPR request, but the UI isn't being updated.  I'm
using the following as my root element (code from my encodeBegin()):

        writer.startElement("div", comp);
        writer.writeAttribute("id", "defTemplate", null);

This is what you meant by making sure the root element passes the
UIComponent, right?  Is there any other requirement for the root
element?

Thanks in advance,

Shawn


-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: Friday, March 09, 2007 2:15 PM
To: adffaces-user@incubator.apache.org
Subject: Re: PPR effects on custom component

What you need to do, at a minimum:

- In your Renderer, make sure that the root element
  passes the UIComponent to ResponseWriter.startElement(),
  and that a unique ID is written on that same root element.

If you do that, and just that, RequestContext.addPartialTarget() will
work.

If you want partialTriggers to work, then you need to:

- Add a partialTriggers attribute on your component
- If you don't extend from UIXComponentBase, copy the following code
  from UIXComponentBase.decode() to your decode() methods:

    Object triggers = getAttributes().get("partialTriggers");
    if (triggers instanceof String[])
    {
      RequestContext rc = RequestContext.getCurrentInstance();
      if (rc != null)
        rc.addPartialTriggerListeners(this, (String[]) triggers);
    }

And that's it!

-- Adam




On 3/9/07, Bertrand, Shawn R <sh...@tycoelectronics.com> wrote:
> Hi all,
>
>
>
> I have a custom component I've developed that I'd like to be able to
> refresh with PPR as a result of a selectOneChoice component trigger.
> The custom component simply outputs an HTML table at this point, so
> wouldn't I need to just wrap the custom tag with a panelGroup or some
> other component and make that component trigger off of the
> selectOneChoice?  Are there any requirements on the custom component
> side in order for PPR to work?
>
>
>
> Thanks in advance,
>
>
>
> Shawn
>
>
>
>

RE: PPR effects on custom component

Posted by "Bertrand, Shawn R" <sh...@tycoelectronics.com>.
Hey Adam,

My component does extend UIXComponentBase, I had implemented the
partialTriggers attribute and added the addPartialTriggerListeners code
below to my decode method in my renderer, and I see my renderer encode
methods called on the PPR request, but the UI isn't being updated.  I'm
using the following as my root element (code from my encodeBegin()):

        writer.startElement("div", comp);
        writer.writeAttribute("id", "defTemplate", null);

This is what you meant by making sure the root element passes the
UIComponent, right?  Is there any other requirement for the root
element?

Thanks in advance,

Shawn


-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: Friday, March 09, 2007 2:15 PM
To: adffaces-user@incubator.apache.org
Subject: Re: PPR effects on custom component

What you need to do, at a minimum:

- In your Renderer, make sure that the root element
  passes the UIComponent to ResponseWriter.startElement(),
  and that a unique ID is written on that same root element.

If you do that, and just that, RequestContext.addPartialTarget() will
work.

If you want partialTriggers to work, then you need to:

- Add a partialTriggers attribute on your component
- If you don't extend from UIXComponentBase, copy the following code
  from UIXComponentBase.decode() to your decode() methods:

    Object triggers = getAttributes().get("partialTriggers");
    if (triggers instanceof String[])
    {
      RequestContext rc = RequestContext.getCurrentInstance();
      if (rc != null)
        rc.addPartialTriggerListeners(this, (String[]) triggers);
    }

And that's it!

-- Adam




On 3/9/07, Bertrand, Shawn R <sh...@tycoelectronics.com> wrote:
> Hi all,
>
>
>
> I have a custom component I've developed that I'd like to be able to
> refresh with PPR as a result of a selectOneChoice component trigger.
> The custom component simply outputs an HTML table at this point, so
> wouldn't I need to just wrap the custom tag with a panelGroup or some
> other component and make that component trigger off of the
> selectOneChoice?  Are there any requirements on the custom component
> side in order for PPR to work?
>
>
>
> Thanks in advance,
>
>
>
> Shawn
>
>
>
>

Re: PPR effects on custom component

Posted by Adam Winer <aw...@gmail.com>.
What you need to do, at a minimum:

- In your Renderer, make sure that the root element
  passes the UIComponent to ResponseWriter.startElement(),
  and that a unique ID is written on that same root element.

If you do that, and just that, RequestContext.addPartialTarget() will
work.

If you want partialTriggers to work, then you need to:

- Add a partialTriggers attribute on your component
- If you don't extend from UIXComponentBase, copy the following code
  from UIXComponentBase.decode() to your decode() methods:

    Object triggers = getAttributes().get("partialTriggers");
    if (triggers instanceof String[])
    {
      RequestContext rc = RequestContext.getCurrentInstance();
      if (rc != null)
        rc.addPartialTriggerListeners(this, (String[]) triggers);
    }

And that's it!

-- Adam




On 3/9/07, Bertrand, Shawn R <sh...@tycoelectronics.com> wrote:
> Hi all,
>
>
>
> I have a custom component I've developed that I'd like to be able to
> refresh with PPR as a result of a selectOneChoice component trigger.
> The custom component simply outputs an HTML table at this point, so
> wouldn't I need to just wrap the custom tag with a panelGroup or some
> other component and make that component trigger off of the
> selectOneChoice?  Are there any requirements on the custom component
> side in order for PPR to work?
>
>
>
> Thanks in advance,
>
>
>
> Shawn
>
>
>
>