hi puneet,

suppose if you use the bean in your architecture then  the best way i
would say is , have the java class which is equavalent to the
resultset (or the table) and transfer the object into the jsp page
and use its methods to show values in the page.

for example ,say you have to display the employee details in the page ,
have the 'employee object' , construct the same in the bean with the
result set values.write the method in the bean which returns the employee
object ..

...
   public Employee getEmployeeDetails()
  {
        return employee; //contains the values from the result set
  }

then in the JSP page,

<%

Employee employee = null;

employee = emplyeeBean.getEmployeeDetails() %>

then,

  <%=  employee.getName( ) %>
....


hope this helps,

regds,
    rathna.





"Puneet Kathuria, Gurgaon" wrote:

> Thanks for the suggestion but i don't think this is an adequate way of
> writing JSP. For an enterprise wide solution, it's not a proper approach to
> write db access mechanism embedded in web pages.
>
> Ok my real question, is how to pass a resultset back to JSP from a bean ? I
> don't want to return back the resultset object even as for a thumb rule that
> front end should never know about data access.
>
> How can i convert say a resultset to a 2-dimension array or vector of
> vectors or any other methodology for tranferring data back to web page.
>
> Is there any sample application available on web that can be used a model
> for writing the JSP applications, ie. following n-tier architecture.
>
> Thanks very much
>
> regards
>
> Puneet
>
> > ----------
> > From:         homai[SMTP:[EMAIL PROTECTED]]
> > Reply To:     A mailing list about Java Server Pages specification and
> > reference
> > Sent:         Saturday, January 20, 2001 9:56 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: Fetching Data from Bean
> >
> > ----- Original Message -----
> > From: "kishore" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, January 19, 2001 8:24 PM
> > Subject: Re: Fetching Data from Bean
> >
> >
> > > try this way ...
> > >
> > > <table>
> > > <tr > <!-- // let  name and address in tabular form  -->
> > > <td> name </td>
> > > <td> address</td>
> > > </tr>
> > > <%
> > > try {
> > > //
> > >  Connection c =
> > DriverManager.getConnection("jdbc:odbc:TABLE","usr","pwd");
> > >  Statement s = c.createStatement();
> > >  ResultSet r = s.executeQuery("select name , address  from usertable
> > where
> > > username = '"+loginBean.getUsername()+"'");
> > >         while( r.next())
> > >
> > >
> > > %>
> > > <tr>
> > > <td> <%= r.getString("name") %> </td>
> > > <td> <%= r.getString("address") %> </td>
> > > <tr>
> > > <%
> > >           }
> > >         r.close();
> > >        s.close();
> > >
> > >    }catch(SQLException e){
> > >           System.out.println("SQLException thrown @ xyz.jso");
> > >         }catch(ClassNotFoundException ee){
> > >           System.out.println("sun.jdbc.odbc.JdbcOdbcDriver class not
> > fount
> > > 2 xyz.jsp ");
> > >          }
> > > %>
> > > </table>
> > > ----- Original Message -----
> > > From: Puneet Kathuria, Gurgaon <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, January 19, 2001 9:58 PM
> > > Subject: Fetching Data from Bean
> > >
> > >
> > > > Hello All:
> > > >
> > > > I have a jsp page that displays data in tabular format.
> > > > I have written a bean that performs the database queries & creates a
> > long
> > > > string (html) and it's returned back to display on the page.
> > > >
> > > > Can i bring the whole resultset in any form to jsp page & then display
> > > > (maybe as arrays)
> > > >
> > > > Any suggestions as to how / in what form to bring data to jsp page
> > apart
> > > > from the strategy am following ?
> > > >
> > > > regards
> > > >
> > > >
> > >
> > ==========================================================================
> > =
> > > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > JSP-INTEREST".
> > > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > > DIGEST".
> > > > Some relevant FAQs on JSP/Servlets can be found at:
> > > >
> > > >  http://java.sun.com/products/jsp/faq.html
> > > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > >
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> > >
> > ==========================================================================
> > =
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> > ==========================================================================
> > =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to