Hi,

        Can u send me same sample about this??  BTW, can I use the same method in
applet and how?  Thanx in advance.

Albert

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Henderson
Sent: Thursday, July 06, 2000 11:49 PM
To: [EMAIL PROTECTED]
Subject: Re: Returning java.sql.ResultSet from an EJB


CJ,

You can return a resultSet from an EJB if you implement the Serializable
interface in your implementation of the ResultSet.  However, I would not
suggest this as an effective solution.  Another design alternative, which is
one that I have implemented, is to return only value beans back to your
JSPs. A value bean is a java class that encapsulates all model data that you
would want to pass back to your JSP.  In your case, it would at least
contain data passed back from a query, but it is not limited to this. You
can access bean data from its getter methods, however since it is a value
bean you would want your bean to be immutable meaning no setters. This bean
could also contain another class that maps specifically to the table row
whose data you are trying to query, and then use an array or vector of those
classes as a set. It could also contain other data that is important to you
view(JSP).  In this way,  a JSP page knows about only one bean that is it's
model data for the view. Then you could use the useBean directives or
getters to get data from your bean. This follows along the lines of the MVC
design pattern.

Hope it helps.

Kevin E. Henderson
Architect - Web Development
eTour, Inc.
http://www.etour.com/  "Surf Without Searching"
404-881-8484 ext. 385



-----Original Message-----
From: Corey A. Johnson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 06, 2000 8:24 AM
To: [EMAIL PROTECTED]
Subject: Returning java.sql.ResultSet from an EJB


Morning!

Quick question... I am invoking a method in an EJB from a JSP...  the
method in the EJB performs a SQL query...  Is it possible to return the
java.sql.ResultSet object to my JSP?  So i can then loop through the
records in the JSP and build the results HTML table?  I tried this and i
keep getting an IDL error telling me that the return type
"java.sql.ResultSet" is not allow...

if i can't.. does anyone have any code examples or suggestions? Or am i
missing something?

i guess i could place the data from each field into an element of a
String array... and then place each String array.... which would
represent a row in the SQL ResultSet.. in a Vector... and then return
the Vector to the JSP and use an Enumeration to loop through the String
Arrays....  does that make sense?  Or can it be done in a simpler
fashion?

Thanks in advance.

Cj
--
Corey A. Johnson
Creative Network Innovations, Inc.
1-800-264-5547 ** 1-407-259-1984

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
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".
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".
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