Howdy, >In the Servlet init() method you can call a method called getRealPath() > >This will return the name of the directory where your webapp is deployed. >You may need to store this is a system property or a static classs for >future use as it's only availalble on startup.
This is one of those posts that puts me on edge ;) (Long-time observers of this list know what I mean ;)) The getRealPath method is available during the servlet's entire lifecycle, not just during the init method. The getRealPath method does not work when running a packed WAR file (it returns null by definition). Servlet containers are required to support webapps running as a packed WAR, and not required to support other webapp distributions (e.g. exploded/filesystem). Therefore, by relying on the getRealPath method you compromise the portability of your webapp. It's one thing to follow bad design/development practices yourself -- it's your code, your app, do whatever you want. But please don't share these practices as advice ;) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
