public void getEvent(String tableClick) {
Events e = new Events();
try {
pst = conn.prepareStatement("SELECT * FROM Event WHERE eventID='"+tableClick+"' ");
rs = pst.executeQuery();
while(rs.next()){
e.setEventName(rs.getString(2));
System.out.println(rs.getString(2));
e.setEventDate(rs.getDate(3));
e.setEventTime(rs.getString(4));
e.setEventVenue(rs.getString(5));
e.setEventDetail(rs.getString(6));
e.setEventOpportunity(rs.getString(7));
e.setEventMoreDetails(rs.getString(8));
e.setEndTime(rs.getString(9));
rs.close();
pst.close();
}
}
catch(SQLException ex){
ex.printStackTrace();
}
} //end getEvent
Whilst the System.out.println(rs.getString(2)
print a value from database, I am unable to populate this information in my bean.
I am using mutators to populate the JavaBean
, but when I try to use the accessors in my View class of the MVC framework, it displays null
.
Here is my Call from VIEW class
Method in VIEW class
public void changeDisplay() {
Events e = new Events();
evTitle.setText(""+e.getEventName());
evWhen.setText("When: "+ e.getEventDate());
evWhere.setText("Where: "+ e.getEventVenue());
evDescription.setText("Description: "+ e.getEventDetail());
evOpportunity.setText("Opporunity: "+ e.getEventOpportunity());
evMoreDet.setText("More Details: "+ e.getEventMoreDetails());
}