File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
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

Harish Maridi
Ranch Hand

Joined: May 20, 2008
Posts: 60
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: 61103
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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
Harish Maridi
Ranch Hand

Joined: May 20, 2008
Posts: 60
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:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getting data from a dynamic table in one JSP to another JSP