title: Write data in property file using servlet
body: <pre><code>package com.igate.controller;
  
  import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.commons.configuration.ConfigurationException;
  import org.apache.commons.configuration.PropertiesConfiguration;
  
  
  
  public class TestController extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      public TestController() {
  
      }
  
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          doPost(request, response);
      }
  
  
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
  
                  response.setContentType("text/html");
  
          String action= request.getParameter("action");
  
  
          System.out.println(action);
  
  
  
  
      if(action.equals("proceed"))
  
      {
  
          String pf =request.getParameter("pf");
          String app =request.getParameter("app");
          String bw =request.getParameter("b");
  
  
          PropertiesConfiguration config =null;
  
          try {
              config = new PropertiesConfiguration("D:/SCT_WRK/projectOne/framework.properties");
              config.setProperty("PLATFORM",pf);
              config.setProperty("APP_TYPE",app);
              config.setProperty("BROWSER",bw);
  
              config.save();
          } catch (ConfigurationException e) {
  
              e.printStackTrace();
  
  
          }
  
  
  
  
  
      }
  
  
  
      }
  
      }
  </code></pre>
  
  <p>Actually</p>
  
  <pre><code>I  want to write data in property file that data comes from jsp file(user entered data). but above code is not working.
  </code></pre>
  
  <p>I need -
  1>. write user input data in property file without effecting previous data of property file.</p>
  
  <p>but  It is giving some problem-</p>
  
  <p>1>.  EXCEPTION: javax.servlet.ServletException: Error instantiating servlet class com.igate.controller.TestController
  2>. java.lang.NoClassDefFoundError: org/apache/commons/configuration/ConfigurationException
  3>. java.lang.ClassNotFoundException: org.apache.commons.configuration.ConfigurationException</p>
  
  <p>and this is complete stack trace.</p>
  
  <p>Here is full stack trace..
  HTTP Status 500 -</p>
  
  <p>type Exception report</p>
  
  <p>message</p>
  
  <p>description The server encountered an internal error () that prevented it from fulfilling this request.</p>
  
  <pre><code>exception javax.servlet.ServletException: Error instantiating servlet class com.igate.controller.TestController
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  java.lang.Thread.run(Unknown Source)
  
  root cause java.lang.NoClassDefFoundError: org/apache/commons/configuration/ConfigurationException java.lang.Class.getDeclaredConstructors0(Native Method)
  java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
  java.lang.Class.getConstructor0(Unknown Source)
  java.lang.Class.newInstance(Unknow Source)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  java.lang.Thread.run(Unknown Source)
  
  root cause java.lang.ClassNotFoundException: org.apache.commons.configuration.ConfigurationException
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1672)
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1517)
  java.lang.Class.getDeclaredConstructors0(Native Method)
  java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
  java.lang.Class.getConstructor0(Unknown Source)
  java.lang.Class.newInstance(Unknown Source)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
  java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  java.lang.Thread.run(Unknown Source)
  
  Apache Tomcat/7.0.4
  </code></pre>