//I have retrieved a Result from MySQL and created and Array-list User .i have sent this //US er Array-list in and sent it through request Response Object. Now i need to display iton //s JSP page.
//1.Without JSTL
//2.With JSTL

//The Name of table is user\_reg it has four fields id,username,password,email.
//please do explain with example. i need to dispay all fields in a jsp page. but i dont want //to do the jdbc work on the JSP 

```
 package kinder.dto;

    public class User {
        private String id;

    private String userName;
    private String saltedkey;
    private String emailId;
    private String legalName;

    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getLegalName() {
        return legalName;
    }
    public void setLegalName(String legalName) {
        this.legalName = legalName;
    }
    public String getEmailId() {
        return email;
    }enter code here`
    public void setEmailId(String emailId) {
        this.emailId = emailId;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getPassword() {
        return saltedkey;
    }
    public void setPassword(String password) {
        this.saltedkey = password;
    }

    }

    //dto

     package kinder.dto;

    public class User {
        private String id;

    private String userName;
    private String saltedkey;
    private String emailId;
    private String legalName;

    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getLegalName() {
        return legalName;
    }
    public void setLegalName(String legalName) {
        this.legalName = legalName;
    }
    public String getEmailId() {
        return emailId;
    }
    public void setEmailId(String emailId) {
        this.emailId = emailId;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getPassword() {
        return saltedkey;
    }
    public void setPassword(String password) {
        this.saltedkey = password;
    }

}

```

//servlet

```
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            List<User> users = UserDAO.list();
            request.setAttribute("users", users); // Will be available as ${products} in JSP
            request.getRequestDispatcher("loginSuccess.jsp").forward(request, response);
        } catch (SQLException | ClassNotFoundException e) {
            throw new ServletException("Cannot obtain products from DB", e);
        }
    }

```

//how to get this in a JSP page