Hi, all! Is there any way to put a package statement in a JSP as in a regular Java class?
If so, is there any reason to do this?
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
posted 13 years ago
I don't think it makes sense to do this. Your application server will map each .jsp to a specific servlet. If you changed the package, you would change the location of the .class file for this servlet, so the application server would probably not be able to find the servlet class. But you can do this:
Then you could have
But, this procedure will likely tie you down to your particular JSP page compiler. But instead of doing this, I would be tempted to do the following: Get rid of all scriptlets in your JSP pages, and replace them with TagLibs. You can then put the .java source into any package you want.