KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > web > controller > MainCommand


1 package com.genimen.djeneric.web.controller;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8
9 import org.w3c.dom.Document JavaDoc;
10
11 import com.genimen.djeneric.repository.exceptions.DjenericException;
12 import com.genimen.djeneric.web.renderers.MainRenderer;
13 import com.genimen.djeneric.web.renderers.tree.WebTree;
14 import com.genimen.djeneric.web.util.DjenericSessionManager;
15 import com.genimen.djeneric.web.util.DjenericXSLTransform;
16
17 public class MainCommand
18 {
19   MainRenderer _renderer = new MainRenderer();
20   
21   public MainCommand()
22   {
23   }
24
25   public void get(DjenericSessionManager sessionManager, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
26       throws IOException JavaDoc, ServletException JavaDoc, DjenericException
27   {
28     try
29     {
30       WebTree tree = sessionManager.getTree();
31       DjenericXSLTransform xsl = sessionManager.getTransformer();
32
33       response.setContentType("text/html; charset=UTF-8");
34
35       Document JavaDoc doc = _renderer.asXml(sessionManager, tree);
36
37       String JavaDoc page = xsl.transform(doc, "main.xsl");
38       response.getWriter().print(page);
39     }
40     catch (Exception JavaDoc e)
41     {
42       throw new ServletException JavaDoc(e);
43     }
44   }
45 }
46
Popular Tags