| WriteTag.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.util.Validator;
18 import com.liferay.taglib.util.IncludeTag;
19
20 import javax.servlet.http.HttpServletRequest;
21
22 /**
23 * <a href="WriteTag.java.html"><b><i>View Source</i></b></a>
24 *
25 * @author Brian Wing Shun Chan
26 */
27 public class WriteTag extends IncludeTag {
28
29 public void setBean(Object bean) {
30 _bean = bean;
31 }
32
33 public void setProperty(String property) {
34 _property = property;
35 }
36
37 protected void cleanUp() {
38 _bean = null;
39 _property = null;
40 }
41
42 protected String getPage() {
43 if ((_bean == null) || Validator.isNull(_property)) {
44 return null;
45 }
46 else {
47 return _PAGE;
48 }
49 }
50
51 protected void setAttributes(HttpServletRequest request) {
52 request.setAttribute("liferay-ui:write:bean", _bean);
53 request.setAttribute("liferay-ui:write:property", _property);
54 }
55
56 private static final String _PAGE = "/html/taglib/ui/write/page.jsp";
57
58 private Object _bean;
59 private String _property;
60
61 }