How to use JSTL sql tag

后端 未结 3 598
逝去的感伤
逝去的感伤 2021-01-20 02:32
<%@taglib prefix=\"c\" uri=\"http://java.sun.com/jsp/jstl/core\" %>
<%@taglib prefix=\"sql\" uri=\"http://java.sun.com/jstl/sql\" %>



        
3条回答
  •  日久生厌
    2021-01-20 02:46

    My advice would be to forget about the tags completely, and to make all your database operations in plain Java (in a servlet or action of your preferred MVC framework). This servlet would build a list of bean instances, ready to be displayed by your JSP. Use RequestDispatcher to dispatch the request to the JSP from the servlet.

    Even the official Java EE tutorial says:

    The JSTL SQL tags for accessing databases listed in Table 7-7 are designed for quick prototyping and simple applications. For production applications, database operations are normally encapsulated in JavaBeans components.

提交回复
热议问题