• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class Import Can't be Resolved

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey All,

I created a class that I want to use for encrypting a string with RC4 and then return the encrypted string only problem is I seem to be having trouble getting the class to import. I am not sure if my import statement is wrong or if there is an issue with my class.

So I put my compiled class file into 'WEB-INF/classes' folder and here is the class code (code is sloppy now but I will clean it up once I have my class working),


Then in my jsp file this is what I put,


But when I run the jsp this is what I get (had to use code tag because of abbreviation rule on forum),


I am guessing it is something simple that I am doing wrong but can't seem to figure out what it is. Any help is appreciated.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you put your RC4 class into a package? If you didn't, then that's your problem. A class which is in a package (e.g. your JSP) can't import a class which isn't in a package.

So put it in a package. And remember that you then have to build a directory structure under WEB-INF/classes which corresponds to that package.
 
Jeremy Severson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not put the class in a package. So i added it to one and update the folder structure in the WEB-INF/classes directory and now it works great.

Do you always have to have your classes in a package? I thought that if I did not have a package set that I could use the class name only for the import.
reply
    Bookmark Topic Watch Topic
  • New Topic