[OmniFaces utilities] The
writeAttribute()
method writes component attribute of the given name, if it's not empty. Both HTML attribute name and component property name defaults to the given component attribute name.Method:
Usage:
Use the below Renderers#writeAttribute() whenever you need to render the attribute of a component (if it's not empty) for which you can provide:
·
the ResponseWriter instance
·
the associated UI component (usually the
parent component)
·
the component attribute name whose value
should be written
·
HTML
attribute name defaults to the given component attribute name
·
component
property name defaults to the given component attribute name
Below you can
see two examples:
import
org.omnifaces.util.Renderers;
...
@Override
public void
encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer =
context.getResponseWriter();
...
Renderers.writeAttribute(writer, this,
"value");
Renderers.writeAttribute(writer, getParent(),
"styleClass");
}
Niciun comentariu :
Trimiteți un comentariu