users@glassfish.java.net

How do I access a file in .war from compiled jsp?

From: <glassfish_at_javadesktop.org>
Date: Wed, 03 Feb 2010 07:00:38 PST

First Post.

Hello all, I'm new with both Glassfish and jsp programming so bear with me if I seem to be missing something elementary.

What I have is a simple application consisting of a jsp file that needs to access an XML document for editing. This document is stored along with the jsp in a WAR file that is deployed as a web application on glassfish.

I can access the XML file directly by going to [i]http://localhost:8080/app_name/data/xmlFile.xml[/i], which is fine if I want to display data from the XML file; but I need to edit it directly.

In order to do this it looks like I need to open it as a java File object and blah blah (I can make that work), however, opening it via a URL doesn't seem like the way to do that.

This brings me to my question: how can I access the file directly (ie "C:/glassfish/domains/domain1/.../data/xmlFile.xml". this shouldn't be too hard, except that the data/xmlFile.xml is in a WAR file.

I can get to the file using javascript by just going to "../data/xmlFile.xml".

Let me know if you need any more clarification.

Thanks in advance for any and all help!

JO
[Message sent by forum member 'jayo3434' (jayo3434_at_yahoo.com)]

http://forums.java.net/jive/thread.jspa?messageID=384516