This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically adding a row in JSP

 
Raj Chukka
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are developing struts based web application. Iam getting the results from database and populating the list on the screen using dto objects.

<logic:iterate id="list"
name="DetailDto"
property="listdata"
type="examples.ListDataDto"
indexId="index1">
<%-- it has 5 columns --%>
</logic:iterate>

iam able to populate the data correctly and its working fine. I want to add one row at the end dynamically with the first column to be set as a text box.

How do i do that? Can someone help me in this?

Thanks,
Raj Chukka
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get the size of the list in a bean variable. compare the index with the size in logic:equal tags and put your stuff in there.

Hope this helps.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<logic:iterate id="list"
name="DetailDto"
property="listdata"
type="examples.ListDataDto"
indexId="index1">
<%-- it has 5 columns --%>
</logic:iterate>

I would suggest you to use displaytag instead of painting your own table.

I want to add one row at the end dynamically with the first column to be set as a text box.

I don't understand this part of your question. By dynamically, what is the condition for this last row to appear or not appear?
 
shekar nadar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can use javascript to dynamically add the rows.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic