Sorry, I forgot to mention the import statement need to be changed too <%@ page import="org.apache.jsp.DBConnection" %>
Sorry, I'm quit in a hurry xav, Original Message ----------------------- Hi, Apparently you put your class in the wrong directory, as i can see from your stacktrace: org.apache.jsp.DBConnection not found. you'r DBConnection class should reside in /org/apache/jsp/ The directories should respect you're package organisation. So you can create you're directory structure in your webapp directory under WEB-INF/classes or WEB-INF/lib, normally if it's an external class, it should be considered as a lib, but still you can choose. No classpath problems, it's tomcat servlet container which handles you're webapps classpath as long you respect the package-directory structure under WEBINF/classes, and lib. Hope this helps, xav, Original Message ----------------------- It works not. Thanks alot Elena. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 4:26 PM To: [EMAIL PROTECTED] Subject: Re: How to call a user defined method from a JSP The specifics may vary from server to server, but in general you can you place the class anywhere. However, your classpath must point to the directory containing the code. Also, remember to import your class in your JSP. <%@ page import="DBConnection" %> Hope this helps. ~ Elena. --------------------------- Elena Tsifrina SYSCOM, Inc. www.syscom.com "Chauviaux, Patrick" <[EMAIL PROTECTED] To: [EMAIL PROTECTED] NISYS.COM> cc: Sent by: A mailing list Subject: Re: How to call a user defined method from a about Java Server Pages JSP specification and reference <[EMAIL PROTECTED] COM> 02/27/02 10:11 AM Please respond to A mailing list about Java Server Pages specification and reference In fact, what I want to know is where do I have to put the DBConnection.class or do you have to change the classpath? Please help me. -----Original Message----- From: Chauviaux, Patrick [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 2:43 PM To: [EMAIL PROTECTED] Subject: How to call a user defined method from a JSP Hello, I am new to JSP so my question is perhaps not really interesting for you but I would appreciate if you could reply. I have created a JSP and a class DBConnection. I want to create an instance of that class in my JSP like this: <% DBConnection dbc = new DBConnection(); %> I use an Apache-Tomcat server and I have put the JSP and the DBConnection.class in the same directory ($TOMCAT\webapps\ROOT\) The problem is that when I test the JSP it can't find the class DBConnection. I have the following error: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred between lines: 150 and 158 in the jsp file: /SubscriptionHousehold.jsp Generated servlet error: C:\jakarta-tomcat-4.0.2\work\localhost\_\SubscriptionHousehold$jsp.java:63: Class org.apache.jsp.DBConnection not found. DBConnection dbc = new DBConnection(); Can someone tell me what I have to do to be able to create an instance of DBConnection in my JSP? Is it possible? I hope it is. Best regards, Patrick =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
