When using tags like
form, i.e. standard HTML components of the JSF, the
id attributes of the corresponding
HTML tag are automatically generated according to precise rules.
gives rise to this HTML code ``html <input type="hidden" name="form:field1"/>
Obviously we don’t have to value the
id attribute, the Java Server Faces rendering takes care of automatically generating appropriate and unique ones.
However, when we want to reference a given component by its
#form:field1 with JQuery, escape?).
In cases like this we can declare the
id and at the
form level specify the
prependId="false" attribute. Applied to the code seen above we have
which will result in ``html <input type="hidden" name="field1"/>
It would be tempting to use it all the time, even if it is not necessary for interactions with js or css. The attribute should be used with care, you may get a duplicate
id error if you use it too often. In other words, if not strictly necessary, let JSF take care of these details and generate unique
ids for our tags.