1 package mircoders.servlet;
6 import javax.servlet.*;
7 import javax.servlet.http.*;
9 import freemarker.template.*;
16 import mir.servlet.ServletModuleException;
18 import mircoders.entity.*;
19 import mircoders.storage.*;
20 import mircoders.module.*;
23 * ServletModuleLinksImcs -
24 * liefert HTML fuer LinksImcs
30 public class ServletModuleLinksImcs extends ServletModule
32 // Singelton / Kontruktor
33 private static ServletModuleLinksImcs instance = new ServletModuleLinksImcs();
34 public static ServletModule getInstance() { return instance; }
36 private ServletModuleLinksImcs() {
37 theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.LinksImcs.Logfile"));
38 templateListString = Configuration.getProperty("ServletModule.LinksImcs.ListTemplate");
39 templateObjektString = Configuration.getProperty("ServletModule.LinksImcs.ObjektTemplate");
40 templateConfirmString = Configuration.getProperty("ServletModule.LinksImcs.ConfirmTemplate");
43 mainModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
44 } catch (StorageObjectException e) {
45 theLog.printDebugInfo("ServletModuleLinksImcs konnte nicht initialisiert werden");
49 public void add(HttpServletRequest req, HttpServletResponse res)
50 throws ServletModuleException {
53 PrintWriter out = res.getWriter();
56 theList = mainModule.getByWhereClause(null, offset);
57 if (theList == null || theList.getCount() == 0 || theList.getCount()>1){
58 HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateListString, theList, out);
60 deliver(req, res, theList.elementAt(0), templateObjektString);
63 } catch(ModuleException e) {
64 throw new ServletModuleException(e.toString());
65 } catch (HTMLParseException e) {
66 throw new ServletModuleException(e.toString());
67 } catch (IOException e) {
68 throw new ServletModuleException(e.toString());