001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.taglib.util;
016    
017    import com.liferay.portal.kernel.servlet.taglib.TagSupport;
018    
019    import javax.servlet.jsp.JspException;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class PropertyTag extends TagSupport {
025    
026            @Override
027            public int doStartTag() throws JspException {
028                    PropertyAncestorTag propertyAncestorTag =
029                            (PropertyAncestorTag)findAncestorWithClass(
030                                    this, PropertyAncestorTag.class);
031    
032                    if (propertyAncestorTag == null) {
033                            throw new JspException();
034                    }
035    
036                    propertyAncestorTag.addProperty(_name, _value);
037    
038                    return SKIP_BODY;
039            }
040    
041            public void setName(String name) {
042                    _name = name;
043            }
044    
045            public void setValue(String value) {
046                    _value = value;
047            }
048    
049            private String _name;
050            private String _value;
051    
052    }