Well, this mistake is undoubtedly caused by the fact that I made some mistake. Here is my code below.
Servlet:
package Servlets;
public class AdminResource extends HttpServlet {
List<userList> users = new ArrayList<>();
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Database db = (Database) getServletContext().getAttribute("db");
String sql = "select * from TAHMID_NIPS.GROUPS";
ResultSet rs;
try {
rs = db.runSql(sql);
while (rs.next()) {
userList user = new userList(rs.getString("USERNAME"), rs.getString("GROUPID"));
users.add(user);
}
request.setAttribute("users", users);
request.getRequestDispatcher("userList.jsp").forward(request, response);
} catch(SQLException ex){}
}
}
JavaBean Class ::
public class userList {
private String GroupID;
private String UserName;
public userList(String GroupID, String UserName){
this.GroupID = GroupID;
this.UserName = UserName;
}
public String getGroupID() {
return GroupID;
}
public void setGroupID(String GroupID) {
this.GroupID = GroupID;
}
public String getUserName() {
return UserName;
}
public void setUserName(String UserName) {
this.UserName = UserName;
}
}
JSP Submission Submitted:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>These are the users in the database!</h1><br>
<c:forEach var="iterator" items="${users}">
<c:out value="${iterator.UserName}"/> <br>
</c:forEach>
</body>
</html>
The database URL, passwords, and other required information are declared in the web.xml file and the contextListener class is implemented. The application worked fine when the data showed up in the servlet. But since we are fans of MVC, the problem arose when I tried to access the bean using EL. Fields were not available.
About the database:
Here is a table with group names with two fields: UserName, GroupID. But none of them appear in the JSP view.
A problem may arise in EL in the JSP representation. Experts, please help.