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);
User user = null;
try {
user = (User) pageContext.findAttribute(name);
} catch (ClassCastException e) {
user = null;
}
if (user == null)
throw new JspException
(messages.getMessage("linkUser.noUser", name));
if (page.indexOf("?") < 0)
url.append("?");
else
url.append("&");
url.append("username=");
url.append(ResponseUtils.filter(user.getUsername()));
// 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("linkUser.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 hyperlink URI.
// ------------------------------------------------------------- Properties
return (this.page);
|
public void | release()Release any acquired resources.
super.release();
this.page = null;
this.name = "user";
|
public void | setName(java.lang.String name)Set the attribute name.
this.name = name;
|
public void | setPage(java.lang.String page)Set the hyperlink URI.
this.page = page;
|