Hi Sandip,
the flow should be like.
1. from action class call you call method which in turn fetch the data from DB.
2. in that method, populate the data and the whole row should be added into 
object. something like
while(rs.next())
                           {
                                        m1 = new EmpModel(); // this is data 
object.
                                    m1.setEmpid(rs.getString(1)); // set data   
                                      m1.setLocation(rs.getString(2));
                                    m1.setDesignation(rs.getString(3));
                                    m1.setSalary(rs.getString(4));
                                    m1.setContactNumber(rs.getString(5));

                                    // verify it.
                                    
System.out.println(m1.getEmpid()+"-"+m1.getLocation()+"-"+m1.getDesignation()+"-"+m1.getSalary()+"-"+m1.getContactNumber());
                                    
                                    a1.add(m1);// add it to arraylist.
                           }
3. return the arraylist to action class.
4. set it to request Attribute.
5. on jsp page use <logic:iterate> to fetch it.
6. AtLast debug if any problem using scriplet.
Try it.


-----Original Message-----
From: Eider Iturbe [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 13, 2006 6:21 PM
To: Struts Users Mailing List
Subject: Re: Problem while using <logic:iterate>

Hi again,

Instead of using

ArrayList uservoList = new ArrayList();
request.setAttribute("listvo",uservoList);
you have to use this:

 *java.util.Collection* uservoList = new ArrayList();
request.setAttribute("listvo",uservoList);

Regards,

-- 
Eider


On 11/13/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:
>
> On 11/13/06, Eider Iturbe <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > You mustn“t add an ArrayList in request scope, you have to add a
> > Collection
> > of objects of the class "uservo" .
>
>
> Dont really know what you are trying to say. An arraylist would be a
> collection of uservo.
>
> ArrayList uservoList = new ArrayList();
> //populate list something like uservoList.add(new Uservo());
> request.setAttribute("listvo",uservoList);
>
> Thats it. Im all set to use an ArrayList i set in request scope.
>
> <logic:iterate id="uservo" name="listvo">
> <!--Some Processing-->
> </logic:iterate>
>
> Regards,
> >
> > --
> > Eider
> >
> >
> > On 11/13/06, santas <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > HI
> > >
> > > i tried what u said but stil the same error is shown to me
> > > i have set the list with key "users"
> > > then i first check
> > > <logic:present name="users">
> > > <table>
> > > <tr>
> > >   <th></th>
> > >    <th></th>
> > > </tr>
> > >      <logic:iterate id="listvo" name="users" type=" com.user.uservo">
> > > <tr>
> > > <td>
> > >     <bean:write name="listvo" property="firstname"/>
> > > </td>
> > > <td>
> > >     <bean:write name="listvo" property="lastname"/>
> > > </td>
> > > </tr>
> > > </table>
> > > </logic:present>
> > >
> > >
> > > and  again i got same error
> > > is there any other solution to this
> > >
> > >
> > >
> > >
> > >
> > > Sunita Ramchandra Shukla wrote:
> > > >
> > > >
> > > > Hi,
> > > > Try this .
> > > > <logic:iterate id="listvo" name="userList" type="com.user.UserModel
> ">
> > > > Here name attribute should be what you have set the key in request
> and
> > > > specify the location of your class in type w.r.t web application.
> > > > Rest is fine.
> > > > It should work.
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: santas [mailto: [EMAIL PROTECTED]
> > > >
> > > > Sent: Monday, November 13, 2006 4:07 PM
> > > > To: user@struts.apache.org
> > > > Subject: Problem while using <logic:iterate>
> > > >
> > > >
> > > > hi,
> > > >
> > > > I am having one problem while trying to use <logic:iterate> tag inmy
> > jsp
> > > >
> > > > i am using it as follows:-
> > > > <logic:iterate id ="listvo" name="users">
> > > >       <tr>
> > > >       <td>
> > > >               <bean:write  name="listvo" property="firstname"/>
> > > >       </td>
> > > >       </tr>
> > > > </logic:iterate>
> > > >
> > > > what i am doing is setting one ArrayList in request scope and in
> that
> > > > arraylist i am adding one object of
> > > >
> > > > a class "uservo" in which there are some properties
> > > > like:-firstname,lastname
> > > > etc of user
> > > >
> > > > what i am getting error is that:--
> > > > org.apache.jasper.JasperException: Cannot find bean: "listvo" in any
> > > > scope
> > > >
> > > > Please give me any possible solutions
> > > > thank you.
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > > View this message in context:
> > > >
> > http://www.nabble.com/Problem-while-using-%3Clogic%3Aiterate%3E-tf262135
> > >
> > > > 8.html#a7314626
> > > > Sent from the Struts - User mailing list archive at Nabble.com<
> > http://nabble.com/>
> > > .
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------------------------------
> > > > This message, including any attachments, contains confidential
> > > information
> > > > intended for a specific individual and purpose, and is intended for
> > the
> > > > addressee only. Any unauthorized disclosure, use, dissemination,
> > > copying,
> > > > or distribution of this message or any of its attachments or the
> > > > information contained in this e-mail, or the taking of any action
> > based
> > > on
> > > > it, is strictly prohibited. If you are not the intended recipient,
> > > please
> > > > notify the sender immediately by return e-mail and delete this
> > message.
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > >
> > > --
> > > View this message in context:
> >
> http://www.nabble.com/Problem-while-using-%3Clogic%3Aiterate%3E-tf2621358.html#a7315767
> > >
> > > Sent from the Struts - User mailing list archive at Nabble.com<
> > http://nabble.com/>
> > > .
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
>
> --
> Puneet
>
>

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

Reply via email to