wood burning stoves 2.0*
The moose likes JSP and the fly likes Java files in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Java files in tomcat" Watch "Java files in tomcat" New topic
Author

Java files in tomcat

Gopi Krrishna
Greenhorn

Joined: Feb 15, 2006
Posts: 12
I want to access ordinary java files in my jsp code. access in the sense i want to create an object like ClassA obj=new ClassA(); My problem is where should i put that ClassA.class file in my webapps folder?

i have put that class file inside my WEB-INF/classes folder but still when i try to run my jsp file i get error as
ClassA cannot be resolved to a type

Please help


SCJP 1.4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
Does the JSP have the proper import statement, i.e.

<%@ page import="package.ClassA" %>

Note that I prepended a package name, because classes can't be in the default package to be used like this.


Ping & DNS - my free Android networking tools app
Gopi Krrishna
Greenhorn

Joined: Feb 15, 2006
Posts: 12
Originally posted by Ulf Dittmer:
Does the JSP have the proper import statement, i.e.

<%@ page import="package.ClassA" %>

Note that I prepended a package name, because classes can't be in the default package to be used like this.


Thanks Ulf Dittmer,
When i use it with package as you said, its working fine. Thanks for help.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

This is covered in the JSP FAQ. Please be sure to check the FAQ before posting to the forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
This is covered in the JSP FAQ.


I have added that particular error message to the FAQ page, so that it's easy to find through a search.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java files in tomcat