X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmir%2Fservlet%2FServletModule.java;h=9de043c6b0338804900740447bbd5c73efce27c7;hb=86b6f499b413c722acc895346ac5186405b0c44c;hp=f749526455f35ccc4344065f9dea7245376bab36;hpb=7e9ceb1e66d027eff96ffa671892207e5ccd7e87;p=mir.git diff --git a/source/mir/servlet/ServletModule.java b/source/mir/servlet/ServletModule.java index f7495264..9de043c6 100755 --- a/source/mir/servlet/ServletModule.java +++ b/source/mir/servlet/ServletModule.java @@ -46,10 +46,10 @@ public abstract class ServletModule { * get the session binded language */ public String getLanguage(HttpServletRequest req){ - HttpSession session = req.getSession(); + HttpSession session = req.getSession(false); String language = (String)session.getAttribute("Language"); if(language==null){ - language=Configuration.getProperty("StandardLanguage"); + language=MirConfig.getProp("StandardLanguage"); } return language; } @@ -72,22 +72,27 @@ public abstract class ServletModule { try { EntityList theList; String offsetParam = req.getParameter("offset"); - int offset =0; + int offset=0; PrintWriter out = res.getWriter(); // hier offsetcode bearbeiten - if (offsetParam != null || !offsetParam.equals("")) offset = Integer.parseInt(offsetParam); - if (req.getParameter("next") != null) + if (offsetParam != null && !offsetParam.equals("")){ + offset = Integer.parseInt(offsetParam); + } + if (req.getParameter("next") != null){ offset=Integer.parseInt(req.getParameter("nextoffset")); - else - if (req.getParameter("prev") != null) + } else { + if (req.getParameter("prev") != null){ offset = Integer.parseInt(req.getParameter("prevoffset")); + } + } theList = mainModule.getByWhereClause(null, offset); //theList = mainModule.getByWhereClause((String)null, offset); - if (theList == null || theList.getCount() == 0 || theList.getCount()>1) - HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateListString, theList, out); - else + if (theList == null || theList.getCount() == 0 || theList.getCount()>1){ + HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateListString, theList, out); + } else { deliver(req, res, theList.elementAt(0), templateObjektString); + } } catch (Exception e) { throw new ServletModuleException(e.toString()); } @@ -127,7 +132,8 @@ public abstract class ServletModule { HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject()); String id = mainModule.add(withValues); // theLog.printDebugInfo("--trying to deliver..."+id); - deliver(req, res, mainModule.getById(id), templateObjektString); + list(req,res); + //deliver(req, res, mainModule.getById(id), templateObjektString); } catch (Exception e) { throw new ServletModuleException(e.toString());} } @@ -262,7 +268,7 @@ public abstract class ServletModule { try { //PrintWriter out = new LineFilterWriter(res.getWriter()); PrintWriter out = res.getWriter(); - HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateFilename, rtm , out); + HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateFilename, rtm , out); out.close(); } catch (HTMLParseException e) { throw new ServletModuleException(e.toString()); @@ -295,9 +301,9 @@ public abstract class ServletModule { * @param tmpl Name des Templates * @exception ServletModuleException */ - private void deliver(HttpServletRequest req, PrintWriter out, TemplateModelRoot rtm, String templateFilename) + private void deliver(HttpServletResponse res,HttpServletRequest req, PrintWriter out, TemplateModelRoot rtm, String templateFilename) throws HTMLParseException { - HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateFilename, rtm , out); + HTMLTemplateProcessor.process(res,getLanguage(req)+"/"+templateFilename, rtm , out); } /**