Richard O. Hammer wrote:


I'm using Eclipse and MyEclipse building a webapp with a standard directory structure:

  WebRoot
    .jsp files
    WEB-INF
      classes
      lib

In several of my JSPs I have the same need which would be well served by having one centrally located utility class, where I can put a method accessible to all the JSPs.

Question 1: Do I pretty much need to put that utility class down in /WEB-INF/classes? Am I correct that there is no natural way to put such a class up in WebRoot with the JSPs which use it?

You should put all classes that you write in the WEB-INF/classes directory. That is naturally where they go unless you jar them. In that case put them in the lib directory.


Question 2: What is the best way for my class down in /WEB-INF/classes to get access to the servlet packages.


Are you talking about build time or runtime? If you are running in a servlet container then those classes should know about anything in the j2ee.jar. You will need to pass your request object to that utility class.

If you are having compilation problems then it is just a matter of putting the j2ee.jar in your classpath.

Thank you,

Rich


_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org


_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to