Hi,

    In any JSP Page You get a varible session.
    You can directly use session.putvalue and session.getvalue.
     Here i am attaching my code where i am directly using session.

--- Mettu.

<%@ page session="true" import="java.util.*" %>
<HTML>
<HEAD>
<SCRIPT language=JavaScript>
function mettu(x){
window3 =
window.open(x,"Open","height=200,width=390,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=
0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=1,
toolbar=0,z-lock=0", "myWindow");
}
</SCRIPT>
</HEAD>

<BODY bgcolor=#556b2f text=#ffffff LINK=#FF0000 VLINK=#FF0000>
<BR>

<%

 Vector header = (Vector) session.getValue("Header1");
 if (header != null && (header.size() > 0)) {

%>

  <BR> <H2> <%= (String) header.elementAt(0) %> </H2>
  <TABLE border=2  cellspacing=0 cellpadding=0>
  <TR BGCOLOR=#ff0000>

<%  for(int i =1; i< header.size(); i++){ %>
  <TD ALIGN=center> <%= (String) header.elementAt(i) %> </TD>
<%}%>
  </TR>

<%
 Vector body = (Vector) session.getValue("Body1");
 if (body != null && (body.size() > 0)) {
  for(int i =0; i< body.size(); i++){

%>
   <TR>
<%
   Vector row= (Vector) body.elementAt(i);
   for(int j=0; j< row.size(); j++){%>
    <TD ALIGN=center> <%= (String) row.elementAt(j) %> </TD>
<%
   }
%>
   </TR>
<%
  }

 }
%>

  </TABLE>
<%}%>

<BR>
<%

 Vector header2 = (Vector) session.getValue("Header2");

 if (header2 != null && (header2.size() > 0)) {

%>

  <BR> <H2> <%= (String) header2.elementAt(0) %> </H2>
  <TABLE border=2  cellspacing=0 cellpadding=0>
  <TR BGCOLOR=#ff0000>

<%  for(int i =1; i< header2.size(); i++){ %>
  <TD ALIGN=center> <%= (String) header2.elementAt(i) %> </TD>
<%}%>
  </TR>

<%
 Vector body = (Vector) session.getValue("Body2");
 if (body != null && (body.size() > 0)) {
  for(int i =0; i< body.size(); i++){

%>
   <TR>
<%
   Vector row= (Vector) body.elementAt(i);
   for(int j=0; j< row.size(); j++){%>
    <TD ALIGN=center> <%= (String) row.elementAt(j) %> </TD>
<%
   }
%>
   </TR>
<%
  }

 }
%>

  </TABLE>
<%}%>

<%
 session.removeValue("Header1");
 session.removeValue("Body1");

 session.removeValue("Header2");
 session.removeValue("Body2");
%>
</BODY>
</HTML>


Reeta Mittal wrote:

> Hello Everyone,
>
> I am working on JSP. My problem is that I want to store resultset in a
> session variable but I do not know how to do this ?
> Can anyone please tell me. One way is to create a java bean with scope
> Session. I know this solution but do not know how to implement this ?
>
> Thanx and Regards,
> Reeta
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to