• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java files in tomcat

 
Gopi Krrishna
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gopi Krrishna
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is covered in the JSP FAQ. Please be sure to check the FAQ before posting to the forum.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic