This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arrayList display all in one row

 
dan steve
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please can anyone help to show me what I can use to arrange data fetched from the database into an arrayList
I have this application having; DAO, SERVLET, JSP, RELAY AND DATABASE.
the problem no is that, when I fetched data from the database, using an arrayList, I used a syntax like this to display it in an html table

this is in my servlet....it displays all record in a single row.....can anyone help me out on this? I have only untill tomorrow before my head is chopped off.....please help..thanks in advance.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears you have things more or less right; are you sure the inner element has what you want on one row, and not more?

rc
 
nithin chinni
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dan steve wrote:please can anyone help to show me what I can use to arrange data fetched from the database into an arrayList
I have this application having; DAO, SERVLET, JSP, RELAY AND DATABASE.
the problem no is that, when I fetched data from the database, using an arrayList, I used a syntax like this to display it in an html table

this is in my servlet....it displays all record in a single row.....can anyone help me out on this? I have only untill tomorrow before my head is chopped off.....please help..thanks in advance.


well you made a small mistake here. Here tr means a new row....... not td. so obviously inside the loop you have to write <tr> along with <td>...... hope that helps.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The OP has two loops: the outer one goes through each element in a collection named 'mr' and generates a row for each one.

Each element is an array list; for each element of each array list, it generates one element in that row.

So if the array list is one record, it will indeed display each element of that record on one row. Unfortunately, I don't know what the OP wanted to do, since it isn't that.

rc
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I don't think you have provided us with enough information to be able to help you. However I would like to point out that you should not be coding HTML in servlets or even using java code in JSPs.
You can do the same thing using the standard taglibs and EL like:
Not only is it much more readable, but it makes it much easier to add CSS classes etc.

Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic