wood burning stoves 2.0
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
JavaRanch » Java Forums » Java » JSP
Bookmark "importing class file in jsp" Watch "importing class file in jsp" New topic

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

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

suppose package name is Suppot
class is smart

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

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
It's not a secret anymore!