It is little complex to extract data from database on to jsp page.I would
say that Go ahead step by step. I am sure will get touch with struts.
Step1.

You create ActionFrombean class (getter & setter methods).
2)
make a connection pool with database by using struts-config file(Datasource
elements);
3)declare bean class in form-bean section.
4) Create Action class & use connection pool in this class.Extract field
from database & put in setter methods & then put in ArrayList or Vector
whichever u think suitable.
& add in to session. return ActionForward.
5)Declare the Action class & formbean's logical name.
& forward name & jsp page
6) Create jsp page & use <logic:iterate> tag & <bean:write> tags.

If u go through this process , I am sure u will get ur desired results.If u
have any problem , feel free to contact.
09818760086


On 4/24/06, Vinit Sharma <[EMAIL PROTECTED]> wrote:

You are using Map-Backed action form. This link might solve your problem:


http://struts.apache.org/struts-action/userGuide/building_controller.html#map_action_form_classes

http://struts.apache.org/struts-doc-1.2.9/faqs/indexedprops.html

HTH,


On 4/22/06, Developer Developer <[EMAIL PROTECTED]> wrote:
>
> Harsh and Ted,
> Thanks for the information  Here is one more question. I am able to
create
> an ActionForm with a collection type attribute in it ( Vector) and also
> i could link it to the table in the JSP.  I am getting an error "No
getter
> method for property vSectors of bean sectorData". Do you know what i
must
> have done wrong ? the actionForm has getter and setter for a variable
> named  Vector vSectors in the actionform SectorData.
>
> Another question is- First time when the JSP comes up i want the
formbean
> to
> display values from the database. Where do i initialize the form bean to
> read data from database?
>
> Thanks !
>
>
>
>
> <TABLE>
>
> <TBODY>
>
> <logic:iterate id="vSectors_id" name="sectorData"
>
> property="vSectors" indexId="index">
>
> <TR>
>
> <TD><html:text name="sectorData"
>
> property='<%= "vSectors[" + index + "]" %>' /></TD>
>
> </TR>
>
> </logic:iterate>
>
> </TBODY>
>
> </TABLE>
>
>
>
>
> On 4/21/06, Chaudhary, Harsh <[EMAIL PROTECTED]> wrote:
> > Another resource I found to be very helpful is:
> > http://struts.apache.org/struts-action/userGuide/index.html
> >
> > Harsh.
> >
> > -----Original Message-----
> > From: Ted Husted [mailto: [EMAIL PROTECTED]
> > Sent: Friday, April 21, 2006 10:55 AM
> > To: Struts Users Mailing List
> > Subject: Re: Beginner's question on Struts and JSP
> >
> >
> > The best thing might be to start by going through the MailReader
> > application that is bundled with the distribution. It does things like
> > populate a table from a database, and covers several other use cases
> > you will run into.
> >
> > Also be sure to review the latest FAQs on the website, to be sure you
> > get started "on the right foot".
> >
> > * http://struts.apache.org/faqs.html
> >
> > HTH, Ted.
> >
> > On 4/21/06, Developer Developer <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > >
> > > I need to  create a  Table  in JSP with values coming from the
> > database. I
> > > want to use struts frame work for this application.
> > >
> > > Here is my question
> > >
> > > How should I design a formbean and link it to the view (JSP) ?
Sample
> > view
> > > code would be very helpful.  I think I need to have a collection
type
> > in the
> > > form bean to store the values from the database and some how link to
> > the the
> > > table in the JSP ( but don;t know how to do it)
> > >
> > > Thanks !
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>


--
Vinit Sharma
IBM


Reply via email to