wood burning stoves*
The moose likes JSP and the fly likes importing class file in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "importing class file in jsp" Watch "importing class file in jsp" New topic
Author

importing class file in jsp

Naresh Saw
Ranch Hand

Joined: Sep 03, 2005
Posts: 66
hi all

how to import class file in jsp which r not in any package

this is not working

<%@ page import="Test" %>


naresh<br />SCJP 1.4(86%), SCWCD 1.4(78%)
pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
This is the way u can import class
1)

<%@ page language="java" %>
<%! class Find
{
private int c=0;
}%>


2)
suppose package name is Suppot
class is smart
then


<%@ page language="java" import="Support.*"%>
<%
smart a=new smart();
%>


Regards,
Pankaj Patil
Rohit Bhagwat
Ranch Hand

Joined: Dec 19, 2004
Posts: 205
You can import classes based on the following conditions,
1. Your class file must be present in the classpath
2. You cannot import classes that are present in the default package.
3. Your class file can be present in jar file which can be in the lib directory.

Ex 1 - by default WEB-INF/classes directory is in classpath.

Ex-2 - You cannot import a class in a jsp page that is present directly under classes directly.It must be present in some package in classes directory
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: importing class file in jsp
 
Similar Threads
jxl.jar to be used in a .jsp file
compilation error
Beans and Form processing
J2EE for Beginners
using custom tags & tag handler class - URGENT