Bless with your Suggestion On Pattern
Hi Gurus
I am having Five column in my table. I am fetchinh all the data in An arrayList. For Displaying Purpose I am using The code Below is for Displaying it on the jsp. I want to Use Iterator or some Other Pttern which will Bee suitable for It.
Plz Bless with your Suggestion
for(int i=0;i<aList.size();i=i+5){
%>
<tr>
<td align="center">
<input type="radio" name="radiobutton" value="<%=aList.get(i)%>"></td>
<td align="left" class='textfield'><%=aList.get(i)%></td>
<td align="left" class='textfield'><%=aList.get(i+1)%></td>
<td align="left" class='textfield'><%=aList.get(i+2)%></td>
<td align="left" class='textfield'><%=aList.get(i+3)%></td>
<td align="left" class='textfield'><%=aList.get(i+4)%></td>
</tr>
[1393 byte] By [
rajpuniaa] at [2007-10-3 4:25:45]

What if your list isn't five values long? What do you do then? I don't like the scriptlet code. Learn JSTL and make this more general.%
> What if your list isn't five values long? What do> you do then? > > I don't like the scriptlet code. Learn JSTL and make> this more general.> > %NO in That table we are having five column only.
> > What if your list isn't five values long? What do
> > you do then?
> >
> > I don't like the scriptlet code. Learn JSTL and
> make
> > this more general.
> >
> > %
>
> NO in That table we are having five column
> only.
duffymo brings up a good point. I think you don't see what he noticed.
Why don't you have a list of lists instead of one giant list?
For example have a list that contains a list of rows which contains a list of column values.
zadoka at 2007-7-14 22:28:21 >

> > > What if your list isn't five values long? What
> do
> > > you do then?
> > >
> > > I don't like the scriptlet code. Learn JSTL and
> > make
> > > this more general.
> > >
> > > %
> >
> > NO in That table we are having five column
> > only.
>
> duffymo brings up a good point. I think you don't
> see what he noticed.
>
> Why don't you have a list of lists instead of one
> giant list?
>
> For example have a list that contains a list of rows
> which contains a list of column values.
How to Do It.Plz Give me sample code
> ow to Do It.Plz Give me sample code
How to create the list or how to output it?
To create: just make a new list of rows and each row is a list of cell values.
List table = new LinkedList();
Then add each row in a list
table.add(new LinkedList())
or array
table.add(new String[5]);
or potentially better as a new custom object
table.add(new MyObjectForRow());
To Output: Just a double for loop;
for(){
for(){
[output here]
}
}
This is a fairly simple task, I would suggest that you read some tutorials if you are struggling.
zadoka at 2007-7-14 22:28:21 >

Don't use scriptlets.It's a bad practice and it should be avoided.Use JSTL if you are just developing with JSP.Otherwise consider struts or jsf.
> > ow to Do It.Plz Give me sample code
>
> How to create the list or how to output it?
>
> To create: just make a new list of rows and
> each row is a list of cell values.
> List table = new LinkedList();
> Then add each row in a list
> table.add(new LinkedList())
> or array
> table.add(new String[5]);
> or potentially better as a new custom object
> table.add(new MyObjectForRow());
>
> To Output: Just a double for loop;
>
> for(){
>for(){
>[output here]
>
>
> This is a fairly simple task, I would suggest that
> you read some tutorials if you are struggling.
Hello My dear Friend
I did the same thing but still not getting.