com.opensymphony.module.sitemesh.taglib.decorator
public class: PropertyTag [javadoc |
source]
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
com.opensymphony.module.sitemesh.taglib.AbstractTag
com.opensymphony.module.sitemesh.taglib.decorator.PropertyTag
All Implemented Interfaces:
RequestConstants, BodyTag, IterationTag, Serializable
Direct Known Subclasses:
ExtractPropertyTag
Write property of Page to out.
Also see:
- com.opensymphony.module.sitemesh.Page#getProperty(java.lang.String)
- author:
< - a href="joe@truemesh.com">Joe Walnes
- version:
$ - Revision: 1.3 $
| Methods from javax.servlet.jsp.tagext.TagSupport: |
|---|
|
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
| Method from com.opensymphony.module.sitemesh.taglib.decorator.PropertyTag Detail: |
public final int doEndTag() {
try {
HTMLPage htmlPage = (HTMLPage)getPage();
String propertyValue = htmlPage.getProperty(propertyName);
if (propertyValue == null || propertyValue.trim().length() == 0)
propertyValue = defaultValue;
if (propertyValue != null) {
Writer out = getOut();
if (writeEntireProperty) {
out.write(" ");
out.write(propertyName.substring(propertyName.lastIndexOf('.") + 1));
out.write("=\"");
out.write(propertyValue);
out.write("\"");
}
else {
out.write(propertyValue);
}
}
}
catch (Exception e) {
trace(e);
}
return EVAL_PAGE;
}
|
public void setDefault(String defaultValue) {
this.defaultValue = defaultValue;
}
Value to write if no property matching key is found (optional). |
public void setProperty(String propertyName) {
this.propertyName = propertyName;
}
Key of property to write. |
public final void setWriteEntireProperty(String writeEntireProperty) {
if (writeEntireProperty == null || writeEntireProperty.trim().length() == 0)
return;
switch (writeEntireProperty.charAt(0)) {
case '1":
case 't":
case 'T":
case 'y":
case 'Y":
this.writeEntireProperty = true;
break;
default:
this.writeEntireProperty = false;
}
}
When begins with y, t or 1, the full attribute (name + value) is written. |