Can anyone recommend a good tutorial or reference guide on how to do File I/O in a Tomcat web server?
Specifically, I am using Tomcat 4. For some reason, I can't seem to grasp the basics of how Tomcat determines what the base directory is.
For example:
If I put this line of code in a JSP page:
I will bring me to:
This seems odd to me, because it seems like the base directory should be in the web application and not the entire web server.
However, in my actually Java code, if I use "/" for the directory it writes to my "C:\". If I use ".", it writes to the $CATALINA_HOME\bin directory.
According to Sun's site, there's no guaranteed way to read environment variables in Java objects, so I don't know how to tell my Java clases to start at $CATALINA_HOME except to make my base "..". And will this even remain consistent when I deploy on my ISP? Can I get this information through some class in the servlet?
As you can see, I'm confused. Is there a good reference for File I/O in Tomcat?
Thanks!
Tom
Specifically, I am using Tomcat 4. For some reason, I can't seem to grasp the basics of how Tomcat determines what the base directory is.
For example:
If I put this line of code in a JSP page:
Code:
<a href="/">I point to the root folder.</a>
I will bring me to:
Code:
[URL unfurl="true"]http://localhost:8080/[/URL]
This seems odd to me, because it seems like the base directory should be in the web application and not the entire web server.
However, in my actually Java code, if I use "/" for the directory it writes to my "C:\". If I use ".", it writes to the $CATALINA_HOME\bin directory.
According to Sun's site, there's no guaranteed way to read environment variables in Java objects, so I don't know how to tell my Java clases to start at $CATALINA_HOME except to make my base "..". And will this even remain consistent when I deploy on my ISP? Can I get this information through some class in the servlet?
As you can see, I'm confused. Is there a good reference for File I/O in Tomcat?
Thanks!
Tom