1
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.dao.orm.QueryUtil;
18 import com.liferay.portal.kernel.servlet.StringServletResponse;
19 import com.liferay.taglib.util.IncludeTag;
20
21 import javax.servlet.RequestDispatcher;
22 import javax.servlet.ServletContext;
23 import javax.servlet.http.HttpServletRequest;
24 import javax.servlet.http.HttpServletResponse;
25 import javax.servlet.jsp.JspException;
26
27
32 public class MyPlacesTag extends IncludeTag {
33
34 public static void doTag(
35 ServletContext servletContext, HttpServletRequest request,
36 HttpServletResponse response)
37 throws Exception {
38
39 doTag(_PAGE, _MAX, servletContext, request, response);
40 }
41
42 public static void doTag(
43 int max, ServletContext servletContext, HttpServletRequest request,
44 HttpServletResponse response)
45 throws Exception {
46
47 doTag(_PAGE, max, servletContext, request, response);
48 }
49
50 public static void doTag(
51 String page, int max, ServletContext servletContext,
52 HttpServletRequest request, HttpServletResponse response)
53 throws Exception {
54
55 request.setAttribute("liferay-ui:my_places:max", String.valueOf(max));
56
57 RequestDispatcher requestDispatcher =
58 servletContext.getRequestDispatcher(page);
59
60 requestDispatcher.include(request, response);
61 }
62
63 public int doEndTag() throws JspException {
64 try {
65 ServletContext servletContext = getServletContext();
66 HttpServletRequest request = getServletRequest();
67 StringServletResponse stringResponse = getServletResponse();
68
69 doTag(getPage(), _max, servletContext, request, stringResponse);
70
71 pageContext.getOut().print(stringResponse.getString());
72
73 return EVAL_PAGE;
74 }
75 catch (Exception e) {
76 throw new JspException(e);
77 }
78 }
79
80 public void setMax(int max) {
81 _max = max;
82 }
83
84 protected String getDefaultPage() {
85 return _PAGE;
86 }
87
88 private static final String _PAGE = "/html/taglib/ui/my_places/page.jsp";
89
90 private static final int _MAX = QueryUtil.ALL_POS;
91
92 private int _max = _MAX;
93
94 }