2 Replies Latest reply: Jul 31, 2010 10:15 PM by EJP RSS

    unable to create a file using struts

      Hello experts,

      I am using this code in struts action class to create a xml file.
      File f = new File("src/java/usrXml/" + "my_name" + ".xml");
      but it is not working. and give me "File/Floder not found" exception. but when i copy same code in a java class having main() method. it is working fine.
      plz tell me why this code is not working in struts but in main method, and what should i do to make it working in struts action class.

      Thanks and regards
        • 1. Re: unable to create a file using struts
          Struts app is run in Tomcat/any other server environment, not in Your IDE exactly. Are You sure that in Your folder tree under Tomcat src folder is present?

          BTW: This is not a good place to ask such questions - better write in JSP section.
          • 2. Re: unable to create a file using struts
            Why you would create a new file in a 'src' directory in a Struts action? The 'src' directory isn't even there when Struts is executing. But 'folder not found' means exactly that: you named a folder in the filename that doesn't exist. Not really a Struts problem, just a folder problem really.