Below is my code in which gives my values from database in Rmenu.
but when compilation proceeds downwards, there is another line ResultSet Rmenu1 = c1.menu1();
which gives me another result set Rmenu1 which have values from database through menu1(); function.

But after execution of its while( when the cursor comes back to while(
it gives error as " Result set is closed".
Is it so that a there can be only one result set at a time or is it a threading issue.

Please help.

ResultSet Rmenu =;
String Strmenu=null;
String UpperStr=null;
String compareStr=null;
int charind;
int n=0;
Strmenu = Rmenu.getString("HeaderScreenName");
charind = Strmenu.indexOf("-");
UpperStr = Strmenu.substring(0,charind);
<a href="#"><% out.println(UpperStr); %></a>
<% }
int i=0;
ResultSet Rmenu1 = c1.menu1();

<li><a href="#"><% out.println(Strmenu.replace(UpperStr+"-","")); %></a></li>
<% i++; }
} %>

catch(Exception e)

It is not very efficient reading from ResultSet while generating the html.
Better to have separate class that returns as an array of objects the data you want and then use that data to generate the page.
And the class will be responsible of handling the opening and closing of the ResultSet as well as the connection.

Well, you don't show whatever code "c1.menu1();" is executing, but you can only have one ResultSet open per Statement. You can have multiple Statement objects for a Connection though. Most likely you are re-using the Statement that created "Rmenu".

A few other things to note:
- This is the Java programming forum, but there is a separate forum for JSP and these questions are best directed there.
- You should not have so much Java code in your JSP page. Beans and Servlets should be handling those things.

We thanks for the advice.....I am not sound with tag librarys and el that why as a beginner I used java in jsp. I am learning tag libs, so slowly i will start using them to improve my coding style...

Thanks everyone for the advice.