File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Display struts output to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Display struts output to jsp" Watch "Display struts output to jsp" New topic

Display struts output to jsp

leo oke

Joined: Jul 09, 2007
Posts: 21
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");
return mapping.findForward("fail");

I agree. Here's the link:
subject: Display struts output to jsp
It's not a secret anymore!