Home » Developer & Programmer » JDeveloper, Java & XML » Package javax.servlet.http not found in import
Package javax.servlet.http not found in import [message #91995] Thu, 15 January 2004 15:42 Go to next message
Mark
Messages: 284
Registered: July 1998
Senior Member
I'm trying to create a JavaBean(ConnectionBean), but I get this error message when I try to convert it from a java file to a class file: ConnectionBean.java:2: Package javax.servlet.http not found in import.
Seems like I need to point to this package, but have no Idea where? Is there something I need to put in the jserv.properties file? Or do I need to point to something in the directory...ApacheJsdksrcjavaxservlet?

Thanks, for the help

 
Re: Package javax.servlet.http not found in import [message #92085 is a reply to message #91995] Wed, 03 March 2004 03:41 Go to previous messageGo to next message
stefan feenstra
Messages: 4
Registered: March 2004
Junior Member
you want a connection from the applet to a server(apache)
i don't know any javax.servlet.http
it doesn't exist in my sdk to

try using
import java.net.*;

using functions like

URL(Strin spec)
URL(String protocol,String host,int port,String file)
URL(String protocol,String host,int port,String file,URLstream handler)
URL(String protocol,String host,String file)
URL(URL context,String spec)
URL(URL context,String spec, URLStreamHandler handler)

I can still write more methodes
but i don't know if you wil need them if you need them
post the things that you want to do all.
i think it's a bit hard to understand what you want
Re: Package javax.servlet.http not found in import [message #92087 is a reply to message #92085] Wed, 03 March 2004 04:29 Go to previous messageGo to next message
Mark
Messages: 284
Registered: July 1998
Senior Member
I'm trying to make this a class file(using javac utility), but it comes up with error.
import java.sql.* ;
import javax.servlet.http.* ;

public class ConnectionBean implements HttpSessionBindingListener {
 public Connection conn;
 private Statement stmt;
 private String dbURL=
 "jdbc:oracle:thin:scott/tiger@machine1:1521:db";
public ConnectionBean() {
try {
  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
 conn = DriverManager.getConnection(dbURL);
 statement = conn.createStatement();
}
catch (SQLException e) {
 System.err.println("ConnectionBean: driver not loaded: " + e);
conn=null;
 }
} /// ConnectionBeanconstructor

public void setDbURL (String d) {
 dbURL = d;
} ///setDbURL

public Connection getConnection() {
 return conn;
} /// getConnection

public void commit() throws SQLException {
 conn.commit();
}

public void rollback() throws SQLException {
 conn.rollback();
} ///rollback

public void setAutoCommit (boolean autoCommit) throws SQLException {
 conn.setAutoCommit(autoCommit);
} ///setAutoCommit

public ResultSet executeQuery(String sql) throws SQLException {
 return stmt.executeQuery(sql);
} /// executeQuery

public int  executeUpdate(String sql) throws SQLException {
  return stmt.executeUpdate(sql);
} /// executeUpdate

public CallableStatement prepareCall (String sql) throws SQLException {
 return conn.prepareCall(sql);
} ///prepareCall

public void valueBound(HttpSessionBindingEvent event) {
 try {
 if (conn == null || conn.isClosed()) {
 conn = DriverManager.getConnection(dbURL);
  stmt = conn.createStatement();
 } /// if conn == null
}  catch (SQLException e) {
System.err.println("ConnectionBean: in the valueBound method");
conn= null;
}
} ///valueBound

public void  valueUnbound(HttpSessionBindingEvent event) {
  try {
  conn.close();
}
catch (SQLException e) {
}
finally {
conn=null;
  }
} ///valueUnbound

protected void finalize() {
 try {
  conn.close();
}
 catch (SQLException e) {
}
} /// finalize
} /// ConnectionBean
Re: Package javax.servlet.http not found in import [message #92565 is a reply to message #92087] Sat, 18 September 2004 15:31 Go to previous messageGo to next message
Son
Messages: 5
Registered: March 2004
Junior Member
you can download the javax servlet package from the Sun website. Then u have to set the path to point to it.

i'm relatively new to program too and couldn't get the path right so i extracted the javax folder from the downloaded zip file and put it in the directory of the .java file i wanted to compile.

the filename of the javax.servlet package i d/l was called servlet-2_3-fcs-classfiles.zip

hope that works cause i'm not too sure if it will
Re: Package javax.servlet.http not found in import [message #92566 is a reply to message #92565] Sat, 18 September 2004 17:33 Go to previous message
Mark
Messages: 284
Registered: July 1998
Senior Member
Wow, that was a while ago..lol
Thanks...
I had resolved this by setting the classpath and path in the environmental variables to point to the new installation of jdeveloper (I already had a version of jdk) and its' class files. I assume this happens when several installations of the jdk are installed. And any new installations say like text pad, I can just append the paths in the EV separated by a semicolon.
Previous Topic: Io Exeption: SO Exception was generated AND no ocijdbc9
Next Topic: Problem running EJB client on Blazix App Server
Goto Forum:
  


Current Time: Thu Apr 25 14:38:02 CDT 2024