I am trying to display userList from my
struts action to
jsp page,what's the code to do it using
java beans or something simple?
part code:
action class
------------------------------------------------------------------------------------------------------------------------
public ArrayList userList = new ArrayList();
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
//get connection from database
javax.sql.DataSource dataSource;
java.sql.Connection myConnection = null;
// Here the method that connects to the datasource is called:
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
UserDAO dao = DAOFactory.createUserDAO(myConnection);
userList = dao.getUser();
HttpSession session = request.getSession();
// extract data
if(userList !=null){
//code here
return mapping.findForward("success");
}else{
return mapping.findForward("fail");
}
}