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 | 0 | 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 | 0 | String template = "index.html"; |
17 | 0 | String[] pathInfo = melati.getPathInfoParts(); |
18 | 0 | if (pathInfo.length > 0) { |
19 | 0 | template = pathInfo[0]; |
20 | |
} |
21 | 0 | if (!template.equals("Toys.html")) { |
22 | 0 | return "html/" + template; |
23 | |
} else { |
24 | 0 | JammyjoesDatabase db = (JammyjoesDatabase) melati.getDatabase(); |
25 | 0 | Enumeration results = |
26 | |
new ProductSearch(db, 9999, new Logger(null)).doSearch(new NullSearchCriteria()); |
27 | 0 | context.put("results", results); |
28 | 0 | return "view/Toys.wm"; |
29 | |
} |
30 | |
} |
31 | |
|
32 | |
} |