1 package org.paneris.jammyjoes.controller; 2 3 import java.util.Enumeration; 4 5 import org.melati.Melati; 6 import org.melati.template.ServletTemplateContext; 7 import org.paneris.jammyjoes.model.JammyjoesDatabase; 8 import org.paneris.jammyjoes.servlet.JammyJoesMelatiServlet; 9 10 public class Page extends JammyJoesMelatiServlet { 11 12 private static final long serialVersionUID = 1L; 13 14 protected String jammyjoesRequest(Melati melati, ServletTemplateContext context) throws Exception { 15 16 String template = "index.html"; 17 String[] pathInfo = melati.getPathInfoParts(); 18 if (pathInfo.length > 0) { 19 template = pathInfo[0]; 20 } 21 if (!template.equals("Toys.html")) { 22 return "html/" + template; 23 } else { 24 JammyjoesDatabase db = (JammyjoesDatabase) melati.getDatabase(); 25 Enumeration results = 26 new ProductSearch(db, 9999, new Logger(null)).doSearch(new NullSearchCriteria()); 27 context.put("results", results); 28 return "view/Toys.wm"; 29 } 30 } 31 32 }