Leon,
Just a thought....
As far as I know, there is no "import" directive in JSP 1.0.
The following line is probably invalid.
<%@ import="java.util.Vector" %>
You can add the import to your page directive at the top of the page.
This may be what is causing the error.
-AMT
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Leon Andrews
> Sent: Monday, January 17, 2000 7:12 PM
> To: [EMAIL PROTECTED]
> Subject: Can anyone see why this won't work?
>
>
> Any help would be most appreciated - I have converted a 0.92 JSP page, but
> cannot get the bean to work. I get a 500 Internal Server error...
>
> Is the problem with the way I am calling the Bean, or is it with the Bean
> itself?
>
> The JSP...
>
> <%@ page import="db.DataBaseSelect" %>
>
> <jsp:useBean id="select" scope="request" class="db.DataBaseSelect" />
> <jsp:setProperty name="select" property="*" />
>
> <html>
> <head>
> <title>Select everything from a database</title>
> </head>
> <body>
>
> <% out.print(select.connect()); %>
> <br>
> <% out.print(select.select()); %>
>
> <p>Format results
>
> <br>
> <%@ import="java.util.Vector" %>
> <% Vector aResult = select.getResult(); %>
>
> <table>
> <% for (int i=0; i < aResult.size(); i++) { %>
> <tr>
> <td>
> <% out.print(aResult.elementAt(i)); %>
> </td>
> </tr>
> <% } %>
> </table>
>
> </body>
> </html>
>
> and the Bean.....
>
>
> package db;
>
> import java.sql.*;
> import java.util.Vector;
>
> public class DataBaseSelect {
>
> private Vector result;
>
> public DataBaseSelect() {
> result = new Vector();
> } // constructor DataBaseSelect
>
> public String connect() {
> try {
> Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
> return "Driver Loaded!";
> } catch (Exception E) {
> return "Unable to load driver.";
> }
> }
>
> public String select() {
> try {
>
> String url = "jbbc.bla.etc:thin:@mysite.bla.bla.bla";
>
> Connection C =
> DriverManager.getConnection(url,"myusername","mypassword");
>
> Statement Stmt = C.createStatement();
>
> ResultSet myResult = Stmt.executeQuery("SELECT question_text from
> leon_jtest_questions");
>
> while (myResult.next()) {
> result.addElement(myResult.getString(1));
> }
>
> // Clean up
> myResult.close();
> Stmt.close();
> C.close();
> return "Connection Success!";
> } catch (SQLException E) {
> return "SQLException: " + E.getMessage();
> }
> }
>
> /**
> * Accessor for result
> **/
> public Vector getResult() {
> return result;
> }
>
> /**
> * Mutator for result
> **/
> public void setResult(Vector avector) {
> result = avector;
> }
>
> } // class DataBaseSelect
>
>
> Leon Andrews
> JobNet Worldwide Pty Ltd
> Tel: (02) 9966 8566
> http://www.jobnet.com.au
>
>
> ----- Original Message -----
> From: Wampler Dean <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 18, 2000 9:17 AM
> Subject: Re: Tomcat vs. JSWDK
>
>
> > > > > among all the things that are not working properly:
> > > > >
> > > > > - response.setHeader("Content-Type", "foo/bar"); does not set the
> > > > > content-type
> > > >
> > > > Are you by chance calling it at the wrong time (i.e. after the
> response
> > is
> > > > committed to the output stream)?
> > >
> > > I don't think I'm doing anything illegal, I've reduced it to a sample
> > > JSP file containing simply:
> > > <%
> > > response.setHeader("Content-Type", "foo/bar");
> > > %>
> > > and it still fails.
> > > I'm not sure if this is compliant with the spec, but on the same
> > > conditions response.setContentType works. so I guess one of them is
> > > wrong.
> >
> > For what it's worth, I have successfully used constructs like the
> following
> > with Tomcat:
> >
> > <%
> > if (sendXML() == true) {
> > response.setContentType ("text/xml");
> > } else {
> > response.setContentType ("text/html");
> > }
> > %>
> >
> > However, you get a servlet error if you do this:
> >
> > <%
> > if (sendXML() == true) {
> > <%@ page contentType="text/xml" %>
> > } else {
> > <%@ page contentType="text/html" %>}
> > %>
> >
> > Despite what the spec recommends, it would be very "painful" (for me at
> > least) if any JSP engine could not handle the
> "response.setContentType()"
> > approach.
> >
> > dean
> >
> > Dean Wampler, Ph.D.
> > System Design Engineer
> >
> > Mercata, Inc.
> > 110 110th Ave. NE
> > Bellevue, WA 98004-5840
> > mailto:[EMAIL PROTECTED]
> > http://www.mercata.com
> > (425)468-9723
> >
> > I want my tombstone to say:
> > "Unknown Application Error in DeanWampler.exe.
> > Application Terminated"
> >
> >
> ==================================================================
> =========
> > 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
>
===========================================================================
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