2
<servlet>
        <servlet-name>JobCreateServlet</servlet-name>
        <servlet-class>com.vayam.gip.JobCreateServlet</servlet-class>
        <init-param>
            <param-name>upload_path</param-name>
            <param-value>/home/gip/static</param-value>
        </init-param>
    </servlet>

above code is in XML named web.xml. I want to change <param-value> i.e. /home/gip/static to /home/ToUser'sFolder. How can I change the path dynamically?

Mehran
  • 308
  • 3
  • 15
  • What is the reason for needing to change the upload path dynamically? – vcetinick Jan 19 '15 at 05:37
  • i want to give an option to upload file for each user to their own folder. In my system, i'm providing an option to upload file via ftp also. so that when user upload file via ftp then it must be appear on webpage. –  Jan 19 '15 at 05:55
  • 1
    [here the look a like](http://stackoverflow.com/a/7676294/2749470) you can achieve it using `maven` here the [example](http://stackoverflow.com/q/15355708/2749470) or use an evironment variable – Bhargav Modi Jan 19 '15 at 06:16

1 Answers1

0

Use an XML Parser to read the file and change the desired value. You can find a tutorial on how to do this here: http://www.java-samples.com/showtutorial.php?tutorialid=152

barq
  • 3,681
  • 4
  • 26
  • 39