Subversion Repositories SmartDukaan

Rev

Rev 5497 | Rev 5638 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5497 Rev 5566
Line 30... Line 30...
30
	private String id;
30
	private String id;
31
	
31
	
32
	static	{
32
	static	{
33
		try {
33
		try {
34
			snippetFileNames.put("product-index", BASE_PATH + "productindex.html");
34
			snippetFileNames.put("product-index", BASE_PATH + "productindex.html");
35
			snippetFileNames.put("accessories-compatibility-index", BASE_PATH + "compatible-accessories-index.html");
35
			snippetFileNames.put("accessories-compatibility-index", BASE_PATH + "accessories-compatibility-index.html");
36
			snippetFileNames.put("most-compared-phones", BASE_PATH + "most-compared-index.html");
36
			snippetFileNames.put("most-compared-phones", BASE_PATH + "most-compared-index.html");
37
			
37
			
38
			for (String index: snippetFileNames.keySet())	{
38
			for (String index: snippetFileNames.keySet())	{
39
				
39
				
40
				FileReader fr = new FileReader(snippetFileNames.get(index));
40
				FileReader fr = new FileReader(snippetFileNames.get(index));
Line 59... Line 59...
59
	public String show()	{
59
	public String show()	{
60
		return "show";
60
		return "show";
61
	}
61
	}
62
	
62
	
63
	public String getHTML()	throws Exception {
63
	public String getHTML()	throws Exception {
-
 
64
		String filePath;
-
 
65
		String p1=request.getParameter("p1");
-
 
66
		String p2=request.getParameter("p2");
64
		if(snippets.containsKey(id)){
67
		if(snippets.containsKey(id)){
65
			return snippets.get(id);
68
			return snippets.get(id);
66
		}else {
-
 
67
			String p1="";
-
 
68
			String p2="";
-
 
69
			if(request.getParameter("p1") != null && request.getParameter("p2") != null){
69
		} else if(p1 == null && p2==null){
70
				p1 = request.getParameter("p1");
70
			filePath = BASE_PATH + id + ".html";
-
 
71
		}	
71
				p2 = request.getParameter("p2");
72
		else {
72
			}else if (request.getParameter("p1") != null || request.getParameter("p2") != null){
-
 
73
				p1 = request.getParameter("p1");
73
			if(p1 != null || p2 !=null){
74
				if(p1==null){
74
				if(p1==null){
75
					p1 = request.getParameter("p2");
75
					p1 = p2;
76
				}
76
				}
77
			}
77
			}
78
			String filePath;
-
 
79
			if(p2.equals("")){
78
			if(p2==null){
80
				filePath = BASE_PATH + "most-compared-" + p1 + ".html";
79
				filePath = BASE_PATH + "most-compared-" + p1 + ".html";
81
			} else {
80
			} else {
82
				filePath = BASE_PATH + "most-compared-" + p1 + "-vs-" + p2 + ".html";
81
				filePath = BASE_PATH + "most-compared-" + p1 + "-vs-" + p2 + ".html";
83
			}
82
			}
84
			return readFile(filePath);
-
 
85
		}
83
		}
-
 
84
		return readFile(filePath);
86
	}
85
	}
87
	
86
	
88
	public String getTitle()	{
87
	public String getTitle()	{
89
		String[] urlChunks = request.getServletPath().split("/");
88
		String[] urlChunks = request.getServletPath().split("/");
90
		String title = urlChunks[urlChunks.length - 1].replaceAll("-", " ");
89
		String title = urlChunks[urlChunks.length - 1].replaceAll("-", " ");