I am very new to JSF and PrimeFaces, so please forgive me if I sound naive. I just installed PrimeFaces 1.0.2 for JSF 1.2, read through the Getting Started Guide, and was able to test my PrimeFaces installation by successfully rendering <p:editor />. Unfortunately, I am having a problem with the basic usage of a standard dataTable.
I tried refactoring my code to fit the example on page 102 of the PrimeFaces User's Guide and also the basic dataTable example at the PrimeFaces Component Showcase. Unfortunately, I am getting the following 500 error from GlassFish 3.0.1:
Please note that I have tried replacing <h:outputText value="#{job.date_completed} " /> with <h:outputText value="#{job.fitness} " /> and received the error:javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'date_completed'.
My code is as followed. Thanks in advance for your help.javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'fitness'.
simulations.jsp
Code: Select all
...
<p:dataTable var="job" value="#{simMan.inst} " >
<p:column>
<f:facet name="header">
Date Completed
</f:facet>
<h:outputText value="#{job.date_completed} " />
</p:column>
<p:column>
<f:facet name="header">
Problem Instance ID
</f:facet>
<h:outputText value="#{job.probinstid} " />
</p:column>
<p:column>
<f:facet name="header">
Exceedances
</f:facet>
<h:outputText value="#{job.exceedances} " />
</p:column>
<p:column>
<f:facet name="header">
Fitness
</f:facet>
<h:outputText value="#{job.fitness} " />
</p:column>
</p:dataTable>
...
Code: Select all
...
public class SimulationManager implements Serializable {
...
public SimulationManager() throws SQLException {
df = new DateFormatter();
try {
populateInst(source);
} catch(Exception e) { }
}
private List<Instance> inst;
public List<Instance> getInst() {
return inst;
}
public void populateInst(DataSource src) throws SQLException {
Connection db = null;
db = src.getConnection();
String sql = "SELECT * FROM probinst WHERE problemid = " + problemid + " " +
"ORDER BY " + getInstSortby() + " " + getInstDirection();
ResultSet rs = db.createStatement().executeQuery(sql);
rs.last();
int numberOfRows = rs.getRow();
rs.beforeFirst();
inst = new ArrayList<Instance>();
while(rs.next())
inst.add(new Instance(rs.getRow(),
rs.getInt("probinstid"),
rs.getDate("date_completed").toString(),
rs.getTime("time_completed").toString(),
rs.getDouble("fitness"),
rs.getInt("exceedances"),
rs.getDouble("concmean"),
rs.getDouble("concstd"),
rs.getDouble("concmax"),
rs.getDouble("concmin"),
false));
rs.close();
db.close();
}
...
}
Code: Select all
package com.optimization;
public class Instance {
private Integer probinstid;
private String date_completed;
private String time_completed;
private Double fitness;
private Integer exceedances;
private Double concmean;
private Double concstd;
private Double concmax;
private Double concmin;
private boolean selected;
private Integer row;
public Instance() {
}
public Instance(Integer row, Integer probinstid, String date_completed, String time_completed, Double fitness, Integer exceedances, Double concmean, Double concstd, Double concmax, Double concmin, boolean selected) {
this.row = row;
this.probinstid = probinstid;
this.date_completed = date_completed;
this.time_completed = time_completed;
this.fitness = fitness;
this.exceedances = exceedances;
this.concmean = concmean;
this.concstd = concstd;
this.concmax = concmax;
this.concmin = concmin;
this.selected = selected;
}
public int getRow() {
return row;
}
public void setRow(Integer row) {
this.row = row;
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
public Double getConcmax() {
return concmax;
}
public void setConcmax(Double concmax) {
this.concmax = concmax;
}
public Double getConcmean() {
return concmean;
}
public void setConcmean(Double concmean) {
this.concmean = concmean;
}
public Double getConcmin() {
return concmin;
}
public void setConcmin(Double concmin) {
this.concmin = concmin;
}
public Double getConcstd() {
return concstd;
}
public void setConcstd(Double concstd) {
this.concstd = concstd;
}
public String getdate_completed() {
return date_completed;
}
public void setdate_completed(String date_completed) {
this.date_completed = date_completed;
}
public Integer getexceedances() {
return exceedances;
}
public void setexceedances(Integer exceedances) {
this.exceedances = exceedances;
}
public Double getFitness() {
return fitness;
}
public void setFitness(Double fitness) {
this.fitness = fitness;
}
public Integer getProbinstid() {
return probinstid;
}
public void setProbinstid(Integer probinstid) {
this.probinstid = probinstid;
}
public String gettime_completed() {
return time_completed;
}
public void settime_completed(String time_completed) {
this.time_completed = time_completed;
}
}