HI!
Considering the size....
note that JSP standard has not been stable. so check if the server supports
the JSP standard in which u have coded, A problem i faced on my JWS. Another
problem is due to incorrect setting of the paths or rather placing the JSP
and the bean files in inappropriate locations.. check server documentation.
On JWS the bean must have a package name and the corresponding dir must be
created under classes dir under JWS homedir.

Best way for this is to start off with a minimal bean sample and then build
upon it slowly( iam unaware if u did).

Sudesh Palekar
Systems Manager
Middleware group
Wipro Infotech Ltd.
----- Original Message -----
From: Biren Patnaik <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 06, 2000 3:15 PM
Subject: Help on JSP and BEANS


> Hi All,
> I m getting "Error: 500 Unable to compile class for JSP" error messages
> while executing a jsp program.
> My aim is to execute a query from  user input.
> I m using 3 programs for that.2 for jsp and 1 bean program.
>
> list1x.jsp is my main program which calls list3x.jsp,which in fact calls
> DbBean1 class.
> I have saved list1x.jsp and list3x.jsp
> in d:\java\jswdk-1.0.1\examples\jsp and DbBean1.class in
>  d:\java\jswdk-1.0.1\examples\web-inf\jsp\beans\com\wrox\jspexamples
> directory.
> My programs are
>
> list1x.jsp
>
> <html>
> <head>
> <title>
> Executing a query
> </title>
> </head>
> <body>
>
> <%@ page language="java" errorPage="ErrorPage.jsp" %>
>
> <%@ include file="Header.html" %>
>
> Choose database:
>
> <form method="GET"
> action="http://147.0.1.41:8080/examples/jsp/list3x.jsp">
>
> Input SQL if you know your query:
>
> <p>
>
> <input type=text name=inputSQL size=40>
>
> <p>
>
> <input type=submit>
>
> </form>
> </body>
> </html>
>
>
> list3x.jsp
>
> <html>
> <head>
> <title>
> Database Search
> </title>
> </head>
> <body>
>
> <%@ page language="java" import="java.sql.*" errorPage="ErrorPage.jsp" %>
>
> <%@ include file="Header.html" %>
>
> <jsp:useBean id="db" scope="request" class="com.wrox.jspexamples.DbBean1"
> />
>
> <jsp:setProperty name="db" property="*" />
>
> <%! int numColumns;
>     ResultSet rs = null;
>     ResultSetMetaData rsmd = null;
> %>
>
> <center>
> <h2>Results from</h2>
> <h2><%= request.getParameter("inputSQL") %></h2>
> <hr>
> <br><br>
> <table border="1" bgcolor="#cccc99" bordercolor="#003366">
> <tr>
>
> <%
>    String sql = request.getParameter("inputSQL");
>
>    try {
>       db.connect();
>    } catch (ClassNotFoundException e) {
>       throw new ServletException("Database drivers not available", e);
>    } catch (SQLException e) {
>       throw new ServletException("Database URL is wrong", e);
>    }
>
>    try {
>       rs = db.execSQL(sql);
>    } catch (SQLException e) {
>       throw new ServletException("Your query isn't working. " +
>                                  "Do you want to browse the database? " +
>                                  "If so, leave the SQL input empty", e);
>    }
>
>    try {
>       rsmd = rs.getMetaData();
>       numColumns = rsmd.getColumnCount();
>
>       for (int column = 1; column <= numColumns; column++) {
> %>
>
> <th><%= rsmd.getColumnName(column) %></th>
>
> <%
>       }
> %>
>
> </tr>
>
> <%
>       while (rs.next()) {
> %>
>
> <tr>
>
> <%
>          for (int column = 1; column <= numColumns; column++) {
> %>
>
> <td><%= rs.getString(column) %></td>
>
> <%       } %>
>
> </tr>
>
> <%    }
>       rs.close();
>       db.close();
>    } catch (SQLException e) {
>       throw new ServletException("Database error. The query worked, " +
>                                  "but the display didn't", e);
>    }
> %>
>
> </table>
> </center>
> </body>
> </html>
>
>  DbBean1.java is
>
> package com.wrox.jspexamples;
>
> import java.sql.*;
> import java.io.*;
>
> public class DbBean1 {
>
>    String dbURL;
>    String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
>    private Connection dbCon;
>
>    public DbBean1() {
>       super();
>    }
>
>    public boolean connect() throws ClassNotFoundException, SQLException {
>       Class.forName(this.getDbDriver());
>       dbCon = DriverManager.getConnection(this.getDbURL());
>       return true;
>    }
>
>    public void close() throws SQLException {
>       dbCon.close();
>    }
>
>    public ResultSet execSQL(String sql) throws SQLException {
>       Statement s = dbCon.createStatement();
>       ResultSet r = s.executeQuery(sql);
>       return (r == null) ? null : r;
>    }
>
>    public String getDbDriver() {
>       return this.dbDriver;
>    }
>
>    public void setDbDriver(String newValue) {
>       this.dbDriver = newValue;
>    }
>
>    public String getDbURL() {
>       return this.dbURL;
>    }
>
>    public void setDbURL(String newValue) {
>       this.dbURL = newValue;
>    }
> }
>
> Any one who can help me.. to save my valuable time
> Thanx in advance
> Biren
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to