-/*
- * put your module comment here
- *
- */
-
-
package mir.servlet;
import java.io.*;
* 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;
}
try {
EntityList theList;
String offsetParam = req.getParameter("offset");
- int offset;
+ int offset=0;
PrintWriter out = res.getWriter();
// hier offsetcode bearbeiten
- if (offsetParam != null || !offsetParam.equals("")){
+ if (offsetParam != null && !offsetParam.equals("")){
offset = Integer.parseInt(offsetParam);
- } else {
- offset = 0;
}
- if (req.getParameter("next") != null)
+ 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());
}
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());}
}
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());
throws ServletModuleException {
deliver(req, res,HTMLTemplateProcessor.makeSimpleHash(ent), templateFilename);
}
+
/**
* deliver liefert das Template mit dem Filenamen templateFilename
* an den HttpServletResponse res aus, nachdem es mit den Daten aus
* @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);
}
/**