This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Passing table as parameter to next  page(JSTL) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing table as parameter to next  page(JSTL)" Watch "Passing table as parameter to next  page(JSTL)" New topic
Author

Passing table as parameter to next page(JSTL)

Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
I have on first page a table object with data. When this page calls another page how do I retrieve the content of this table in next page as parameters. I am using JSTL.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Are you talking about HTML Table?
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
Yes. On first JSP I have a table HTML table(5 cols and 100 rows) with data.I submit this page in the next page I want to retrieve them using JSTL.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60803
    
  65

The only way you could do that is to send the table's data to the next page via HTML form elements.

Better yet, why not just re-create the data that you sent to the first page in order to create the table in the first place?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
The application current architecure passes data between pages using JSTL. The objects are retrieved using JSTL ${param}. So far only HTML <form> elements are passsed on - i can access each element like ${param.cust_name}, where cust_name is a text item in the form tag on the first page. Now if I put a table in <FORM> element how will I access individual row/cols using JSTL?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60803
    
  65

Again, any data you wish to pass on to the next page must be in a form element such as <input>.
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
Yes. But How do I retrive that in JSTL.Like i have a table of 10 rows and 2 columns. Syntax to retrieve that in next page?

<table rows=10>
<td>
<input type=text name="col1">
<input type=text name="col2">
<td>
</table>

Thanks
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

it will look like this,

request.getParameter("col1");
request.getParameter("col2");
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60803
    
  65

Originally posted by Raj Puri:
But How do I retrive that in JSTL.


First, a terminology correction. You mean EL not JSTL.

And the answer is just like any other submitted parameter: via the param builtin variable. E.g. ${param.col1}.

I'm not sure what's confusing you here. Just because your form elements are arranged in a table in the originating HTML form makes no difference to anything, Upon submission, all request parameters just become a map of name/value pairs.
 
Consider Paul's rocket mass heater.
 
subject: Passing table as parameter to next page(JSTL)
 
Similar Threads
HTML Table Column Widths
scroll bar next to a TABLE
Multiple Row Records
displaytag should show only previous and next
Using Beans from Collection