users@glassfish.java.net

Re: java.io.FileNotFoundException tried to access a xml file with jdom

From: Hadraba Petr <hadrabap_at_bluetone.cz>
Date: Mon, 20 Aug 2007 17:33:01 +0200

Hello,

when you put your menu.xml into the WEB-INF/classes directory, it will
be available under the "/WEB-INF/classes/menu.xml" resource path.

The WEB-INF/ directory is simply accessible and the classes/ directory too.

There are two points:
 - full resource path and
 - relative path.

Example:

You have the following java class

local.sandbox.MySuperClass

Inside the MySuperClass you want to load resource. When you use
relative path -- "menu.xml", the ServletContext.getResource() will
look for the menu.xml inside the "/WEB-INF/classes/local/sandbox/".

Is my explanation clear?

Have a lot of fun!

Sincerely

PETR


On 8/18/07, glassfish_at_javadesktop.org <glassfish_at_javadesktop.org> wrote:
> Thx,
>
> but i'm a little bit confused now. I put the menu.xml file within WEB-INF/classes folder but i can't open it.
>
> Maybe there is another way to make a dynamic xml-menu with jsp and a java bean.
>
> My Idea is:
>
> [b]I have an xml-file with a structure like this[/b]
>
> [i]<home title="Home" location="mainfolder/home/index.jsp">
> <person title="I am" location="mainfolder/person/me.jsp>
> some infos
> </person>
> </home>[/i]
>
> [b]now i ll parse this xml-file with jdom with a bean, which returns a list of the elements[/b]
>
> [b]The JSP should get this list and make a menu from the elements[/b]
> [i]
> Home
> |-- I am
> [/i]
> So when i ll only chane some elements within the xml-file the menustructure from the jsp will change automatically.
>
> Can anyone give me a solution, where i have to put the menu.xml and how can i parse it within the bean?
> [Message sent by forum member 'merschi' (merschi)]
>
> http://forums.java.net/jive/thread.jspa?messageID=231477
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>