This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Which is Best Way to Get a List for JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Which is Best Way to Get a List for JSP" Watch "Which is Best Way to Get a List for JSP" New topic
Author

Which is Best Way to Get a List for JSP

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I need to get a list of users for a JSP select list. The list is hidden unless a user clicks a button.

My question is this. Which is the better metdod?

I can either get the list in my servlet response and set this string to a session attribute then use JSTL to populate the select list.

Or

Run jQuery when button is clicked and populate select list with return string.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Unless the content of the list is dependent upon data that can't be known until after the page has been sent to the client, I'd render the list as part of the JSP before shipping it off to the client.

Why add all the extra moving parts if you don't have to?
[ July 15, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
Thanks Bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which is Best Way to Get a List for JSP
 
Similar Threads
Query regarding stripes:select in Stripes.
Using Values in a List form one JSP to Another
retrieving dynamic values in jsp
How to populate drop down list using hibernate
Problem with AJAX and Struts