001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.util.StringPool;
018 import com.liferay.portal.util.SessionClicks;
019
020 import javax.servlet.http.HttpServletRequest;
021 import javax.servlet.jsp.JspException;
022 import javax.servlet.jsp.PageContext;
023 import javax.servlet.jsp.tagext.TagSupport;
024
025
028 public class ToggleValueTag extends TagSupport {
029
030 public static void doTag(String id, PageContext pageContext)
031 throws Exception {
032
033 HttpServletRequest request =
034 (HttpServletRequest)pageContext.getRequest();
035
036 String value = SessionClicks.get(request, id, StringPool.BLANK);
037
038 if (value.equals(StringPool.BLANK)) {
039 value = "block";
040 }
041
042 pageContext.getOut().print(value);
043 }
044
045
048 public static void doTag(
049 String id, PageContext pageContext, HttpServletRequest request)
050 throws Exception {
051
052 doTag(id, pageContext);
053 }
054
055 public int doEndTag() throws JspException {
056 try {
057 doTag(_id, pageContext);
058
059 return EVAL_PAGE;
060 }
061 catch (Exception e) {
062 throw new JspException(e);
063 }
064 }
065
066 public void setId(String id) {
067 _id = id;
068 }
069
070 private String _id;
071
072 }