| Author |
Help Package Servlet Error
|
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
|
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
Bartender
Joined: Oct 14, 2005
Posts: 16479
|
|
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
Joined: Oct 27, 2010
Posts: 298
|
|
|
Thanks.
|
 |
 |
|
|
subject: Help Package Servlet Error
|
|
|