2
* Copyright 1999-2004 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
18
package org.apache.struts.webapp.example;
21
import javax.faces.component.UIComponent;
22
import javax.faces.context.FacesContext;
23
import javax.faces.el.ValueBinding;
24
import javax.faces.webapp.UIComponentTag;
28
* Generate a URL-encoded hyperlink to the specified URI, with
29
* associated query parameters selecting a specified Subscription.
31
* @author Craig R. McClanahan
32
* @version $Rev: 54934 $ $Date: 2004-10-16 18:07:50 +0100 (Sat, 16 Oct 2004) $
35
public class LinkSubscriptionTag extends UIComponentTag {
38
// -------------------------------------------------------------- Attributes
44
protected String name = "subscription";
46
public void setName(String name) {
52
* The context-relative URI.
54
protected String page = null;
56
public void setPage(String page) {
61
// ---------------------------------------------------------- Public Methods
65
* Return the component type for this tag.</p>
67
public String getComponentType() {
69
return ("javax.faces.Output");
75
* <p>Return the renderer type associated with this tag.</p>
77
public String getRendererType() {
79
return ("org.apache.struts.webapp.example.LinkSubscription");
85
* <p>Release resources allocated to this tag instance.</p>
87
public void release() {
90
this.name = "subscription";
96
// ------------------------------------------------------- Protected Methods
100
* <p>Override attributes set on this tag instance.</p>
102
* @param component Component whose attributes should be overridden
104
protected void setProperties(UIComponent component) {
106
super.setProperties(component);
107
FacesContext context = getFacesContext();
109
if (isValueReference(name)) {
111
context.getApplication().createValueBinding(name);
112
component.setValueBinding("name", vb);
114
component.getAttributes().put("name", name);
118
if (isValueReference(page)) {
120
context.getApplication().createValueBinding(page);
121
component.setValueBinding("page", vb);
123
component.getAttributes().put("page", page);