hi,

thanks for your reply.

i've tried your solution, still it doesn't work.  and i've already set a classpath 
pointing to my
package.

my ConnectionHolder class is located at,
"c:\tomcat\webapps\test\WEB-INF\classes\jsp\com\edoris\classes" and my classpath is 
set to
"c:\tomcat\webapps\test\WEB-INF\classes\jsp;"

and in my JSP, i put down
<%@page import="com.edoris.classes.ConnectionHolder"%>

tomcat gives me this error, "org.apache.jasper.JasperException: Unable to compile 
class for
JSPF:\Program
Files\tomcat\work\localhost_8080%2Ftest\_0002fjsp_0002fprofile_0002ejspprofile_jsp_10.java:16:
Package com.edoris.classes not found in import.
import com.edoris.classes.ConnectionHolder";

can anyone shed some light on this one?  i know my question may sound stupid though.

thanks in advance.

ccsk

Kachana Ung wrote:

> Add the following to your jsp page:
>
> <%@ page import="yourpackagename.ConnectionHolder"%>
>
> Kachana
>
> --- Chin Sung Kit <[EMAIL PROTECTED]> wrote:
> > hi,
> >
> > i have a login servlet, which validates the username
> > and from there i
> > created the connection for that user.  the username
> > and connection are
> > stored in the session.  i got this ConnectionHolder
> > class from Jason
> > Hunter's book.
> >
> > userSession.putValue("userName", uName);
> > userSession.putValue("userName.connection", holder);
> >
> > And in one of my jsp pages, I need to use this
> > ConnectionHolder, what I
> > did was:
> > <%@page language="java" import="java.sql.*"%>
> > <%ConnectionHolder
> >
> holder=(ConnectionHolder)session.getValue("userName.connection");
> > if (holder != null)
> >     Connection conProfile = holder.getConnection();
> > %>
> >
> > It gives me this error,
> > "rg.apache.jasper.JasperException: Unable to
> > compile class for JSPF:\Program
> >
> 
>files\tomcat\work\localhost_8080%2Ftest\_0002fjsp_0002fprofile_0002ejspprofile_jsp_10.java:64:
> > Class jsp.ConnectionHolder
> > not found.
> >
> > How do I go about in getting the ConnectionHolder to
> > work in my JSP?
> >
> > Thanks.
> >
> > cedric
> >
> > Below is the ConnectionHolder classs:
> >
> > class ConnectionHolder implements
> > HttpSessionBindingListener {
> >  private Connection con = null;
> >
> >  public ConnectionHolder (Connection con) {
> >   //save the connection
> >   this.con = con;
> >   try {
> >    con.setAutoCommit (false);  //transactions can
> > extend between web
> > pages!
> >   }
> >   catch (SQLException e) {
> >    //perform error handling
> >   }
> >  }
> >
> >  public Connection getConnection() {
> >   return con;
> >  }
> >
> >  public void valueBound (HttpSessionBindingEvent
> > event){
> >   //do nothing when added to a session
> >  }
> >
> >  public void valueUnbound (HttpSessionBindingEvent
> > event){
> >   //roll back changes when removed from a session
> >   // (or when the session expires)
> >   try {
> >    if (con!=null) {
> >     con.rollback();  //abandon any uncommitted data
> >     con.close();
> >    }
> >   }
> >   catch (SQLException e){
> >    //report it
> >   }
> >  }
> > }
> >
> >
> ===========================================================================
> > 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
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ===========================================================================
> 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