1
14
15 package com.liferay.taglib.util;
16
17 import com.liferay.portal.kernel.util.StringBundler;
18 import com.liferay.portal.kernel.util.StringPool;
19 import com.liferay.portal.kernel.util.WebKeys;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.jsp.tagext.BodyTagSupport;
23
24
29 public class HtmlTopTag extends BodyTagSupport {
30
31 public int doStartTag() {
32 return EVAL_BODY_BUFFERED;
33 }
34
35 public int doAfterBody() {
36 _bodyContentString = getBodyContent().getString();
37
38 return SKIP_BODY;
39 }
40
41 public int doEndTag() {
42 HttpServletRequest request =
43 (HttpServletRequest)pageContext.getRequest();
44
45 StringBundler sb = (StringBundler)request.getAttribute(
46 WebKeys.PAGE_TOP);
47
48 if (sb == null) {
49 sb = new StringBundler();
50
51 request.setAttribute(WebKeys.PAGE_TOP, sb);
52 }
53
54 sb.append(_bodyContentString);
55
56 return EVAL_PAGE;
57 }
58
59 private String _bodyContentString = StringPool.BLANK;
60
61 }