See below... > -----Original Message----- > From: sushil jain [mailto:[EMAIL PROTECTED] > Sent: July 3, 2003 11:26 PM > To: Struts Users Mailing List > Subject: NewBie:Populating objects in Jsp > > > Hello, > I am new to struts and Jsp and facing a very basic problem :- > The requirement is that on submit of APFM01.jsp page I do some > business processing and populate a ArrayList in the action Class > APFM01Action. Now I want to display the contents of the ArrayList > as table in the second page APFM02.jsp. I am trying to do so by > using the iterate tag in the APFM02.jsp but getting the following > errors :- > Since fork is true, ignoring compiler setting. > [javac] Compiling 1 source file > [javac] Since fork is true, ignoring compiler setting. > [javac] > E:\jakarta-tomcat-4.1.24\work\Standalone\localhost\myProject\APFM0 > 2_jsp.java:424: cannot resolve symbol > [javac] symbol : class APFM01Action > [javac] location: class org.apache.jsp.APFM02_jsp > [javac] APFM01Action pupilList = null; > [javac] ^ > [javac] > E:\jakarta-tomcat-4.1.24\work\Standalone\localhost\myProject\APFM0 > 2_jsp.java:431: cannot resolve symbol > [javac] symbol : class APFM01Action > [javac] location: class org.apache.jsp.APFM02_jsp > [javac] pupilList = (APFM01Action) > pageContext.findAttribute("pupilList"); > [javac] ^ > [javac] > E:\jakarta-tomcat-4.1.24\work\Standalone\localhost\myProject\APFM0 > 2_jsp.java:457: cannot resolve symbol > [javac] symbol : class APFM01Action > [javac] location: class org.apache.jsp.APFM02_jsp > [javac] pupilList = (APFM01Action) > pageContext.findAttribute("pupilList"); > [javac] ^ > [javac] 3 errors > > In the APFM01Action class Iam doing the following :- > > SAXParser myParser = new MySAXParser(); > myParser.ParseXML(browse); > ArrayList pupilList= myParser.listPupil(); > request.setAttribute("PUPIL_LIST",pupilList); > return(mapping.findForward("success")); > > The APFM02.jsp code is as follows :- > > <logic:iterate id="pupilList" name= "PUPIL_LIST" type="APFM01Action">
Type should be the type of object that is your List (e.g. Pupil) , not the Action type. You probably don't even need to specify a type here because <bean:write> will use introspection to access the properties. Incidentally, 'pupil' might be a better value for the id because you are only accessing a single pupil in each iteration, not a list. > <tr align="left"> > <td> > <bean:write name="pupilList" property="upn" /> > </td> > <td> > > and the Struts-config file is as follows :- > > <form-bean name="APFM01Form" > type="APFM01Form"/> > <form-bean name="APFM02Form" > type="APFM02Form"/> > </form-beans> > > <!-- ========== Action Mapping Definitions > ============================== --> > <action-mappings> > <action path="/APFM01" > type="APFM01Action" > name="APFM01Form" > input="/APFM01.jsp" > scope="session"> > <forward name="success" path="/APFM02.jsp"/> > <forward name="failure" path="/APFM01.jsp"/> > </action> > <action path="/APFM02" > type="APFM02Action" > name="APFM02Form" > scope="request"> > </action> > > Thanks > Sushil > > > --------------------------------- > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! Steve --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

