I have code to retrieve a database item and it displays that in a mobile application using J2ME. I also use JSP for this so that my mobile app can get information from this.
I want to know how I can retrieve multiple items??
JavaBean:
public String doQuery() throws ClassNotFoundException, SQLException {
//register driver
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
//establish connection
Conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/a1electric?user=root&password=raam030");
//Create a Statement object from the Connection
Statement stmt = Conn.createStatement();
String sql = "SELECT JobID FROM employee WHERE employeeID=" +this.jobID;
ResultSet rs = stmt.executeQuery(sql);
String rt = "";
rs.next();
rt = rs.getString("JobID");
Conn.close();
return rt;
}
JSP Page:
<jsp:useBean id="bean0" scope="session" class="data.queryBean"/>
<jsp:setProperty name="bean0" property="jobID" param="jobID"/>
<%= bean0.doQuery() %>
I would like to retrieve all the job IDs for this employee ID and display it.