Hello,
I can display everything from a table to a
jsp, but if i want to only display some of the data based on a query, how can I do that? I tried to pass a
string from the jsp to the bean which is connected to the database, but it does not work.
public ResultSet viewQuery( String subject ) throws SQLException, Exception{
ResultSet rst = null;
try{
String queryString = ("select " + subject + "from Post;");
Statement stmt = con.createStatement();
rst = stmt.executeQuery(queryString);
}
catch (SQLException sqle){
error="SQL Exception";
}
catch (Exception e){
error="An exception occured";
}
return rst;
}