Hi JO, you can try the following to access the file you requested:
File file = new
File(ServletActionContext.getServletContext().getContextPath() +
"data/xmlFile.xml");
Hope it helps. Cheers.
On Wed, Feb 3, 2010 at 16:00, <glassfish_at_javadesktop.org> wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
--
David Sanmartín
www.david-sanmartin.net
Sent from Valencia, Comunidad Valenciana, España