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

Question in struts

meera rao
Ranch Hand

Joined: Jun 30, 2005
Posts: 67
The code below is part of my action class:
I code to access the stored procedure is written in another class, which returns the resultset. From this resultset, I am retrieving the fields and setting the variables in the form bean.
my form bean doesn't have any arraylist.
I am sending the arraylist as an request parameter to the jsp page.

now my question is,
1) Should i have an array list in my form bean, or is it ok to process the information this way and display it.
2) do we have to use DTO's
3)if we have to use arraylist in the form bean, how should i do it and how should i iterate through it from my jsp page.

// gets the resultset from a stored procedure

while ({
// this is my form bean ( with regular getter and setter methods
csf=new CountySummaryForm();
// this i am adding to an arraylist
//setting it as a request attribute.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Moving to the Struts forum where those gurus can help you better.

GenRocket - Experts at Building Test Data
vijaya bharath
Ranch Hand

Joined: Jun 10, 2005
Posts: 66

Even me also came across this problem once. I declared arraylist in the FormBean. I need to get employees info from DB and need to print 5 rows each time and on clicking of previous and next i shud get the other 5.
For this i have declared outer from bean with the previous,next,rowcount(all Strings) and Employee(ArrayList). I have declared another formbean by name employee to store all the emp details. In that all the fields are Strings.
In jsp we can iterate thru the values of arraylist like this
<logic:iterate name="allEmployeesForm" property="employeeForm" id="employeeForm">

<td width="366"><bean:write name="employeeForm" property="firstName"/></td>
<td width="201"><bean:write name="employeeForm"property="designation"/></td>
allEmployeesForm is the name given to outer

I think u got somethink.

Regards,<br />Vijaya Bharath.<br />SCJP1.4 <br />SCWCD5.0
I agree. Here's the link:
subject: Question in struts
It's not a secret anymore!