1 package com.genimen.djeneric.web.controller; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletException ; 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 import org.w3c.dom.Document ; 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 request, HttpServletResponse response) 26 throws IOException , ServletException , 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 doc = _renderer.asXml(sessionManager, tree); 36 37 String page = xsl.transform(doc, "main.xsl"); 38 response.getWriter().print(page); 39 } 40 catch (Exception e) 41 { 42 throw new ServletException (e); 43 } 44 } 45 } 46 | Popular Tags |