このガイドを複製しようとしていますが、jsf 2.2 を使用しています。
http://www.mkyong.com/jsf2/jsf-2-datatable-example/
私の現在のセットアップ: Message というクラスは、日付、文字列、および「name」(その所有者) というアカウント オブジェクトを保持します。MessageBean クラスには List オブジェクト messageSet があり、MessageBean コンストラクターで初期化されます。JSF ページは、テーブルに messageList を入力します。ただし、テーブルはいっぱいになりません。デバッガーでリスト オブジェクトを見ると、有効なメッセージ オブジェクトで満たされています。私のクラス: @Named(value = "messageBean") @SessionScoped public class MessageBean implements Serializable { private List messageSet;
public MessageBean()
{
this.messageSet = Controller.Controller.getLatestKweks();
}
public List<Message> getMessageSet()
{
return messageSet;
}
public void setMessageSet(List<Message> messageSet)
{
this.messageSet = messageSet;
}
}
JSF ページ:
<h:dataTable value="#{messageBean.messageSet}" var="mes">
<h:column>
<f:facet name="header">Date</f:facet>
#{mes.mesDate}
</h:column>
<h:column>
<f:facet name="header">Naam</f:facet>
#{mes.name.accountName}
</h:column>
<h:column>
<f:facet name="header">Content</f:facet>
#{mes.Content}
</h:column>
</h:dataTable>
Hibernate オブジェクトである 2 番目の Message オブジェクトがあり、getter と setter のみが含まれています。
このページにアクセスしようとしたときのスタックトレースは次のとおりです。
java.lang.NumberFormatException: For input string: "mesDate"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at javax.el.ArrayELResolver.toInteger(ArrayELResolver.java:378)
at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:198)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
at com.sun.el.parser.AstValue.getValue(AstValue.java:204)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:227)
at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:150)
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
at com.sun.faces.renderkit.html_basic.TableRenderer.renderRow(TableRenderer.java:385)
at com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:162)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
コンポーネントツリー:
<UIViewRoot id="j_id1" inView="true" locale="en_GB" renderKitId="HTML_BASIC" rendered="true" transient="false" viewId="/hoofdpagina.xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
<UIOutput id="j_idt2" inView="true" rendered="true" transient="false">
<title>Main page</title>
</UIOutput>
<UIOutput id="j_idt4" inView="true" rendered="true" transient="false">
<div id="menu">top</div> <div id="currentMessages">
<HtmlDataTable border="-2147483648" first="0" id="j_idt6" inView="true" rendered="true" rowIndex="0" rowStatePreserved="false" rows="0" transient="false" var="mes">
<UIColumn header="Datum" id="j_idt7" inView="true" rendered="true" transient="false">
header
Date
#{mes.mesDate}
</UIColumn>
<UIColumn header="Name" id="j_idt10" inView="true" rendered="true" transient="false">
header
Name
#{mes.name.accountName}
</UIColumn>
<UIColumn header="Inhoud" id="j_idt13" inView="true" rendered="true" transient="false">
header
Content
#{mes.mesContent}
</UIColumn>
</HtmlDataTable>
</div>
</UIOutput>
</html>
</UIViewRoot>
そして、スコープ変数:
Name Value
j_idt6 j_idt6
j_idt6:j_idt10 bread
j_idt6:j_idt12 Log in
j_idt6:j_idt8 Donald
AttributesName Value
None
Request AttributesName Value
kwek [Ljava.lang.Object;@a5c775c
Flash AttributesName Value
None
Session AttributesName Value
None
Application AttributesName Value
csfcff [ ]
テーブルがいっぱいにならない理由を知っている人はいますか?