I want to wrap Bean with the rapper Bean who inherited org.apache.commons.beanutils.WrapDynaBean and display it in h:dataTable.
The following code does not allow WrapperBean to see the value of TestBean, so javax.el.PropertyNotFoundException occurs.Is there a solution?
Rapper Bean
public classWrapperBean extensionsWrapDynaBean{
// Table No.
private int no;
// setter, getter...
}
Bean wrapped
public class TestBean{
private String value;
// setter, getter...
}
Management Bean
public class TestController {
private List <WrapperBean>wbList;
@ PostConstract
private void init() {
// Wrap the TestBean that holds the contents of the table.
wbList.add(newWrapperBean(newTestBean("hoge"));
wbList.add(new WrapperBean(new TestBean("huga"));
wbList.add(newWrapperBean(newTestBean("piyo"));
}
}
test.xhtml
<h:dataTable value="#{testController.wbList}"var="row"
<h:column>
<h:outputText value="#{row.no}"/>
</h:column>
<h:column>
<h:outputText value="#{row.value}"/>
</h:column>
</h:dataTable>
Rewrite test.xhtml as shown below and you will see the output.
<h:dataTable value="#{testController.wbList}"var="row">
<h:column>
<h:outputText value="#{row.no}"/>
</h:column>
<h:column>
<h:outputText value="#{row.get('value')}"/gt;
</h:column>
</h:dataTable>
578 Understanding How to Configure Google API Key
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
914 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.