1
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.util.StringPool;
18 import com.liferay.portal.util.SessionClicks;
19
20 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.jsp.JspException;
22 import javax.servlet.jsp.PageContext;
23 import javax.servlet.jsp.tagext.TagSupport;
24
25
30 public class ToggleValueTag extends TagSupport {
31
32 public static void doTag(String id, PageContext pageContext)
33 throws Exception {
34
35 HttpServletRequest request =
36 (HttpServletRequest)pageContext.getRequest();
37
38 String value = SessionClicks.get(request, id, StringPool.BLANK);
39
40 if (value.equals(StringPool.BLANK)) {
41 value = "block";
42 }
43
44 pageContext.getOut().print(value);
45 }
46
47
50 public static void doTag(
51 String id, PageContext pageContext, HttpServletRequest request)
52 throws Exception {
53
54 doTag(id, pageContext);
55 }
56
57 public int doEndTag() throws JspException {
58 try {
59 doTag(_id, pageContext);
60
61 return EVAL_PAGE;
62 }
63 catch (Exception e) {
64 throw new JspException(e);
65 }
66 }
67
68 public void setId(String id) {
69 _id = id;
70 }
71
72 private String _id;
73
74 }