File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Logic for dealing with resultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Logic for dealing with resultSet " Watch "Logic for dealing with resultSet " New topic

Logic for dealing with resultSet

Aman Singh
Ranch Hand

Joined: Oct 30, 2008
Posts: 57
Hi Experts,
I need some trivial help
In the following code, I am displaying a table on my jsp page. The first column on the table is APP_GROUP, which gets populated with Application names and in the same code I am converting the names in HTML links.
The problem I am facing is:
Lets say if I have an application name as: aaa
then I have to make a jsp page with name: aaa.jsp

with this approach I am getting stuck with the naming problem because, I need make use of aaa somewhere else as well.
what I want is some flexibility is creating these hyper links, something where I cant specify any link name ( not just aaa.jsp)

For example:
If there are 5 application names pulled up from the database, i should be able to specify links as:

<%=rs.getString(1)%> (here the second value or rs.getString(1) )

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

Result sets should never be dealt with in a JSP page. Move your SQL code to a model Java class, extract the data from the result set as Java collections, close the result set, and forward to the JSP with the data in the collections.

On page, use JSTL and EL to display the data.

[Asking smart questions] [About Bear] [Books by Bear]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Agreed. But apart from that, you seem to have a question which has nothing to do with SQL at all. You reference some mysterious "aaa" in your question. It's the name of your application? It's the name of a JSP page? Both? Why is it a problem?
I agree. Here's the link:
subject: Logic for dealing with resultSet
It's not a secret anymore!