Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
- response.setContentType("text/html");
- PrintWriter out= response.getWriter();
- String systemPath=request.getParameter("SYSTEMPATH");
- String deployPath = getServletConfig().getServletContext().getRealPath("/WEB-INF/DB.properties");
- InputStream stream = getServletContext().getResourceAsStream("/WEB-INF/DB.properties");
- Properties prop = new Properties();
- prop.load(stream);
- prop.setProperty("Workspace", systemPath);
- File file = new File(deployPath);
- FileOutputStream fileOut = new FileOutputStream(file);
- prop.store(fileOut, "sample properties");
- fileOut.close();
- }
- // load to store prop
- @SuppressWarnings ( "resource" )
- PrintWriter pw = new PrintWriter( configFile );
- pw.println( "#" + LocalDateTime.now() );
- pw.println( "hibernate.connection.username=" + prop.getProperty( "hibernate.connection.username" ) );
- pw.println( "hibernate.connection.password=" + prop.getProperty( "hibernate.connection.password" ) );
- pw.println( "hibernate.connection.url=" + prop.getProperty( "hibernate.connection.url" ) );
- pw.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement