Hi,
I am new to struts.

I have retrieved the data in the ResultSet in the Action class, which gets
retrieved fine,

Now I want to display this data on the view.jsp page.

MyAction class is:
----------------------------------------------------------------------------------
public class ViewItemAction extends Action implements Serializable{
        public ViewItemAction () {
                System.out.println("Getting request Action 'View Item' 
Instantiated");
        }
        public ActionForward perform(ActionMapping mapping, ActionForm form,
                        HttpServletRequest request, HttpServletResponse 
response)
                        throws IOException, ServletException, SQLException, 
Exception {
                
                        System.out.println("inside perform");
                
                        EnterRecpietHandler erh=new EnterRecpietHandler();
                
                        ResultSet rs=erh.getData();
                
                
                        java.util.List resultsList =new ArrayList();
                        
                        System.out.println("Checkxx");
                        
                        while ( rs.next()==true ){
                                                                
                                ResultRecpietForm resultBean = new 
ResultRecpietForm();
                                                                
                                resultBean.setItem(rs.getString("item"));
                                                                
                                
resultBean.setPrice(String.valueOf(rs.getFloat("price")));
                                                         
                            resultsList.add(resultBean);
                
                        }       
                request.setAttribute("resultsList",resultsList);
        
                return mapping.findForward("sucess");
        }
}
--------------------------------------------------------------------------
"sucess" is mapped to view.jsp in strut-config-xml file

view.jsp is:
-------------------------------------------------------------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>

<html>
<head>
<title>List</title>
</head>
<body>

<table cellspacing="3" cellpadding="3" border="1" width="500">
<tr>
<td colspan="4">Customer </td>
</tr>
<tr>
<td>Item</td>
<td>Price</td>
</tr>
<c:forEach var="result" items="${requestScope.resultsList}">
<tr>
<td>${result.item}</td>
<td>${result.price}</td>
</tr>
</c:forEach>
</table>
</body>
</html>
-----------------------------------------------------------------------------------
Any help is greatly appreciated.
If someone can tell, what is wrong with, and why I cannot get any data on
view.jsp it will be very nice.

Best Regards
Mel
-- 
View this message in context: 
http://www.nabble.com/Struts-Populating-data-in-JSP-tf4533318.html#a12937235
Sent from the Struts - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to