| ErrorMarkerTag.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * The contents of this file are subject to the terms of the Liferay Enterprise
5 * Subscription License ("License"). You may not use this file except in
6 * compliance with the License. You can obtain a copy of the License by
7 * contacting Liferay, Inc. See the License for the specific language governing
8 * permissions and limitations under the License, including but not limited to
9 * distribution rights of the Software.
10 *
11 *
12 *
13 */
14
15 package com.liferay.taglib.ui;
16
17 import com.liferay.portal.kernel.util.Validator;
18
19 import javax.servlet.http.HttpServletRequest;
20 import javax.servlet.jsp.tagext.BodyTagSupport;
21
22 /**
23 * <a href="ErrorMarkerTag.java.html"><b><i>View Source</i></b></a>
24 *
25 * @author Brian Wing Shun Chan
26 */
27 public class ErrorMarkerTag extends BodyTagSupport {
28
29 public int doStartTag() {
30 HttpServletRequest request =
31 (HttpServletRequest)pageContext.getRequest();
32
33 if (Validator.isNotNull(_key) && Validator.isNotNull(_value)) {
34 request.setAttribute("liferay-ui:error-marker:key", _key);
35 request.setAttribute("liferay-ui:error-marker:value", _value);
36 }
37 else {
38 request.removeAttribute("liferay-ui:error-marker:key");
39 request.removeAttribute("liferay-ui:error-marker:value");
40 }
41
42 return SKIP_BODY;
43 }
44
45 public void setKey(String key) {
46 _key = key;
47 }
48
49 public void setValue(String value) {
50 _value = value;
51 }
52
53 private String _key;
54 private String _value;
55
56 }