This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Dynamically adding a row in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamically adding a row in JSP" Watch "Dynamically adding a row in JSP" New topic
Author

Dynamically adding a row in JSP

Raj Chukka
Greenhorn

Joined: Apr 09, 2007
Posts: 22
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

Joined: Mar 28, 2004
Posts: 257
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.


Amit Tank
Linked In
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884

<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?


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
shekar nadar
Greenhorn

Joined: Mar 31, 2008
Posts: 6
u can use javascript to dynamically add the rows.


shekar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically adding a row in JSP