Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how I can get prefix of jsf for html elements in jsf 2.0

my xhtml form code :

            <h:inputText id="name" value="#{customer.name}" 
                size="20" required="true"
                label="Name" onblur="alert(this.value())" >
            </h:inputText>

Now when I view source it renders to

<input id="j_idt22:name" name="j_idt22:name" onblur="alert(this.value())" size="20"    type="text">

If we check their is a prefix appended to it: j_idt22:,
I want to get this prefix name in my bean form.

how I can achieve that?

like image 241
ManMohan Vyas Avatar asked Feb 02 '26 12:02

ManMohan Vyas


1 Answers

To avoid dynamically generated ids in JSF component you could use

<h:form prependId="false"> 

You can directly get the values binded with your managed bean

If you want to retrieve list of names then you could use request.getParameterMap()

like image 171
jmj Avatar answered Feb 05 '26 01:02

jmj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!