我的Servlet DAO中有此代码,我想从2个表中进行数据
但是目前我不知道如何将数据设置在一起,以便于在JSP中轻松显示
public List<EventBean> getAllEventInOu() {
List<EventBean> events = new ArrayList<EventBean>();
try {
currentCon = ConnectionManager.getConnection();
stmt = currentCon.createStatement();
String q = "select eventid,eventname,eventstaffincharges,eventfee,to_char(eventdatestarttime, 'DD-MON-YYYY HH:MM') as eventdatestarttime,to_char(eventdateendtime, 'DD-MON-YYYY HH:MM') as eventdateendtime,staffid,indoorvenue,indoorguestname\r\n" +
"from event \r\n" +
"join indoor \r\n" +
"using (eventid)";
ResultSet rs = stmt.executeQuery(q);
while (rs.next()) {
EventBean event = new EventBean();
IndoorEventBean ievent = new IndoorEventBean();
event.setEventid(rs.getString("eventid"));
event.setEventname(rs.getString("eventname"));
event.setEventstaffincharges(rs.getString("eventstaffincharges"));
event.setEventfee(rs.getInt("eventfee"));
event.setEventdatestarttime(rs.getString("eventdatestarttime"));
event.setEventdateendtime(rs.getString("eventdateendtime"));
event.setStaffid(rs.getString("staffid"));
ievent.setIndoorvenue(rs.getString("indoorvenue"));
ievent.setIndoorguestname(rs.getString("indoorguestname"));
events.add(event);
}
} catch (SQLException e) {
e.printStackTrace();
}
return events;
}