Treeview problems with 2.5.6

UI Components for JSF
Post Reply
kya
Posts: 31
Joined: 08 Oct 2010, 10:57

27 Oct 2010, 08:52

Hi,
I am trying a simple Treeview example which works well with Spring 3.0.2, but as soon as I change my pom.xml to use Spring 2.5.6 (a project requirement) the tree is not generated, the HTML shows a blank screen and Appserver Logs (Glassfish) don't show any errors whatsoever. The only difference I see is in the source of the generated HTML's (see below) which seem to have generated extra parameters for the PrimeFaces.widget.TreeView JS object in the Spring 3.0.2 case. Any Ideas?


Here is the .xhtml:

Code: Select all

<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Tree</title>
 <h:outputStylesheet name="styles/tree.css"/>
</h:head>
<body>
<h:form>
<p:tree value="#{treeBean.root}" var="node" dynamic="true" cache="false"
        nodeSelectListener="#{treeBean.onNodeSelect}"
        nodeExpandListener="#{treeBean.onNodeExpand}"
        nodeCollapseListener="#{treeBean.onNodeCollapse}"
        selectionMode="single"
        selection="#{treeBean.selectedNodes}">
<p:treeNode>
<h:outputText value="#{node}"/>
</p:treeNode>
</p:tree>
</h:form>
</body>
</html>
here is the generate HTML for Spring 3.0.2:

Code: Select all

<html xmlns="http://www.w3c.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><link type="text/css" rel="stylesheet" href="Tree.html_files/tree.css">
<link rel="stylesheet" type="text/css" href="Tree.html_files/treeview.css">
<script type="text/javascript" src="Tree.html_files/utilities.js"></script>
<script type="text/javascript" src="Tree.html_files/treeview-min.js"></script>
<script type="text/javascript" src="Tree.html_files/jquery.js"></script>
<script type="text/javascript" src="Tree.html_files/core.js"></script>
<script type="text/javascript" src="Tree.html_files/treeview.js"></script>
<title>Tree</title></head><div firebugversion="1.5.0" style="display: none;" id="_firebugConsole"></div><body class="yui-skin-sam">
<form id="j_idt6" name="j_idt6" method="post" action="/tree/tree.xhtml" enctype="application/x-www-form-urlencoded">
<input name="j_idt6" value="j_idt6" type="hidden">
<div id="j_idt6:j_idt7"><div id="j_idt6:j_idt7_container" class="ygtv-highlight"><div class="ygtvitem" id="ygtv0"><div class="ygtvchildren" id="ygtvc0"><div class="ygtvitem" id="ygtv1"><table id="ygtvtableel1" class="ygtvtable ygtvdepth0 ygtv-highlight0" border="0" cellpadding="0" cellspacing="0"><tbody><tr class="ygtvrow"><td id="ygtvt1" class="ygtvcell ygtvlp"><a href="#" class="ygtvspacer">&nbsp;</a></td><td id="ygtvcontentel1" class="ygtvcell ygtvhtml ygtvcontent">Tree</td></tr></tbody></table><div class="ygtvchildren" id="ygtvc1" style="display: none;"></div></div></div></div></div><input id="j_idt6:j_idt7_selection" name="j_idt6:j_idt7_selection" type="hidden"></div><script type="text/javascript">widget_j_idt6_j_idt7 = new PrimeFaces.widget.TreeView('j_idt6:j_idt7', [
{html:'Tree',type:'html',rowKey:'0'}],{dynamic:true,actionURL:'/tree/tree.xhtml',formId:'j_idt6',cache:false,selectionMode:'single',propagateHighlightDown:false,propagateHighlightUp:false,hasSelectListener:true,hasExpandListener:true,hasCollapseListener:true});
widget_j_idt6_j_idt7.render();
</script><input name="javax.faces.ViewState" id="javax.faces.ViewState" value="8824462922672233215:7535153392270493362" autocomplete="off" type="hidden">
</form>
</body></html>
Here is the generated HTML for spring 2.5.6:

Code: Select all

<html xmlns="http://www.w3c.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><link type="text/css" rel="stylesheet" href="Tree.html_files/tree.css">
<link rel="stylesheet" type="text/css" href="Tree.html_files/treeview.css">
<script type="text/javascript" src="Tree.html_files/utilities.js"></script>
<script type="text/javascript" src="Tree.html_files/treeview-min.js"></script>
<script type="text/javascript" src="Tree.html_files/jquery.js"></script>
<script type="text/javascript" src="Tree.html_files/core.js"></script>
<script type="text/javascript" src="Tree.html_files/treeview.js"></script>
<title>Tree</title></head><div firebugversion="1.5.0" style="display: none;" id="_firebugConsole"></div><body class="yui-skin-sam">
<form id="j_idt6" name="j_idt6" method="post" action="/tree/tree.xhtml" enctype="application/x-www-form-urlencoded">
<input name="j_idt6" value="j_idt6" type="hidden">
<div id="j_idt6:j_idt7"><div id="j_idt6:j_idt7_container" class="ygtv-highlight"><div class="ygtvitem" id="ygtv0"><div class="ygtvchildren" id="ygtvc0" style="display: none;"></div></div></div><input id="j_idt6:j_idt7_selection" name="j_idt6:j_idt7_selection" type="hidden"></div><script type="text/javascript">widget_j_idt6_j_idt7 = new PrimeFaces.widget.TreeView('j_idt6:j_idt7', [
],{dynamic:true,actionURL:'/tree/tree.xhtml',formId:'j_idt6',cache:false,selectionMode:'single',propagateHighlightDown:false,propagateHighlightUp:false,hasSelectListener:true,hasExpandListener:true,hasCollapseListener:true});
widget_j_idt6_j_idt7.render();
</script><input name="javax.faces.ViewState" id="javax.faces.ViewState" value="8104560892710600402:-107402970235525629" autocomplete="off" type="hidden">
</form>
</body></html>

kya
Posts: 31
Joined: 08 Oct 2010, 10:57

27 Oct 2010, 09:20

never mind: I was using '<context:component-scan ...' in spring-config.xml to load my Tree bean, as soon as I switched to to '<bean id=...' everything worked.

kya
Posts: 31
Joined: 08 Oct 2010, 10:57

27 Oct 2010, 09:24

I have to add though that according to spring 2.5.6 Docs, '<component-scan ...' is a valid way to load beans. So I am still perplexed as to why this failed. I like to use annotations to declare beans so it is sad that this failed. Is this a problem in Spring or in Primefaces? any ideas?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Oct 2010, 10:05

Have you defined SpringFacesELResolver?

kya
Posts: 31
Joined: 08 Oct 2010, 10:57

27 Oct 2010, 11:42

I had this defined:

<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests