KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.nextime.ion.admin.action;
2
3 import org.nextime.ion.framework.config.*;
4 import org.apache.struts.action.*;
5 import javax.servlet.http.*;
6 import javax.servlet.*;
7 import java.io.*;
8
9
10 public class ConfigAction extends Action {
11
12
13     public ActionForward perform(
14         ActionMapping mapping,
15         ActionForm form,
16         HttpServletRequest request,
17         HttpServletResponse response)
18         throws IOException, ServletException {
19     
20         // trouve le path du fichier de config database utilisé
21
File f = Config.getInstance().getDatabaseConfigurationFile();
22         request.setAttribute("pathConfig",f.getAbsolutePath());
23         
24         // lit le contenu du fichier
25
String JavaDoc content = "";
26         String JavaDoc line = "";
27         BufferedReader is = new BufferedReader( new InputStreamReader( new FileInputStream(f) ) );
28         while( line != null ) {
29             content+=line+"\r\n";
30             line = is.readLine();
31         }
32         is.close();
33         request.setAttribute("content",content);
34     
35         request.setAttribute("view", "config");
36         return mapping.findForward("view");
37     }
38
39
40 }
Popular Tags