aspose file tools
The moose likes Struts and the fly likes getting data from a dynamic table in one JSP  to another JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "getting data from a dynamic table in one JSP  to another JSP" Watch "getting data from a dynamic table in one JSP  to another JSP" New topic
Author

getting data from a dynamic table in one JSP to another JSP

mark watson
Ranch Hand

Joined: May 20, 2008
Posts: 44
Hi

I have a table which is dynamically generated in a jsp(first.jsp). I provided a hyperlink to a column in that table.When I click that hyperlink, the page is redirecting to second.jsp

I want to transfer the whole row that selected in that table to be displayed on another JSP.Can anybody please suggest me a way to do it.

I am using struts framework in my application.

Thankyou....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56528
    
  14

You could consider using hidden input elements to capture the data that you want submitted.

Since you are using Struts, I've shifted this over to the Struts forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
One way to do it would be to keep the table in session scope as a java.util.List. You could then simply pass the index of the element selected, and the second JSP could retrieve the values from the List for that index. If you want to do it without using session scope, Bear's suggestion of using hidden fields is your best option.
[ June 03, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
mark watson
Ranch Hand

Joined: May 20, 2008
Posts: 44
As I said it is dynamically generated table.
I assaigned a hyperlink to the column, and I assigned "id" to it.. code is as follows.



I have java script :

function O()
{
var x = document.getElementById("tikno");
alert(x.innerHTML);

}

it is returing the value of the clicked column but it is giving same value for every column.

How can I get a different values for different columns.

Thankyou...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you're using a <logic:iterate> tag to generate the table, you can use the indexId attribute to generate an index variable that can then be used to uniquely identify each row. Example:
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: getting data from a dynamic table in one JSP to another JSP
 
Similar Threads
Hyperlink a table data
i to put hyperlink in javascript table
regarding JTable
hyperlink data retrieve
onclick of hyperlink