The generated JSF HTML element id is changing, how to set it to a fixed element id?

I have a JSF text input component that has a search identifier. In the generated HTML output, this looks like j_idt17:search , but the number 17 changes from time to time. How to make him left alone?

+6
source share
1 answer

Give the JSF component that generated the HTML element with id="j_idt17" fixed identifier. In this particular case, it is likely the element of the parent HTML <form> element that is generated by the JSF <h:form> component.

So this should do:

 <h:form id="form"> 

Thus, the identifier of the generated HTML element <input> becomes form:search .

+11
source

Source: https://habr.com/ru/post/954964/


All Articles