session-tracking over get-param, if browser does not allow cookies.
[mir.git] / source / mircoders / servlet / ServletModuleLinksImcs.java
index 1d4720c..761d8fb 100755 (executable)
@@ -50,23 +50,19 @@ public class ServletModuleLinksImcs extends ServletModule
   public void add(HttpServletRequest req, HttpServletResponse res)
     throws ServletModuleException {
     try {
-      SimpleHash mergeData = new SimpleHash();
+      SimpleHash modelRoot = new SimpleHash();
       EntityList   theList;
-      mergeData.put("new", "1");
-
-      PrintWriter out = res.getWriter();
       int offset = 0;
 
-      theList = mainModule.getByWhereClause("to_parent_id=0", offset);
-      mergeData.put("contentlist",((ModuleLinksImcs)mainModule).getLinksImcsAsSimpleHash());
+      theList = mainModule.getByWhereClause("to_parent_id=NULL", offset);
+      modelRoot.put("new", "1");
+      modelRoot.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
 
       if (theList == null || theList.getCount() == 0 || theList.getCount()>1){
-        //HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, theList, out);
-        HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, mergeData, out);
+        HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateObjektString, modelRoot, res.getWriter());
 
       } else {
-        //deliver(req, res, theList.elementAt(0), templateObjektString);
-        deliver(req, res, mergeData, templateObjektString);
+        deliver(req, res, modelRoot, templateObjektString);
       }
 
     } catch(ModuleException e) {
@@ -75,8 +71,11 @@ public class ServletModuleLinksImcs extends ServletModule
       throw new ServletModuleException(e.toString());
     } catch (IOException e) {
       throw new ServletModuleException(e.toString());
+    } catch(StorageObjectException e) {
+      throw new ServletModuleException(e.toString());
     }
 
+
   }
 }