Bug 988401

Summary: RF-13107: rich:message in tabPanel is not shown if other message is not rendered
Product: [Retired] JBoss Enterprise WFK Platform 2 Reporter: Jonáš Trantina <jtrantin>
Component: RichFacesAssignee: Brian Leathem <bleathem>
Status: CLOSED UPSTREAM QA Contact: Pavol Pitonak <ppitonak>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.3.0CC: heiner.tittelbach, jhuska, jochen.riedlinger, jtrantin
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-11 06:44:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Reproducer application none

Description Jonáš Trantina 2013-07-25 14:17:22 UTC
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 16:33:20 UTC
Lukáš Fryč <lfryc> 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 07:31:07 UTC
Lukáš Fryč <lfryc> 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 07:43:12 UTC
Lukáš Fryč <lfryc> 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 07:44:14 UTC
Lukáš Fryč <lfryc> 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 07:48:02 UTC
Lukáš Fryč <lfryc> 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 07:50:01 UTC
Lukáš Fryč <lfryc> 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 14:57:34 UTC
Lukáš Fryč <lfryc> 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 14:57:45 UTC
Lukáš Fryč <lfryc> 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 07:19:47 UTC
Jonáš Trantina <jtrantin> 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 07:30:36 UTC
Jonáš Trantina <jtrantin> 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 12:09:15 UTC
Lukáš Fryč <lfryc> 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 12:10:02 UTC
Lukáš Fryč <lfryc> 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 12:10:17 UTC
Lukáš Fryč <lfryc> 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 12:28:55 UTC
Lukáš Fryč <lfryc> 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 14:05:30 UTC
Lukáš Fryč <lfryc> 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 14:08:41 UTC
Lukáš Fryč <lfryc> 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 14:23:02 UTC
Lukáš Fryč <lfryc> updated the status of jira RF-13107 to Coding In Progress

Comment 18 JBoss JIRA Server 2013-08-16 06:32:39 UTC
Lukáš Fryč <lfryc> updated the status of jira RF-13107 to Resolved

Comment 19 JBoss JIRA Server 2013-08-16 21:27:47 UTC
Brian Leathem <bleathem> 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 13:45:46 UTC
Pavol Pitonak <ppitonak> 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 06:44:57 UTC
We don't need one-off for now. Closing this bug.