File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Declare a PUBLIC Result Set 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 » JSP
Bookmark "Declare a PUBLIC Result Set" Watch "Declare a PUBLIC Result Set" New topic
Author

Declare a PUBLIC Result Set

Maruli Lee
Greenhorn

Joined: Dec 09, 2004
Posts: 11
Dear Java programmers,

I just started my first project on java and there are so many questions i would like to know the answer. However, the main priority is whether it is possible to create a public result set which is shared by all the JSP pages.

Regards,
Mar
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
dont know what you are going to do. but it sounds like a sin.
as you said you are a newbie in java or jsp. you should specify what you really want to do.
Maruli Lee
Greenhorn

Joined: Dec 09, 2004
Posts: 11
My apologies for not describing the matter well enough. Here it is with more details.

What i want to establish is:
===========================================================================
I have a .java file which establish connection to the database, retrieve data and store them into a Result Set.

Over to the JSP page, I would like to use this Result Set for comparison. Basically i am doing a translation from English to Other language. If there is a text "Password" on the login page, I have to get the text "Password" and look for it in the database, retrieve the translated words and displays it on the page.
===========================================================================

I have tried doing that by opening up the result set each time i need to translate (recalling the function in the .java file). However, the page loads much slower and therefore i would like to try other alternative.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Store the data in the ResultSet in a Java collection such as a HashMap or an ArrayList, then close the ResultSet, and use the collection whereever you want.

And I would recommend reading some introductory tutorials on Java Collections and JDBC.

Cheers.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874

Basically i am doing a translation from English to Other language.


better have a look on servlets internationalization as well.
Maruli Lee
Greenhorn

Joined: Dec 09, 2004
Posts: 11
Hi guys,

Hashtable solved my problems. Neways, thanx for all of your suggestion. Really appreciate that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Declare a PUBLIC Result Set
 
Similar Threads
Does parenthesis makes difference on calculation?
Java webservice
set parameter values interceptors before rendering JSP
Returning ResultSet
Inner classes & Interface - Guoqiao's 3rd Mock