Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with package declarations in a web app  RSS feed

 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure where the best place is for this question, because I'm not entirely sure what the problem is.
Basically, I have a web app that works fine. It's under c:\resin\webapps\updater\WEB-INF\classes\. All the related .class files are there, jsp files are elsewhere (not have a problem with those).
Now the problem comes up that I want to have a similar web app, but it's a sample version. It uses a majority of the same resources that the "production" one does, but has some modification to its classes.
So what I did was created a "Sample" package under the classes directory, and stuck all the modified classes under there (and also the ones that I didn't modify, but still copied to this package). I put a package statement in each of the classes. So yes, there are some duplicates, but oh well, that's the least of my problems.
Now, everytime that I want a class that is within this package to access another class with the same package, I have to hard code "sample.ClassName" anywhere in my code that I call another class. If I don't, I get all sorts of ClassCast exceptions, etc.
Is there something specific to the servlet container that I need to modify to make it so that I don't have to write "sample.ClassName" for every class that is accessed, even from with the sample package?
*begins babbling incoherently*
Ps. Feel free to move this if the answer has nothing to do with servlets, containers, etc.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And my web.xml file looks like:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!