This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 988401 - RF-13107: rich:message in tabPanel is not shown if other message is not rendered
RF-13107: rich:message in tabPanel is not shown if other message is not rendered
Status: CLOSED UPSTREAM
Product: JBoss Enterprise WFK Platform 2
Classification: JBoss
Component: RichFaces (Show other bugs)
2.3.0
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Brian Leathem
Pavol Pitonak
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-25 10:17 EDT by Jonáš Trantina
Modified: 2013-09-11 02:44 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-11 02:44:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Reproducer application (12.57 KB, application/zip)
2013-07-25 10:17 EDT, Jonáš Trantina
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker RF-13107 Major Resolved ajaxRenderer component are renderer even though they are in non-active switchable panel, causing JSF to fail to update D... 2013-11-13 06:44:22 EST

  None (edit)
Description Jonáš Trantina 2013-07-25 10:17:22 EDT
Created attachment 778274 [details]
Reproducer application

Description of problem:
We have a form with a tabPanel component with two tabs A and B. In A there is an input and its rich:message in B the same plus a button that submits and re-renders B. When B is opened (thus A is not rendered) and the form is submitted and validation fails, then no message is shown.
Note that:
1) switchType must be set to server to ensure the A's rich:message is really not on the page.
2) button in B must re-render only content of B
This is only a specific scenario, the issue might occur also in other situations (e.g. global messages tag outside of tabPanel is not rendered).
Please find the enclosed reproducer.

Version-Release number of selected component (if applicable):
RichFaces 4.3.2.Final

How reproducible:
Download reproducer and
1) mvn clean package and deploy on JBoss
2) go to http://localhost:8080/bug_reproducer/index.jsf
3) fill in surname longer that 10 chars & click-open the second tab
4) enter short name (shorter than 6)
5) click submit - no message is shown
Workaround:
1) Add ajaxRendered="false" to the first rich:message in index.xhtml.
2) follow the steps above
3) rich:message is shown
Comment 1 JBoss JIRA Server 2013-07-31 12:33:20 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

Hey Jonas, have you tried to observe any issues using e.g. these steps?

https://gist.github.com/lfryc/6123495
Comment 2 JBoss JIRA Server 2013-08-02 03:31:07 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

I have attached a <a4j:log mode="console" /> and now I can see this error:

{code}
RichFaces: New request added to queue. Queue requestGroupingId changed to j_idt14:j_idt18 log.js.jsf?ln=org.richfaces:153
RichFaces: Queue will wait 0ms before submit log.js.jsf?ln=org.richfaces:153
RichFaces: richfaces.queue: will submit request NOW log.js.jsf?ln=org.richfaces:153
RichFaces: Received 'begin' event from <input id=j_idt14:j_idt18 ...> log.js.jsf?ln=org.richfaces:153
RichFaces: Received 'beforedomupdate' event from <input id=j_idt14:j_idt18 ...> log.js.jsf?ln=org.richfaces:153
RichFaces: [object Object] log.js.jsf?ln=org.richfaces:153
RichFaces: [object Object] log.js.jsf?ln=org.richfaces:153
RichFaces: richfaces.queue: ajax submit error log.js.jsf?ln=org.richfaces:153
RichFaces: richfaces.queue: Nothing to submit log.js.jsf?ln=org.richfaces:153
RichFaces: Received 'error@malformedXML' event from <input id=j_idt14:j_idt18 ...> log.js.jsf?ln=org.richfaces:153
RichFaces: [200] undefined: undefined log.js.jsf?ln=org.richfaces:153
RichFaces: Received 'complete' event from <input id=j_idt14:j_idt18 ...> log.js.jsf?ln=org.richfaces:153
{code}
Comment 3 JBoss JIRA Server 2013-08-02 03:43:12 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The real error message revealed by debugging:

{code|title=jsf.js:2220}
 } catch (ex) {
                    sendError(request, context, "malformedXML", ex.message);
                    return;
                }
{code}

{{ex.essage}}: "During update: j_idt8:j_idt11 not found"
Comment 4 JBoss JIRA Server 2013-08-02 03:44:14 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The real error message revealed by debugging:

{code:title=jsf.js:2220}
 } catch (ex) {
                    sendError(request, context, "malformedXML", ex.message);
                    return;
                }
{code}

{{ex.message: "During update: j_idt8:j_idt11 not found"}}
Comment 5 JBoss JIRA Server 2013-08-02 03:48:02 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The {{j_idt8:j_idt11}} stands for the {{<rich:message for="surname"/>}}.

----

Workaround is using {{limitRender}}:

{code:xml}
<a4j:commandButton value="Submit" execute="content" render="content" limitRender="true" />
{code}
Comment 6 JBoss JIRA Server 2013-08-02 03:50:01 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The {{j_idt8:j_idt11}} stands for the {{<rich:message for="surname"/>}}.

----

Workaround is using {{limitRender}}:

{code:xml}
<a4j:commandButton value="Submit" execute="content" render="content" limitRender="true" />
{code}

Another workaround is using {{mode="ajax"}} for {{tabPanel}}:

{code:xml}
<rich:tabPanel switchType="ajax">
{code}
Comment 7 JBoss JIRA Server 2013-08-08 10:57:34 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

Note: Visitor which scans for ajaxRenderer components shouldn't descend to subtrees which are not renderered.
Comment 8 JBoss JIRA Server 2013-08-08 10:57:45 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

Idea: Visitor which scans for ajaxRenderer components shouldn't descend to subtrees which are not renderered.
Comment 9 JBoss JIRA Server 2013-08-12 03:19:47 EDT
Jonáš Trantina <jtrantin@redhat.com> made a comment on jira RF-13107

The customer is using switchType = "ajax" already and is experiencing the issue. However in a clean project it works just fine.
Comment 10 JBoss JIRA Server 2013-08-12 03:30:36 EDT
Jonáš Trantina <jtrantin@redhat.com> made a comment on jira RF-13107

I have attached reproducer, that shows the problem I described above. Tab panel with two tabs on each there is rich:message, when sending an ajax it says "During update: vertragsAuswahl:j_idt24 not found" where the ID is the rich:message in the non-visible tab.
Comment 11 JBoss JIRA Server 2013-08-15 08:09:15 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The issue is very similar to the {{mode=server}}: once the initial page is loaded, it does contain just a DOM for first tab (all others are loaded lazily as you switch to them).

That's why {{Submit}} works when you switch to second tab and then back. And that's also why it worked in previous sample with mode=ajax - we had reproduced on second tab and message on first tab.

It comes again to problem that {{ajaxRendered=true}} components shouldn't be rendered when they are not present on the page.

----

We can either

1. detect the presence of the ajax-rendered component on server-side

* no idea how we should know it was already rendered or not

2. we can intercept {{jsf.ajax.response}} and remove all irrelevant parts of partial-response

* in this case we should provide debug message that partial response is being stripped
Comment 12 JBoss JIRA Server 2013-08-15 08:10:02 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The issue is very similar to the {{mode=server}}: once the initial page is loaded, it does contain just a DOM for first tab - see attached image (all others are loaded lazily as you switch to them).

That's why {{Submit}} works when you switch to second tab and then back. And that's also why it worked in previous sample with mode=ajax - we had reproduced on second tab and message on first tab.

It comes again to problem that {{ajaxRendered=true}} components shouldn't be rendered when they are not present on the page.

----

We can either

1. detect the presence of the ajax-rendered component on server-side

* no idea how we should know it was already rendered or not

2. we can intercept {{jsf.ajax.response}} and remove all irrelevant parts of partial-response

* in this case we should provide debug message that partial response is being stripped
Comment 13 JBoss JIRA Server 2013-08-15 08:10:17 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

The issue is very similar to the {{mode=server}}: once the initial page is loaded, it does contain just a DOM for first tab - see attached image (all others are loaded lazily as you switch to them).

That's why {{Submit}} works when you switch to second tab and then back.

And that's also why it worked in previous sample with mode=ajax - we had reproduced on second tab and message on first tab.

It comes again to problem that {{ajaxRendered=true}} components shouldn't be rendered when they are not present on the page.

----

We can either

1. detect the presence of the ajax-rendered component on server-side

* no idea how we should know it was already rendered or not

2. we can intercept {{jsf.ajax.response}} and remove all irrelevant parts of partial-response

* in this case we should provide debug message that partial response is being stripped
Comment 14 JBoss JIRA Server 2013-08-15 08:28:55 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

Note that a workaround with {{limitRender=true}} still works here!
Comment 15 JBoss JIRA Server 2013-08-15 10:05:30 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

Interesting part is here: RenderVisitContext is extended visit context which visits all components which are {{ajaxRendered}}.

We should REJECT visiting of subtrees which are not active: there is a interface for switchable panels called [{{boolean AbstractTogglePanelItemInterface#shouldProcess();}}|https://github.com/richfaces/richfaces/blob/5.0.0.Alpha1/framework/src/main/java/org/richfaces/ui/toggle/AbstractTogglePanelItemInterface.java#L41].

It's [implemented by AbstractTab|https://github.com/richfaces/richfaces/blob/5.0.0.Alpha1/framework/src/main/java/org/richfaces/ui/toggle/tabPanel/AbstractTab.java#L225].

I suggest to generalize this shouldProcess method to {{ActivableComponent}} or {{SwitchableComponent}} interface
Comment 16 JBoss JIRA Server 2013-08-15 10:08:41 EDT
Lukáš Fryč <lfryc@redhat.com> made a comment on jira RF-13107

Interesting part is here: RenderVisitContext is extended visit context which visits all components which are {{ajaxRendered}}.

We should REJECT visiting of subtrees which are not active: there is a interface for switchable panels called [{{boolean AbstractTogglePanelItemInterface#shouldProcess();}}|https://github.com/richfaces/richfaces/blob/5.0.0.Alpha1/framework/src/main/java/org/richfaces/ui/toggle/AbstractTogglePanelItemInterface.java#L41].

It's [implemented by AbstractTab|https://github.com/richfaces/richfaces/blob/5.0.0.Alpha1/framework/src/main/java/org/richfaces/ui/toggle/tabPanel/AbstractTab.java#L225].

I suggest to generalize this shouldProcess method to {{ActivableComponent}} or {{SwitchableComponent}} interface

----

Note that we can't use {{isRendered}}, because the component is marked as {{rendered=true}} event though it's not active.
Comment 17 JBoss JIRA Server 2013-08-15 10:23:02 EDT
Lukáš Fryč <lfryc@redhat.com> updated the status of jira RF-13107 to Coding In Progress
Comment 18 JBoss JIRA Server 2013-08-16 02:32:39 EDT
Lukáš Fryč <lfryc@redhat.com> updated the status of jira RF-13107 to Resolved
Comment 19 JBoss JIRA Server 2013-08-16 17:27:47 EDT
Brian Leathem <bleathem@gmail.com> made a comment on jira RF-13107

The generalized API introduced is: VisitChildrenRejectable#shouldVisitChildren()

https://github.com/richfaces4/core/blob/master/api/src/main/java/org/richfaces/component/VisitChildrenRejectable.java
Comment 20 JBoss JIRA Server 2013-08-21 09:45:46 EDT
Pavol Pitonak <ppitonak@redhat.com> made a comment on jira RF-13107

Verified in 4.3.4, it's ready to be closed.
Comment 22 Jonáš Trantina 2013-09-11 02:44:57 EDT
We don't need one-off for now. Closing this bug.

Note You need to log in before you can comment on or make changes to this bug.