Methods Summary |
---|
public int | doEndTag()Render the end of the hyperlink.
// Print the ending element to our output writer
JspWriter writer = pageContext.getOut();
try {
writer.print("</a>");
} catch (IOException e) {
throw new JspException
(messages.getMessage("link.io", e.toString()));
}
return (EVAL_PAGE);
|
public int | doStartTag()Render the beginning of the hyperlink.
// Generate the URL to be encoded
ModuleConfig config = (ModuleConfig) pageContext.getRequest()
.getAttribute(org.apache.struts.Globals.MODULE_KEY);
HttpServletRequest request =
(HttpServletRequest) pageContext.getRequest();
StringBuffer url = new StringBuffer(request.getContextPath());
url.append(config.getPrefix());
url.append(page);
Subscription subscription = null;
try {
subscription = (Subscription) pageContext.findAttribute(name);
} catch (ClassCastException e) {
subscription = null;
}
if (subscription == null)
throw new JspException
(messages.getMessage("linkSubscription.noSubscription", name));
if (page.indexOf("?") < 0)
url.append("?");
else
url.append("&");
url.append("username=");
url.append(TagUtils.getInstance().filter(subscription.getUser().getUsername()));
url.append("&host=");
url.append(TagUtils.getInstance().filter(subscription.getHost()));
// Generate the hyperlink start element
HttpServletResponse response =
(HttpServletResponse) pageContext.getResponse();
StringBuffer results = new StringBuffer("<a href=\"");
results.append(response.encodeURL(url.toString()));
results.append("\">");
// Print this element to our output writer
JspWriter writer = pageContext.getOut();
try {
writer.print(results.toString());
} catch (IOException e) {
throw new JspException
(messages.getMessage("linkSubscription.io", e.toString()));
}
// Evaluate the body of this tag
return (EVAL_BODY_INCLUDE);
|
public java.lang.String | getName()Return the attribute name.
return (this.name);
|
public java.lang.String | getPage()Return the context-relative URI.
// ------------------------------------------------------------- Properties
return (this.page);
|
public void | release()Release any acquired resources.
super.release();
this.page = null;
this.name = "subscription";
|
public void | setName(java.lang.String name)Set the attribute name.
this.name = name;
|
public void | setPage(java.lang.String page)Set the context-relative URI.
this.page = page;
|