[
http://jira.jboss.com/jira/browse/RF-3512?page=comments#action_12413694 ]
Zied Hamdi commented on RF-3512:
--------------------------------
A workaround exists but it's very ugly and consists on repetitive buggy code it's
maybe better embedded in another component: (the rendered property is evaluated after the
el so it doesn't adress my problem). Here's the ugly solution:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jstl/core">
<f:view>
<a4j:loadStyle src="/styles/gisi.css"></a4j:loadStyle>
<ui:insert name="modalPanels" />
<body style="margin: 0; padding: 0;">
<h:form id="mainForm">
<ui:debug hotkey="e" rendered="true" />
<rich:tabPanel switchType="ajax"
binding="#{testController.tabPanel}">
<rich:tab id="tab1" label="tab1">
<c:if test="#{testController.tabPanel.selectedTab eq
'tab1'}">
<h:outputText value="#{testController.tab1Text}" />
</c:if>
</rich:tab>
<rich:tab id="tab2" label="tab2">
<c:if test="#{testController.tabPanel.selectedTab eq
'tab2'}">
<h:outputText value="#{testController.tab2Text}" />
</c:if>
</rich:tab>
<rich:tab label="tab3" id="tab3">
<c:if test="#{testController.tabPanel.selectedTab eq
'tab3'}">
<h:outputText value="#{testController.tab3Text}" />
</c:if>
</rich:tab>
</rich:tabPanel>
</h:form>
</body>
</f:view>
</html>
Notice the BB must initialize the selected tab to have its content displayed the first
time we open the page:
package net.gisiinteractive.common.test.jsf.richfaces;
import org.richfaces.component.html.HtmlTabPanel;
public class TestController {
private static org.apache.commons.logging.Log LOG =
org.apache.commons.logging.LogFactory
.getLog(TestController.class);
private HtmlTabPanel tabPanel = new HtmlTabPanel();
public TestController() {
tabPanel.setSelectedTab("tab1");
}
public String getTab1Text() {
String value = "displaying tab 1";
LOG.info(value);
return value;
}
public String getTab2Text() {
String value = "displaying tab 2";
LOG.info(value);
return value;
}
public String getTab3Text() {
String value = "displaying tab 3";
LOG.info(value);
return value;
}
public HtmlTabPanel getTabPanel() {
if (tabPanel != null)
return (HtmlTabPanel) tabPanel;
return tabPanel;
}
public void setTabPanel(HtmlTabPanel tabPanel) {
this.tabPanel = tabPanel;
}
}
tabPanel loads content of all tabs in server/ajax switchType mode
-----------------------------------------------------------------
Key: RF-3512
URL:
http://jira.jboss.com/jira/browse/RF-3512
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.2.0
Environment: Sun RI 1.2, tomcat 6
Reporter: Zied Hamdi
Content of all tabPanel tabs is encoded when displaying a tab: this bug becomes major if
our home page loads all data relative to the app. The following code demonstrates this
feature:
This is what we get in the log file: all tabs are loaded, then the one to display is
loaded again
INFO [gisiinteractive.common.test.jsf.richfaces.TestController] displaying tab 1
INFO [gisiinteractive.common.test.jsf.richfaces.TestController] displaying tab 2
INFO [gisiinteractive.common.test.jsf.richfaces.TestController] displaying tab 3
INFO [gisiinteractive.common.test.jsf.richfaces.TestController] displaying tab 1
For this code, I have no direct way to avoid this (I will try to enable/disable the
rendered attribute on each tab on display...) :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:jsp="http://java.sun.com/JSP/Page">
<f:view>
<a4j:loadStyle src="/styles/gisi.css"></a4j:loadStyle>
<ui:insert name="modalPanels" />
<body style="margin: 0; padding: 0;">
<h:form id="mainForm">
<ui:debug hotkey="e" rendered="true" />
<rich:tabPanel switchType="ajax">
<rich:tab label="tab1">
<h:outputText value="#{testController.tab1Text}"/>
</rich:tab>
<rich:tab label="tab2">
<h:outputText value="#{testController.tab2Text}"/>
</rich:tab>
<rich:tab label="tab3">
<h:outputText value="#{testController.tab3Text}"/>
</rich:tab>
</rich:tabPanel>
</h:form>
</body>
</f:view>
</html>
package net.gisiinteractive.common.test.jsf.richfaces;
public class TestController {
private static org.apache.commons.logging.Log LOG =
org.apache.commons.logging.LogFactory
.getLog(TestController.class);
public TestController() {
}
public String getTab1Text() {
String value = "displaying tab 1";
LOG.info(value);
return value;
}
public String getTab2Text() {
String value = "displaying tab 2";
LOG.info(value);
return value;
}
public String getTab3Text() {
String value = "displaying tab 3";
LOG.info(value);
return value;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira