[jboss-user] [JBoss Seam] - Problem with SortedMap and JSF

Zerg-Spirit do-not-reply at jboss.com
Wed May 2 11:07:50 EDT 2007


Hello.

I'm a beginner in the world of Seam, and I currently got a little problem.
Actually, I'm not sure if it's Seam related or not, but since this forum already helped me a lot, I thought I could start by posting here anyway.

So I basically have an entity bean, 'Topic', with a OneToMany relation to himself.
anonymous wrote : public class Topic implements Serializable {
  | 
  | 	@OneToMany(cascade = CascadeType.ALL)
  | 	@MapKey
  | 	@Sort(type = SortType.NATURAL)
  | 	private SortedMap<String, Topic> children;
  | ....

Basically, the goal is to have the list of every topics showed as a tree structure on the page.
So I simply find the root of all the topics, and start to recursively browse all the topics, but it just bugs directly after the root:

anonymous wrote : <ui:repeat var="topic" value="#{topicRoot.resultList}">
  |       <h:outputText>#{topic.keycode}</h:outputText> <--still working here!
  |       <ui:include src="recursionTestInclude.xhtml">
  |         <ui:param name="node" value="#{topic}"/>
  |       </ui:include>
  |       
  |  </ui:repeat>
  | 
the topicRoot is just and EntityQuery bean

Then the recursionTestInclude page...

anonymous wrote : <ui:repeat var="t" value="#{topic.children}">
  | <h:outputText value="#{t.keycode}"/>
  | </ui:repeat>
keycode is simple a property of topic, a String

The result is:

anonymous wrote : javax.faces.el.EvaluationException: /recursionTestInclude.xhtml @12,44 value="#{t.keycode}": Exception getting value of property keycode of base of type : org.hibernate.collection.PersistentSortedMap
  | 	at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
  | 	at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
  | 	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
  | 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
  | 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
  | 	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
  | 	at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:252)
  | 	at com.sun.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:52)
  | 	at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:357)
  | 	at com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:617)
  | 	at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
  | 	at com.sun.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:52)
  | 	at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:357)
  | 	at com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:617)
  | 	at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
  | 	at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
  | 	at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
  | 	at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
  | 	at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
  | 	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
  | 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
  | 	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
  | 	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  | 	at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
  | 	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  | 	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
  | 	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  | 	at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
  | 	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
  | 	at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
  | 	at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
  | 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
  | 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  | 	at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  | 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
  | 	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
  | 	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  | 	at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  | 	at java.lang.Thread.run(Thread.java:619)
  | Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
  | 	at java.lang.String.compareTo(String.java:92)
  | 	at java.util.TreeMap.getEntry(TreeMap.java:328)
  | 	at java.util.TreeMap.get(TreeMap.java:255)
  | 	at org.hibernate.collection.PersistentMap.get(PersistentMap.java:147)
  | 	at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:78)
  | 	at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
  | 	at com.sun.el.parser.AstValue.getValue(AstValue.java:125)
  | 	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:195)
  | 	at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
  | 	at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
  | 	... 56 more

The final goal is of course to call recursively the recursionTestInclude page for each child.

Actually, I know that I'm doing it wrong, but I tried several different things without being capable of extracting that damn keycode (or anything else) from than children list. 

Thank you.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042469#4042469

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042469



More information about the jboss-user mailing list