001: /*
002: * Copyright (c) 2002-2006 by OpenSymphony
003: * All rights reserved.
004: */
005: package com.opensymphony.webwork.views.jsp;
006:
007: import com.opensymphony.webwork.components.Component;
008: import com.opensymphony.webwork.components.URL;
009: import com.opensymphony.xwork.util.OgnlValueStack;
010:
011: import javax.servlet.http.HttpServletRequest;
012: import javax.servlet.http.HttpServletResponse;
013:
014: /**
015: * @see URL
016: */
017: public class URLTag extends ComponentTagSupport {
018:
019: private static final long serialVersionUID = 1834295238997573058L;
020:
021: protected String includeParams;
022: protected String scheme;
023: protected String value;
024: protected String action;
025: protected String namespace;
026: protected String method;
027: protected String encode;
028: protected String includeContext;
029: protected String portletMode;
030: protected String windowState;
031: protected String portletUrlType;
032: protected String anchor;
033: protected String escapeAmp;
034:
035: public Component getBean(OgnlValueStack stack,
036: HttpServletRequest req, HttpServletResponse res) {
037: return new URL(stack, req, res);
038: }
039:
040: protected void populateParams() {
041: super .populateParams();
042:
043: URL url = (URL) component;
044: url.setIncludeParams(includeParams);
045: url.setScheme(scheme);
046: url.setValue(value);
047: url.setMethod(method);
048: url.setNamespace(namespace);
049: url.setAction(action);
050: url.setPortletMode(portletMode);
051: url.setPortletUrlType(portletUrlType);
052: url.setWindowState(windowState);
053: url.setAnchor(anchor);
054:
055: if (encode != null) {
056: url.setEncode(Boolean.valueOf(encode).booleanValue());
057: }
058: if (includeContext != null) {
059: url.setIncludeContext(Boolean.valueOf(includeContext)
060: .booleanValue());
061: }
062: if (escapeAmp != null) {
063: url.setEscapeAmp(Boolean.valueOf(escapeAmp).booleanValue());
064: }
065: }
066:
067: public void setEncode(String encode) {
068: this .encode = encode;
069: }
070:
071: public void setIncludeContext(String includeContext) {
072: this .includeContext = includeContext;
073: }
074:
075: public void setIncludeParams(String name) {
076: includeParams = name;
077: }
078:
079: public void setAction(String action) {
080: this .action = action;
081: }
082:
083: public void setNamespace(String namespace) {
084: this .namespace = namespace;
085: }
086:
087: public void setMethod(String method) {
088: this .method = method;
089: }
090:
091: public void setScheme(String scheme) {
092: this .scheme = scheme;
093: }
094:
095: public void setValue(String value) {
096: this .value = value;
097: }
098:
099: public void setPortletMode(String portletMode) {
100: this .portletMode = portletMode;
101: }
102:
103: public void setPortletUrlType(String portletUrlType) {
104: this .portletUrlType = portletUrlType;
105: }
106:
107: public void setWindowState(String windowState) {
108: this .windowState = windowState;
109: }
110:
111: public void setAnchor(String anchor) {
112: this .anchor = anchor;
113: }
114:
115: public void setEscapeAmp(String escapeAmp) {
116: this.escapeAmp = escapeAmp;
117: }
118: }
|