Error while partial rendering component

UI Components for JSF
Post Reply
prophet
Posts: 92
Joined: 17 Mar 2011, 19:59

07 Sep 2011, 14:40

I have an error in firebug while navigating between links in my tree. When I select a row buttons must be enable, but it isn't so - and I have an error... My index page looks like (centre content is a partial rendering content ):

Code: Select all

....................
	<p:layout fullPage="true">

		<p:layoutUnit position="north" size="100" header="Top"
			collapsible="true" resizable="false" closable="false">
			<h:outputText value="Top unit content." />
		</p:layoutUnit>

		<p:layoutUnit position="west" size="200" header="Left"
			collapsible="true">
			<h:form>
				<ui:include src="components/west/tree.xhtml" />
			</h:form>
		</p:layoutUnit>

		<p:layoutUnit position="east" size="250" header="Token example"
			collapsible="true" effect="drop">
			<div id="infoApplet">
				<h:outputText value="Right unit content." />
			</div>
			<applet code="com.cargosoft.security.applet.HOTPApplet.class"
				archive="lib/HOTPApplet.jar, lib/beansbinding-1.2.1.jar, lib/commons-codec-1.4.jar"
				width="240" height="120" />
		</p:layoutUnit>

		<p:layoutUnit position="center">
			<h:panelGroup id="centerContent" layout="block">
				<p:growl id="error" globalOnly="true" showDetail="true"
					sticky="true" />
				<p:ajaxStatus id="statusCenter"
					style="width: 15px; height: 20px; float:left;">
					<f:facet name="start">
						<h:graphicImage value="images/ajaxloading.gif" />
					</f:facet>
					<f:facet name="complete">
						<h:outputText value="" />
					</f:facet>
				</p:ajaxStatus>
				<div id="centerPanel">
					<ui:include src="#{treeMenu.selectedPage}" />
				</div>
			</h:panelGroup>
		</p:layoutUnit>

	</p:layout>
........................
My tree:

Code: Select all

<h:body>
.............
	<p:tree id="tree" value="#{treeMenu.root}" var="node" 
		selection="#{treeMenu.selectedNode}" selectionMode="single"
		styleClass="navTree" cache="false">
		<p:ajax event="select" update="centerContent" listener="#{treeMenu.onTreeNodeClicked}" />  
		<p:treeNode>
			<h:outputText value="#{node}" />
		</p:treeNode>
	</p:tree>
</h:body>
.............
And my pages that are in centre content:

first.xhtml is very simple:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<h:body>
	<h2>#{msg.resynkHead}</h2>
	<div class="text">
		#{msg.genPassInfoFirst}<br />#{msg.genPassInfoSecond}
	</div>

</h:body>
</html>
and second.xhtml contains table with two buttons which become enable when user click on a table row:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
	<h:form>
		<p:dataTable var="token" value="#{tokenTable.list}" id="tokenTable"
			paginator="true" rows="30" rowsPerPageTemplate="30,50,100"
			paginatorTemplate="{FirstPageLink} {PreviousPageLink}
                     {PageLinks} {NextPageLink}
                     {LastPageLink} {RowsPerPageDropdown}"
			dynamic="true" styleClass="panel"
			emptyMessage="#{msg.emptyTableMessage}"
			selection="#{tokenTable.selectedToken}" selectionMode="single"
			rowKey="#{token.serial}">

			<p:ajax event="rowSelect" update="unbindUser, bindUser" />

			<f:facet name="header">
                #{msg.tableTitle}
            </f:facet>

			<p:column sortBy="#{token.serial}" filterBy="#{token.serial}">
				<f:facet name="header">
                    #{msg.serialHeader}
                </f:facet>
				<h:outputText value="#{token.serial}" />
			</p:column>

			<p:column filterBy="#{token.user.name}" sortBy="#{token}"
				sortFunction="#{tokenTable.sortByUser}">
				<f:facet name="header">
                    #{msg.userHeader}
                </f:facet>
				<h:outputText value="#{token.user.name}" />
			</p:column>

			<f:facet name="footer">
				<p:commandButton value="#{msg.bindButton}"
					image="ui-icon ui-icon-circle-check"
					oncomplete="bindDialog.show();" id="bindUser"
					disabled="#{tokenTable.selectedToken eq null}" />
				<p:commandButton value="#{msg.unBindButton}"
					image="ui-icon ui-icon-trash" oncomplete="cDialog.show();"
					id="unbindUser" disabled="#{tokenTable.selectedToken.user eq null}" />
			</f:facet>

		</p:dataTable>
		
	</h:form>
</h:body>
</html>
At first I have to notice that all this code works fine on PF-2.2.1. Now I use PF-3.0M3

When I start from first.xhtml (I mean It rendered in centre content) and then click on menu Item in tree, I see the content of second.xhtml in centre content. But when I click on table raw two my buttons remain disabled. And in fire bug I see response from server:

Code: Select all

<partial-response>
    <error>
        <error-name>class java.lang.ClassCastException</error-name>
        <error-message>javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;</error-message>
    </error>
</partial-response>
What is it? How can I resolve this problem?

If after that I press F5 to update my page, and then click on a raw of table all work fine, buttons become enable and no error. But when I navigate to first page and back to second all break again!

prophet
Posts: 92
Joined: 17 Mar 2011, 19:59

08 Sep 2011, 09:25

Solution - add in web.xml

Code: Select all

	<context-param>
		<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
		<param-value>false</param-value>
	</context-param>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 53 guests