|
1 |
| package photospace.web.tags; |
|
2 |
| |
|
3 |
| import javax.servlet.jsp.*; |
|
4 |
| import javax.servlet.jsp.tagext.*; |
|
5 |
| import photospace.*; |
|
6 |
| import photospace.search.*; |
|
7 |
| |
|
8 |
| public class BrowseTag |
|
9 |
| extends TagSupport |
|
10 |
| { |
|
11 |
| private String var = "result"; |
|
12 |
| private int scope = PageContext.PAGE_SCOPE; |
|
13 |
| private String path; |
|
14 |
| private int order = Searcher.ASCENDING; |
|
15 |
| private int start = 0; |
|
16 |
| private int end = -1; |
|
17 |
| |
|
18 |
0
| public int doStartTag() throws JspTagException
|
|
19 |
| { |
|
20 |
0
| try
|
|
21 |
| { |
|
22 |
0
| pageContext.setAttribute("result", Application.searcher().browse(path, order, start, end), scope);
|
|
23 |
| } |
|
24 |
| catch (Exception e) |
|
25 |
| { |
|
26 |
0
| throw new JspTagException(e);
|
|
27 |
| } |
|
28 |
0
| return EVAL_BODY_INCLUDE;
|
|
29 |
| } |
|
30 |
| |
|
31 |
0
| public void setPath(String path)
|
|
32 |
| { |
|
33 |
0
| this.path = path;
|
|
34 |
| } |
|
35 |
| |
|
36 |
0
| public void setStart(int start)
|
|
37 |
| { |
|
38 |
0
| this.start = start;
|
|
39 |
| } |
|
40 |
| |
|
41 |
0
| public void setEnd(int end)
|
|
42 |
| { |
|
43 |
0
| this.end = end;
|
|
44 |
| } |
|
45 |
| |
|
46 |
0
| public void setOrder(int order)
|
|
47 |
| { |
|
48 |
0
| this.order = order;
|
|
49 |
| } |
|
50 |
| |
|
51 |
0
| public void setVar(String var)
|
|
52 |
| { |
|
53 |
0
| this.var = var;
|
|
54 |
| } |
|
55 |
| |
|
56 |
0
| public void setScope(String scope)
|
|
57 |
| { |
|
58 |
0
| if (PageContext.REQUEST.equalsIgnoreCase(scope))
|
|
59 |
0
| this.scope = PageContext.REQUEST_SCOPE;
|
|
60 |
0
| else if (PageContext.SESSION.equalsIgnoreCase(scope))
|
|
61 |
0
| this.scope = PageContext.SESSION_SCOPE;
|
|
62 |
0
| else if (PageContext.APPLICATION.equalsIgnoreCase(scope))
|
|
63 |
0
| this.scope = PageContext.APPLICATION_SCOPE;
|
|
64 |
| } |
|
65 |
| } |