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

Get servlet context with plain java class  RSS feed

 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is there any way to get a servletContext with a plain javaclass.

I have noticed that I need one more parameter, In order to do that I would need to change the whole application unless I could get the servlet context.

thanks in advanced.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, there's no way. But it would be better to design your class to accept data that your servlet would extract from the context, so that the other classes wouldn't even know they were being used in a servlet. This makes them easier to test and possibly to reuse in other situations.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!