[OmniFaces utilities] The
writeAttribute()
method writes given attribute value, if it's not empty, as given HTML 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 HTML attribute name to be written
·
the HTML attribute value to be written
·
component
property name defaults to given HTML attribute name
Below you
two examples:
import
org.omnifaces.util.Renderers;
...
@Override
public void
encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer =
context.getResponseWriter();
...
Renderers.writeAttribute(writer,
"style", "buttons");
Renderers.writeAttribute(writer,
"title", "Click Me!");
}
Niciun comentariu :
Trimiteți un comentariu