Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Dynamically adding a row in JSP

 
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
 
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.
 
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?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can use javascript to dynamically add the rows.
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic