File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Package Servlet Error

 
Michele Smith
Ranch Hand
Posts: 421
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I inherited a project from someone else. Their naming convention provides for all the servlets to be organized under a package.

When I remove the "package language" all I have is this:



On the line referring to the DiskFileItemFactory Item from above, the servlet has a red X beside it and it also says when you hover above that, "syntax error on tokens, delete these tokens".

I am not sure what I should do.

Can anyone shed some light for me?

Thanks,
Midani
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why did you remove the package structure? It's a very good practice to put every class inside a package. The only exceptions I make are small classes that I mostly use for quickly testing something and discard within an hour or so.
 
Michele Smith
Ranch Hand
Posts: 421
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't exactly removed it, I just noticed that when I deleted that line there weren't as many errors. I can certainly put it back in but I will have lots more errors.
 
Paul Clapham
Sheriff
Pie
Posts: 20188
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the errors are going to be telling you about lines of code which should be inside a class. Which is every single line of code which you posted there. If you'll remember back to when you were learning basic Java, you should remember that a Java class starts with code looking something like this:


And yes, servlets are required to be in a package. But the package declaration isn't the source of your error messages.
 
Michele Smith
Ranch Hand
Posts: 421
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic