BackRefTagpublic class BackRefTag extends javax.servlet.jsp.tagext.TagSupport BackRefTag - generate a href back to the referrer, initially for use on help. |
Fields Summary |
---|
private static final String | DEFAULT_LABEL | private String | surroundingtag | private String | label |
Methods Summary |
---|
public int | doEndTag()Invoked at the end tag boundary, does the work
final String myLabel = label == null ? DEFAULT_LABEL : label;
try {
final HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
final JspWriter out = pageContext.getOut();
final String whereFrom = request.getHeader("referer");
if (whereFrom == null) {
System.out.println("Warning: BackRefTag: no referer");
return SKIP_BODY;
}
if (surroundingtag != null) {
out.println("<" + surroundingtag + ">");
}
out.println("<a href=" + whereFrom + ">" +
(label == null ? DEFAULT_LABEL : label) + "</a>");
if (surroundingtag != null) {
out.println("<" + "/" + surroundingtag + ">");
}
out.flush();
return SKIP_BODY;
} catch (Throwable t) {
System.err.println("Tag caught: " + t);
throw new JspException(t.toString());
}
| public void | setLabel(java.lang.String lab)
label = lab;
| public void | setSurroundingtag(java.lang.String surround)
surroundingtag = surround;
|
|