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