Hi, I have a very big problem. In my Web Application I have to open some images (.tif) in my Jsp. The problem is that all those images togheter are very strong (a lot of Gb) and so I have to place them into different subdirectories inside the main directory. The main directory is quite strong, and so I cannot place it under my Application's defaultroot, at the same level than jsp, neither in the .war file. I have to place it in another file system directory than this. So, I need my jsp to be able to enter into this file system directory and also into all of its subdirectories. How can I do that?? OS: Windows 200 Server AS: Tomcat 4.0.6 Thanks a lot... and sorry for my English! bye
Hi Marco, While I would argue that this sort of processing would be best done in a servlet, bean or custom tag rather than in code directly on a JSP, I'm not sure exactly what aspect of file I/O you are having difficulty with. If the files reside outside of your web application (which is what I am guessing based upon your post) and you know where the files are, "normal" file I/O should suit you just fine. If you want to "feed" your web application the location rather than hard-coding it in the code (always a good idea), you can use init params in the web.xml to let your app know where to look for the files. If the files are within your web application and you need to locate them relative to the root of the web app, the ServletContext.getRealPath() method is your best friend. Does any of this help? Or am I completely missing what problem you are having? hth, bear
My English ain't so good either, so don't feel too bad. As I read it, you want to display a large (file size) TIFF image in a browser window. If you use a JSP or servlet, you can open a file and simply copy it (MIME type x-image/tif or something like that) from any file location the server can see - whether it's actually been bundled into the webapp (not recommended for this use) or located on some LAN server that the web server maps to. The logic itself is simple. Once you've set the headers, open the source image file and copy it to the output stream. It's a good idea to send a Content-length header with the file size in it (PDF's have been known to display improperly if you don't send a valid Content-Length). A common practice for even better performance is to front-end the appserver with a pure web server such as Apache and have apache fetch and transmit the documents directly. You can do this if there's no processing required. JSPs and other Java resources are simply passed on from the Apache server to the Java server.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Well don't expect me to do the dishes! This ad has been cleaned for your convenience: