I hope the below comments help.
- Steve
-- Steven Peterson, President Frontier Productions, Inc. 310 Wesley Drive Chapel Hill, NC 27516 Tel: 919-942-1386 Fax: 919-933-2677
Creators of List Pilot
Easier email broadcasting from your customer database. http://www.listpilot.net
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?
Yes, or in a jar file in the /WEB-INF/lib directory. However, the 'naturalest' do this may be to create a custom tag the encapsulates the untility class behavior.
Trying to write my method in a utility class down there in /WEB-INF/classes, I discover that HttpServletRequest can't be resolved down there. I gather the servlet jar is not on the build path, not for the lowly citizens of /WEB-INF/classes anyhow. But it seems obvious to me that the servlet jar is accessible to my JSPs, which can refer freely to the servlet packages. Seems sort of unfair.
Question 2: What is the best way for my class down in /WEB-INF/classes to get access to the servlet packages.
You *could* pass in the servlet object or the request object in the method call to the utility class. Again, you may also consider writing a custom tag that performs the utility function you need. As far as making the application classes aware of the servlet.jar file during production, your container should handle this for you (in Tomcat, the servlet.jar file is in the TOMCAT_HOME/common/lib directory.) If it does not, you I guess you could put the servlet.jar file in the /WEB-INF/lib directory.
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
