显示具有返回类型结果集的结果集

时间:2018-08-02 10:38:21

标签: java

我有ToDoList应用程序...

我有使用update Table1 as tt1 SET CREATED_BY = tt1.NAME FROM( SELECT t1.ID, t3.NAME FROM Table1 t1 INNER JOIN Table1_2_link t2 ON t1.id = t2.TABLE1_ID INNER JOIN Table2 t3 ON t2.TABLE2_ID = t3.ID) T where T.ID = tt1.ID 方法的ToDo类(bean)

getToDoList

我必须有toDoList控制器(Servlet):

public static ResultSet getToDoList() {
    try{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con=DriverManager.getConnection
                ("jdbc:mysql://localhost:3306/taskmanagment?useSSL=false","root","1234");
        Statement statement=con.createStatement();
        ResultSet toDoListForUser=statement.executeQuery("SELECT * FROM taskmanagment.`user-todolist` where username='kiavash';");
        return toDoListForUser;
    }catch(Exception e){
        e.printStackTrace();
    }
    return null;
}

,我想在 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ResultSet toDoList=ToDo.getToDoList(); HttpSession session = request.getSession(); try { while(toDoList.next()){ session.setAttribute("toDoList",toDoList); getServletContext() .getRequestDispatcher("/dashboard.jsp") .forward(request,response); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 中显示toDoList(resultset) 我该如何使用表达语言做到这一点

感谢您的帮助

0 个答案:

没有答案
相关问题