Thursday, February 3, 2011

Using JSF : To Track XML file location which is under the Web application


There is an web application, where my xml file is under the WEB Content folder.

/WEB Content

we can get the location of .xml file using the below suggested code :

ServletContext serCtx = (ServletContext) FacesContext

String filepath = serCtx.getRealPath("/xml/test.xml");

We can get the path of the xml file, where it stored while running the project and we can modify xml and save the file in the same location by using the below code

new XMLOutputter(Format.getPrettyFormat()).output(org.jdom.Document doc,
                    new FileWriter(filepath));

Flex with JSF

   Flex with JSF

Exadel provided Fiji,

For Demo :
we can visit the link