-
1. Re: Ajax error when richFaces tabPanel includes a page fragm
nbelaevski Aug 24, 2008 1:40 PM (in response to sarahkarvenz)Hello,
That may happen if output of jspf file starts with<?xml ...
or<!DOCTYPE...
Can you please post complete HTML page source (use "view source" in browser)? -
2. Re: Ajax error when richFaces tabPanel includes a page fragm
sarahkarvenz Aug 25, 2008 11:30 AM (in response to sarahkarvenz)It looks like an <?xml version="1.0" encoding="UTF-8"?> gets put in there on the c:import. However, that line (automatically puts it at the top of a newly created fragment) has been removed from my fragments to that they look like this:
<div xmlns:f="http://java.sun.com/jsf/core" >
<f:subview id="tab2">
This is tab 2.
</f:subview>
No trailing or starting spaces or line breaks either.
Any idea on how I can stop it from adding in that extra xml declaration?
Thanks,
Sarah
Viewsource for page with imported fragments:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#" xmlns:waistate="http://www.w3.org/2005/07/aaa">
var webui_suntheme4_2={"webuiJsfx":false,"webuiAll":false,"theme":{"locale":"en-us"},"ajax":{"isJsfx":true},"isDebug":false,"isStyleSheet":true,"parseOnLoad":true};
<?xml version="1.0" encoding="UTF-8"?>
RichFaces.tabPanel['form1:allTabs:tbsMain']={'id':'form1:allTabs:tbsMain','ontabchange':''} ;<!--table border="0" cellpadding="0" cellspacing="0" style="position:relative;top:1px"--><table border="0" cellpadding="0" cellspacing="0" id="form1:allTabs:firstTab_shifted" onclick="if (RichFaces.isTabActive('form1:allTabs:firstTab_lbl')) return false; if (!RichFaces.onTabChange(event, 'form1:allTabs:tbsMain','form1:allTabs:firstTab')) return false;A4J.AJAX.Submit('j_id_id2','form1',event,{'parameters':{'form1:allTabs:firstTab':'form1:allTabs:firstTab'} ,'actionUrl':'/Test/faces/Page2.jsp'} ); return false; this.onclick = null;" style="position:relative; top:1px;;height : 100%; ">Tab 1<table border="0" cellpadding="0" cellspacing="0" id="form1:allTabs:secondTab_shifted" onclick="if (RichFaces.isTabActive('form1:allTabs:secondTab_lbl')) return false; if (!RichFaces.onTabChange(event, 'form1:allTabs:tbsMain','form1:allTabs:secondTab')) return false;A4J.AJAX.Submit('j_id_id2','form1',event,{'parameters':{'form1:allTabs:secondTab':'form1:allTabs:secondTab'} ,'actionUrl':'/Test/faces/Page2.jsp'} ); return false; this.onclick = null;" style="position:relative;;height : 100%; ">Tab 2RichFaces.panelTabs['form1:allTabs:tbsMain']=[{'cellActiveClass':'dr-tbpnl-tbcell-act rich-tabhdr-cell-active','id':'form1:allTabs:firstTab','cellInactiveClass':'dr-tbpnl-tbcell-inact rich-tabhdr-cell-inactive','activeClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-act rich-tab-active ','ontabenter':'','inactiveClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-inact rich-tab-inactive ','name':'firstTab','ontableave':''} ,{'cellActiveClass':'dr-tbpnl-tbcell-act rich-tabhdr-cell-active','id':'form1:allTabs:secondTab','cellInactiveClass':'dr-tbpnl-tbcell-inact rich-tabhdr-cell-inactive','activeClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-act rich-tab-active ','ontabenter':'','inactiveClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-inact rich-tab-inactive ','name':'secondTab','ontableave':''} ] ;<?xml version="1.0" encoding="UTF-8"?>
This is tab1
webui.suntheme4_2.dojo.addOnLoad(function() {new webui.suntheme4_2.body('/Page2.jsp', '/Test/faces/Page2.jsp',null,null,'com_sun_webui_util_FocusManager_focusElementId',true);});
Viewsource for page without including fragments (this one works):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#" xmlns:waistate="http://www.w3.org/2005/07/aaa">
var webui_suntheme4_2={"webuiJsfx":false,"webuiAll":false,"theme":{"locale":"en-us"},"ajax":{"isJsfx":true},"isDebug":false,"isStyleSheet":true,"parseOnLoad":true};
<?xml version="1.0" encoding="UTF-8"?>
RichFaces.tabPanel['form1:allTabs:tbsMain']={'ontabchange':'','id':'form1:allTabs:tbsMain'} ;<!--table border="0" cellpadding="0" cellspacing="0" style="position:relative;top:1px"--><table border="0" cellpadding="0" cellspacing="0" id="form1:allTabs:firstTab_shifted" onclick="if (RichFaces.isTabActive('form1:allTabs:firstTab_lbl')) return false; if (!RichFaces.onTabChange(event, 'form1:allTabs:tbsMain','form1:allTabs:firstTab')) return false;A4J.AJAX.Submit('j_id_id2','form1',event,{'parameters':{'form1:allTabs:firstTab':'form1:allTabs:firstTab'} ,'actionUrl':'/Test/faces/Page2.jsp'} ); return false; this.onclick = null;" style="position:relative; top:1px;;height : 100%; ">Tab 1<table border="0" cellpadding="0" cellspacing="0" id="form1:allTabs:secondTab_shifted" onclick="if (RichFaces.isTabActive('form1:allTabs:secondTab_lbl')) return false; if (!RichFaces.onTabChange(event, 'form1:allTabs:tbsMain','form1:allTabs:secondTab')) return false;A4J.AJAX.Submit('j_id_id2','form1',event,{'parameters':{'form1:allTabs:secondTab':'form1:allTabs:secondTab'} ,'actionUrl':'/Test/faces/Page2.jsp'} ); return false; this.onclick = null;" style="position:relative;;height : 100%; ">Tab 2RichFaces.panelTabs['form1:allTabs:tbsMain']=[{'name':'firstTab','id':'form1:allTabs:firstTab','ontabenter':'','activeClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-act rich-tab-active ','cellActiveClass':'dr-tbpnl-tbcell-act rich-tabhdr-cell-active','inactiveClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-inact rich-tab-inactive ','ontableave':'','cellInactiveClass':'dr-tbpnl-tbcell-inact rich-tabhdr-cell-inactive'} ,{'name':'secondTab','id':'form1:allTabs:secondTab','ontabenter':'','activeClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-act rich-tab-active ','cellActiveClass':'dr-tbpnl-tbcell-act rich-tabhdr-cell-active','inactiveClass':'dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-inact rich-tab-inactive ','ontableave':'','cellInactiveClass':'dr-tbpnl-tbcell-inact rich-tabhdr-cell-inactive'} ] ;
THIS IS THE FIRST TAB
webui.suntheme4_2.dojo.addOnLoad(function() {new webui.suntheme4_2.body('/Page2.jsp', '/Test/faces/Page2.jsp',null,null,'com_sun_webui_util_FocusManager_focusElementId',true);}); -
3. Re: Ajax error when richFaces tabPanel includes a page fragm
sarahkarvenz Aug 25, 2008 5:52 PM (in response to sarahkarvenz)Solved it!!
Problem was that an <?xml version="1.0" encoding="UTF-8"?> was getting inserted at the beginning of the page fragment on a c:import even though that line (automatically puts it at the top of a newly created fragment) had been removed from my fragments. This xml declaration was causing the xml parsing error that I was getting on the ajax request when I was trying to switch tabs.
By putting the following jsp declaration on the page fragment, I no longer got the <?xml... declaration:
<jsp:output omit-xml-declaration="true"/>
So my page fragment now looks like this:
<div xmlns:f="http://java.sun.com/jsf/core" xmlns:jsp="http://java.sun.com/JSP/Page">
<jsp:output omit-xml-declaration="true"/>
<f:subview id="tab2">
This is tab2.
</f:subview>