[OmniFaces utilities] The
writeAttribute()
method writes component attribute of the given name, if it's not empty, as given HTML attribute name. 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
·
the HTML attribute name to be written
·
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", "src");
Renderers.writeAttribute(writer, getParent(),
"styleClass", "class");
}
Niciun comentariu :
Trimiteți un comentariu