ui parameter problem in p:ajax

UI Components for JSF
marco
Posts: 66
Joined: 14 Jun 2010, 17:25

17 Nov 2011, 18:42

Hi,

I'm using mojarra 2.1.3, jboss 6.1 and latest PrimeFaces 3.0.RC1-SNAPSHOT build.

currently I want to migrate my PF 2.2.1 project to PF 3.0 and I have a problem with ui-parameters set with <ui:param> and p:ajax.

My project heavily uses faclet templates. Severeal templates are used more in more than one view as they display the same datain the same way but different uses cases and therefore get the data from different controllers. The controller to use is set like this:

Code: Select all

<ui:param name="controller" value="#{rechnungEditController}" />
......
<h:comandLink value=#{controller.rechnungNummer} rendered="#{controller.isRechnungVisible}" />
That works in PF 2.2.1 and it also works in most cases for PF 3.0. The problem is, that the the ui-parameter can't be resolved when used in p:ajax like this:

Code: Select all

<p:tabView  activeIndex="#{controller.aktiveTabSeite}"
						dynamic="true" id="tab">
				<p:ajax event="tabChange" listener="#{controller.onTabChange}" />
				<p:tab title="#{controller.titelTab}" id="rechnungTab">
				......
				</p:tab>
				<p:tab title="Dokumente" id="dokTab"  rendered="#{!empty controller.rechnung.id and !controller.isLeistungsnachweis}">
				.........
				</p:tab>
</p:tabView>
The view is displayed correctly without an exception on the first tab page. But when I click on the second tab page I get the following exception:

Code: Select all

17:37:44,706 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] Target Unreachable, identifier 'controller' resolved to null: javax.el.PropertyNotFo
undException: Target Unreachable, identifier 'controller' resolved to null
        at org.apache.el.parser.AstValue.getTarget(AstValue.java:75) [:6.1.0.Final]
        at org.apache.el.parser.AstValue.invoke(AstValue.java:183) [:6.1.0.Final]
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [:6.1.0.Final]
        at org.primefaces.component.behavior.ajax.AjaxBehavior.broadcast(AjaxBehavior.java:193) [:]
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:760) [:2.1.3-SNAPSHOT]
        at javax.faces.component.UIData.broadcast(UIData.java:1071) [:2.1.3-SNAPSHOT]
        at javax.faces.component.UIData.broadcast(UIData.java:1093) [:2.1.3-SNAPSHOT]
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [:2.1.3-SNAPSHOT]
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [:2.1.3-SNAPSHOT]
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [:2.1.3-SNAPSHOT]
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [:2.1.3-SNAPSHOT]
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [:2.1.3-SNAPSHOT]
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [:2.1.3-SNAPSHOT]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
        at com.mareon.web.UnescapingBrowserEscapedPostParametersFilter.doFilter(UnescapingBrowserEscapedPostParametersFilter.java:101) [:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
        at com.mareon.hwa.filter.ReadOnlyUserDataServletFilter.doFilter(ReadOnlyUserDataServletFilter.java:46) [:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
        at de.mareon.db.DBConnectionControlListener.doFilter(DBConnectionControlListener.java:27) [:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
        at com.mareon.web.DefaultRequestCharacterEncodingFilter.doFilter(DefaultRequestCharacterEncodingFilter.java:103) [:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.1.0.Final]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [:6.1.0.Final]
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0.Final]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [:6.1.0.Final]
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0.Final]
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0.Final]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) [:6.1.0.Final]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]
        at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]
        at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]
When I change the p:ajax to the real name of the controller, it works:

Code: Select all

<p:ajax event="tabChange" listener="#{rechnungEditController.onTabChange}" />
But I can't use the template anymore for different views which rely on different controllers.

Any idea what the problem is?

Thanks
Marco

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

21 Nov 2011, 09:37

anyone, please? :-)

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

22 Nov 2011, 16:35

The problem is still there and I believe its a bug in p:ajax.

When I do something like this:


t like this:

Code: Select all

.....
<ui:param name="controller" value="#{rechnungEditController}" />
......
<p:tabView  activeIndex="#{controller.aktiveTabSeite}"
                  dynamic="true" id="tab">
            <p:ajax event="tabChange" listener="#{controller.onTabChange}" />
            <p:tab title="#{controller.titelTab}" id="rechnungTab">
            ......
            </p:tab>
            <p:tab title="Dokumente" id="dokTab"  rendered="#{!empty controller.rechnung.id and !controller.isLeistungsnachweis}">
            .........
            </p:tab>
</p:tabView>
the view is displayed fine but I get the above mentioned exception when I click on a tabpage because jsf can't find the name "controller" in the ajax request.

I can use the ui-parameter "{controller}" in all primefaces components, but p:ajax.

Should I open an issue for this?

Thanks,
Marco

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

22 Nov 2011, 22:53

You might want to enter the bug and see how PrimeFaces development responds in the bug/issue tracker. I've seen similar behavior with p:ajax for my use case, but i'm not using ui:param.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

03 Dec 2011, 14:48

Did you ever open a bug/issue for this, so primefaces development team can review this? I'm experiencing this behavior, now, because I wanted to use the following with p:tabView to update page via AJAX / Partial Page Refresh (PPR), but it seems as though, it modifies the value of ui:include src="#{bean.page}", and that is really really strange. Someone needs to open an bug/issue about this.

Code: Select all

 <p:ajax event="tabChange" update="..."/>
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

02 Jan 2012, 18:13

sorry, I never got around to post the issue because of christmas and holidays :(

Now that I'm the first day back in office I tested it right away with 3.0 final and its still not working. Opened an issue at http://code.google.com/p/primefaces/iss ... il?id=3210

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

02 Jan 2012, 20:07

marco, I'm revisiting this topic/issue of yours, and it was almost 1 month ago that I responded, but I wanted to see if we can come up with a workaround for this. Per my experience, I removed and decided not to rely on p:ajax event="tabChange". I was looking at your code and had a few suggestions.

First, please reply with the entire bean that is accessed via the following xhtml, and please use the Code button above the editor here when responding, which will allow you to embed your bean code inside of Code tags.

Code: Select all

<ui:param name="controller" value="#{rechnungEditController}" />
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

03 Jan 2012, 10:39

smithh032772 wrote:marco, I'm revisiting this topic/issue of yours, and it was almost 1 month ago that I responded, but I wanted to see if we can come up with a workaround for this. Per my experience, I removed and decided not to rely on p:ajax event="tabChange". I was looking at your code and had a few suggestions.

First, please reply with the entire bean that is accessed via the following xhtml, and please use the Code button above the editor here when responding, which will allow you to embed your bean code inside of Code tags.

Code: Select all

<ui:param name="controller" value="#{rechnungEditController}" />
The entire bean is *quite* large (1200 LoC) and is extending a (helper) base class, so I can't really post the whole bean.

Have you seen my issue? I attached a very basic sample project there, where you can see sample code to reproduce the problem. I *think* it may have to do with templating as I couldn't reproduce it with just a simple jsf page, but had to use at least one template (which we use very heavily in our production code).

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

03 Jan 2012, 18:52

Can you try f:ajax event="tabChange"? I saw another post earlier this morning, that someone tried it, and f:ajax event="tabChange" works fine. I think it was another issue, but I wonder if it will work for this issue that we are discussing.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

marco
Posts: 66
Joined: 14 Jun 2010, 17:25

04 Jan 2012, 10:32

Cagatay asked me the same question in the issue discussion :)

Yes it works, at least the listener method is called correctly.

But it has some drawback, as the rendering of the tabview is problematic. I have to add render="idOfTabView"when dynamic tabs are activated. Because f:ajax doesn't render the newly opened tab view automatically when I click on it. So with every tabchange the tabview is rendered new and nothing is cached.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests