| Method from org.apache.struts.taglib.html.LinkTag Detail: |
protected String calculateURL() throws JspException {
// Identify the parameters we will add to the completed URL
Map params = TagUtils.getInstance().computeParameters
(pageContext, paramId, paramName, paramProperty, paramScope,
name, property, scope, transaction);
// if "indexed=true", add "index=x" parameter to query string
// * @since Struts 1.1
if( indexed ) {
int indexValue = getIndexValue();
//calculate index, and add as a parameter
if (params == null) {
params = new HashMap(); //create new HashMap if no other params
}
if (indexId != null) {
params.put(indexId, Integer.toString(indexValue));
} else {
params.put("index", Integer.toString(indexValue));
}
}
String url = null;
try {
url = TagUtils.getInstance().computeURLWithCharEncoding(pageContext, forward, href,
page, action, module, params, anchor, false, useLocalEncoding);
} catch (MalformedURLException e) {
TagUtils.getInstance().saveException(pageContext, e);
throw new JspException
(messages.getMessage("rewrite.url", e.toString()));
}
return (url);
}
Return the complete URL to which this hyperlink will direct the user.
Support for indexed property since Struts 1.1 |
public int doAfterBody() throws JspException {
if (bodyContent != null) {
String value = bodyContent.getString().trim();
if (value.length() > 0)
text = value;
}
return (SKIP_BODY);
}
Save the associated label from the body content. |
public int doEndTag() throws JspException {
// Prepare the textual content and ending element of this hyperlink
StringBuffer results = new StringBuffer();
if (text != null) {
results.append(text);
}
results.append("< /a >");
TagUtils.getInstance().write(pageContext, results.toString());
return (EVAL_PAGE);
}
Render the end of the hyperlink. |
public int doStartTag() throws JspException {
// Generate the opening anchor element
StringBuffer results = new StringBuffer("< a");
// Special case for name anchors
prepareAttribute(results, "name", getLinkName());
// * @since Struts 1.1
if (getLinkName() == null || getForward() != null || getHref() != null ||
getPage() != null || getAction() != null) {
prepareAttribute(results, "href", calculateURL());
}
prepareAttribute(results, "target", getTarget());
prepareAttribute(results, "accesskey", getAccesskey());
prepareAttribute(results, "tabindex", getTabindex());
results.append(prepareStyles());
results.append(prepareEventHandlers());
prepareOtherAttributes(results);
results.append(" >");
TagUtils.getInstance().write(pageContext, results.toString());
// Evaluate the body of this tag
this.text = null;
return (EVAL_BODY_TAG);
}
|
public String getAction() {
return (this.action);
}
|
public String getAnchor() {
return (this.anchor);
}
|
public String getForward() {
return (this.forward);
}
|
public String getHref() {
return (this.href);
}
|
public String getIndexId() {
return (this.indexId);
}
|
public String getLinkName() {
return (this.linkName);
}
|
public String getModule() {
return (this.module);
}
|
public String getName() {
return (this.name);
}
|
public String getPage() {
return (this.page);
}
|
public String getParamId() {
return (this.paramId);
}
|
public String getParamName() {
return (this.paramName);
}
|
public String getParamProperty() {
return (this.paramProperty);
}
|
public String getParamScope() {
return (this.paramScope);
}
|
public String getProperty() {
return (this.property);
}
|
public String getScope() {
return (this.scope);
}
|
public String getTarget() {
return (this.target);
}
|
public boolean getTransaction() {
return (this.transaction);
}
|
public boolean isUseLocalEncoding() {
return useLocalEncoding;
}
|
public void release() {
super.release();
anchor = null;
forward = null;
href = null;
linkName = null;
name = null;
page = null;
action = null;
module = null;
paramId = null;
paramName = null;
paramProperty = null;
paramScope = null;
property = null;
scope = null;
target = null;
text = null;
transaction = false;
indexId = null;
useLocalEncoding = false;
}
Release any acquired resources. |
public void setAction(String action) {
this.action = action;
}
|
public void setAnchor(String anchor) {
this.anchor = anchor;
}
|
public void setForward(String forward) {
this.forward = forward;
}
|
public void setHref(String href) {
this.href = href;
}
|
public void setIndexId(String indexId) {
this.indexId = indexId;
}
|
public void setLinkName(String linkName) {
this.linkName = linkName;
}
|
public void setModule(String module) {
this.module = module;
}
|
public void setName(String name) {
this.name = name;
}
|
public void setPage(String page) {
this.page = page;
}
|
public void setParamId(String paramId) {
this.paramId = paramId;
}
|
public void setParamName(String paramName) {
this.paramName = paramName;
}
|
public void setParamProperty(String paramProperty) {
this.paramProperty = paramProperty;
}
|
public void setParamScope(String paramScope) {
this.paramScope = paramScope;
}
|
public void setProperty(String property) {
this.property = property;
}
|
public void setScope(String scope) {
this.scope = scope;
}
|
public void setTarget(String target) {
this.target = target;
}
|
public void setTransaction(boolean transaction) {
this.transaction = transaction;
}
|
public void setUseLocalEncoding(boolean b) {
useLocalEncoding = b;
}
|