• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to compile jsp's in different directory instead of tomcat work directory

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...

i posted a question about finding the absolute path on a server...
i found the answer but when i printed it out it displayed the tomcat directory in the absolute path.
is there a way that tomcat can compile my jsp's and servlets in my working directory...

Thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Short of your own custom Tomcat build, no.
At least I don't know of one.

What are you trying to do?
There might be another workaround.
 
Naadir Peterson
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well... i doing a file uploading module... so i need to get the absolute path of the server where the application will be residing. but when i run the following line on my jsp page:

out.println("Dir" + new File("..").getAbsolutePath());
i get - Dir C:\Program Files\Apache Group\Tomcat 4.1\..
instead of d:\Application\

for each client i will ned to make a new directory eg. \Application\documentUploadin\newClientDir
and store that clients documents in that directory...

maybe i need to run that code in a class or ejb since tomacat does not compile java classes... do u think that will work?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you'll always have trouble if you are relying on the location of the application.

If you run your app from a war file (as opposed to an exploded file system), the app (as far as it's concerned) doesn't have a physical location on server's file system.

For uploads, I make the path to the upload directory a config setting. It's a servlet init-param which get's set in web.xml.

If you must make the upload directory relative to your webapp, look at ServletContext.getRealPath(String):
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html #getRealPath(java.lang.String)

This will also return null if the app is being deployed from a war file instead of an exploded file system.
Buyer beware.
[ February 21, 2005: Message edited by: Ben Souther ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic