KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > admin > action > ChangeDatabaseAction


1 package org.nextime.ion.admin.action;
2
3 import org.nextime.ion.framework.config.*;
4 import org.nextime.ion.framework.mapping.*;
5 import org.apache.struts.action.*;
6 import javax.servlet.http.*;
7 import javax.servlet.*;
8 import java.io.*;
9
10
11 public class ChangeDatabaseAction extends Action {
12
13
14     public ActionForward perform(
15         ActionMapping mapping,
16         ActionForm form,
17         HttpServletRequest request,
18         HttpServletResponse response)
19         throws IOException, ServletException {
20     
21         // trouve le path du fichier de config database utilisť
22
File f = Config.getInstance().getDatabaseConfigurationFile();
23                 
24         // ecris le contenu du fichier
25
PrintStream os = new PrintStream( new FileOutputStream(f) );
26         os.println( request.getParameter("content") );
27         os.close();
28         
29         Mapping.getInstance().reset();
30     
31         request.setAttribute("view", "config");
32         return mapping.findForward("success");
33     }
34
35
36 }
Popular Tags