Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Difficulty in compiling a servlet.

Difficulty in compiling a servlet.

2003-10-12       - By Eric C

 Back
Reply:     1     2     3     4  

Don't you have a syntax error somewhere ?

DBUpadate



-- -- Original Message -- --
From: "anunay ashish" <anunaya@(protected)>
To: "Tomcat Users List" <tomcat-user@(protected)>
Sent: Saturday, October 11, 2003 2:27 PM
Subject: Difficulty in compiling a servlet.


> Hi,
>
> The code for my bean is:
>
> package com.scheduler;
> import java.sql.*;
> public class DBUpdate
> {
>     private Connection conn;
>     private Statement stmt;
>     private ResultSet rs;
>  public DBUpdate()
>     {
>         conn = null;
>         stmt = null;
>         rs = null;
>     }
>  public void process(String query)
>     {
>         try
>         {
>
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
>             Connection conn =
> DriverManager.getConnection("jdbc:oracle:thin:@(protected):1521:myData",
> "mangesh", "mangesh");
>             stmt = conn.createStatement();
>             rs = stmt.executeQuery(query);
>    System.out.println("Query: " + query + " executed");
>         }
>         catch(Exception exception1)
>         {
>             System.out.println("Error occured in DBUpdate.process()
> SQLException :" + exception1);
>         }
>     }
>  public ResultSet getResultSet() throws SQLException
>     {
>      return rs;
>     }
>  public void destroy()
>  {
>         conn = null;
>         stmt = null;
>         rs = null;
>  }
> }
>
> And for my servlet is:
>
> package com.scheduler;
> import java.io.*;
> import java.sql.*;
> import java.text.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class addDataServlet extends HttpServlet
> {
>  private String pageFormat;
>  public void doPost(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException
>  {
>   ResultSet testRS;
>   DBUpdate dbupdate = new DBUpdate();
>   pageFormat = request.getParameter("newPageFormat");
>   PrintWriter out = response.getWriter();
>   out.print(pageFormat);
>   String query = "Select * from lookup_page_format";
>   dbupdate.process(query);
>   try
>   {
>    testRS = dbupdate.getResultSet();
>       while(testRS.next())
>    {
>     out.print(testRS.getString(2));
>     out.print("hi");
>    }
>   }
>   catch (SQLException e)
>   {
>    out.println("SQLException :" + e);
>   }
>   try
>   {
>    //set the attribute and forward to pageFormat.jsp
>    request.setAttribute("servletName", "addDataServlet");
>
>
getServletConfig().getServletContext().getRequestDispatcher("/Tracking_syste
> m/pageFormat.jsp").forward(request, response);
>   }
>   catch (Exception ex)
>   {
>    ex.printStackTrace ();
>   }
>  }
> }
>
> On compiling the addDataServlet.java, an error is coming - Unresolved
> symbol:Class DBUpadate is not resolved
> Where I am doing wrong?
>
> Thanks in advance.
> Regards,
> Anunay.
>
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
> For additional commands, e-mail: tomcat-user-help@(protected)
>


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.