Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Declare a PUBLIC Result Set

 
Maruli Lee
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


better have a look on servlets internationalization as well.
 
Maruli Lee
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Hashtable solved my problems. Neways, thanx for all of your suggestion. Really appreciate that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic