Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problems of importing a class

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
I tried to import a class(e.g. test.class)from JSP and put it in ..\WEB-INF\classes file. However, it got a complilation error:
"org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\test\clientsearch_jsp.java:8: '.' expected
[javac] import test;
^
.........."
and my page directive is:
<%@ page import="test" %>
I compiled it fine in tomcat 4.0 but failed in 4.1. Can anyone tell me what happened?
Many thanks!
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
It looks like the Jasper JSP compiler is objecting to a class that is not contained in a package.
It is always recommended that you create classes in a package hierarchy. Have you tried putting you Test.class in a package ?
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a Bug?? Feature?? with JSP's, JSP's cannot fine classes that are not in a package! Change your class to have a package such as test so the fully qualified name of the class is test.test and inport this.
 
Ego Tang
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd put my class in a package and it worked fine!
Many thanks!
 
What a show! What atmosphere! What fun! What a tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic