[richfaces-issues] [JBoss JIRA] Issue Comment Edited: (RF-10951) Dynamically created components lose CSS/JavaScript on POSTback
Richard Kennard (JIRA)
jira-events at lists.jboss.org
Sun May 1 21:26:24 EDT 2011
[ https://issues.jboss.org/browse/RF-10951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598597#comment-12598597 ]
Richard Kennard edited comment on RF-10951 at 5/1/11 9:25 PM:
--------------------------------------------------------------
Lukáš,
I've been experimenting some more and am thrilled to report MyFaces 2.0.5 (released a couple weeks ago, sorry I hadn't noticed) appears to fix this issue! So I guess it is a bug in MyFaces 2.0.4 (likely this one: https://issues.apache.org/jira/browse/MYFACES-3047). Maybe you could note that somewhere in the documentation?
However this had led to a related issue: dynamically created TabPanels can fail on POSTback. I attach a small sample app that demonstrates the problem. Deploy the app into Tomcat 6, then:
1. Go to http://localhost:8080/addressbook-myfaces2-richfaces/index.jsf
2. Click 'Mr Charles Montgomery Burns'
3. Click the 'Other' tab
4. Click 'Edit'
You will get:
Caused by: java.lang.NullPointerException
at org.richfaces.component.AbstractTabPanel.getActiveItem(AbstractTabPanel.java:64)
at org.richfaces.component.AbstractTogglePanel.encodeBegin(AbstractTogglePanel.java:168)
at org.metawidget.faces.FacesUtils.render(FacesUtils.java:94)
at org.metawidget.faces.renderkit.html.HtmlLayoutRenderer.layoutChild(HtmlLayoutRenderer.java:161)
I believe this is because the 'Other' tab is created (and recreated) dynamically in code, and so is not available to AbstractTabPanel.getActiveItem. I would be happy if AbstractTabPanel.getActiveItem just reverted back to the first tab in this case (which is what RichFaces 3.x did)
Regards,
Richard.
was (Author: kennardconsulting):
Lukáš,
I've been experimenting some more and am thrilled to report MyFaces 2.0.5 (released a couple weeks ago, sorry I hadn't noticed) appears to fix this issue! So I guess it is a bug in MyFaces 2.0.4 (and possibly before). Maybe you could note that somewhere in the documentation?
However this had led to a related issue: dynamically created TabPanels can fail on POSTback. I attach a small sample app that demonstrates the problem. Deploy the app into Tomcat 6, then:
1. Go to http://localhost:8080/addressbook-myfaces2-richfaces/index.jsf
2. Click 'Mr Charles Montgomery Burns'
3. Click the 'Other' tab
4. Click 'Edit'
You will get:
Caused by: java.lang.NullPointerException
at org.richfaces.component.AbstractTabPanel.getActiveItem(AbstractTabPanel.java:64)
at org.richfaces.component.AbstractTogglePanel.encodeBegin(AbstractTogglePanel.java:168)
at org.metawidget.faces.FacesUtils.render(FacesUtils.java:94)
at org.metawidget.faces.renderkit.html.HtmlLayoutRenderer.layoutChild(HtmlLayoutRenderer.java:161)
I believe this is because the 'Other' tab is created (and recreated) dynamically in code, and so is not available to AbstractTabPanel.getActiveItem. I would be happy if AbstractTabPanel.getActiveItem just reverted back to the first tab in this case (which is what RichFaces 3.x did)
Regards,
Richard.
> Dynamically created components lose CSS/JavaScript on POSTback
> --------------------------------------------------------------
>
> Key: RF-10951
> URL: https://issues.jboss.org/browse/RF-10951
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.0.0.Final
> Reporter: Richard Kennard
> Assignee: Lukáš Fryč
> Fix For: 4.1.0.Milestone1
>
> Attachments: addressbook-myfaces2-richfaces.war, RichFacesDynamicComponentTest.zip
>
>
> Hi guys,
> First, thanks for a great release in RichFaces 4!
> I have come across (what I think is) a bug and have put together a small test app that reproduces it. RichFaces components that are creating dynamically (programmatically) using...
> application.createComponent( context, componentType, rendererType )
> ...do not automatically re-inject their CSS/JavaScript resources into <h:head/> following a POSTback. For example, if an incorrect value is entered into a field and a validation error occurs, no programmatically created RichFaces components work when redisplayed. In fact, they may not redisplay at all (having lost their CSS).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list