hi all I am new to JSTL ,
I need to display content in JSP using JSTL.
Its Student information project I have list of students , i need to display them in jsp using jstl,
my servlet code
try {
UserList userList = dataCon.getListUsers(strClassId);
session.setAttribute("userList",userList);
response.sendRedirect("/CMS/classsearch.jsp");
} catch (Exception e) {
}
}
my database connicitivity class
public UserList getListUsers(String classId) {
UserList userList=new UserList();
ArrayList<User> listUsers= new ArrayList<User>();
sql ="SELECT um.`UserId`,um.`FirstName`,um.`LastName`,um.`Address1`,um.`Address2`,um.`City`,um.`State`,um.`DOB`,um.`MailId`,at.Authorization FROM `usermaster`as um JOIN authorizationmapping as am ON um.`UserId`=am.`UserId` JOIN authorizationmaster as at ON am.`AuthorizationId`=at.AuthorizationId JOIN studentallocation as st ON st.stuid=um.`UserId` where st.classid=?";
try {
pstm = con.prepareStatement(sql);
pstm.setString(1, classId);
rs = pstm.executeQuery();
while (rs.next()) {
User user = new User();
user.setUserId(rs.getString(1));
user.setFirstName(rs.getString(2));
user.setLastName(rs.getString(3));
user.setAddress1(rs.getString(4));
user.setAddress2(rs.getString(5));
user.setCity(rs.getString(6));
user.setState(rs.getString(7));
user.setDOB(rs.getString(8));
user.setMailId(rs.getString(9));
user.setAuthorization(rs.getString(10));
listUsers.add(user);
}
userList.setListUser(listUsers);
} catch (Exception e) {
System.out.println("Error in sql statement"+ e.getMessage());
}
return userList;
}
Could any one guide me