0

I have a simple selectOneMenu

<p:selectOneMenu id="signer" value="#{Bean.signer}"
                 required="true">
    <p:ajax event="change" process="@this" update="@this"/>
    <f:selectItem itemLabel="choose signer" itemValue="#{null}"/>
    <f:selectItems value="#{Bean.signers}" var="signer"
                 itemLabel="#{signer.fullname}" itemValue="#{signer}"/>
</p:selectOneMenu>

In my case the first selectItem displays message but it doesn't have any value #{null}. But I need a label as first item, and set the default value (the first item from list signers) How I can do this two actions together?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
OlyaS
  • 1
  • What do you mean with "message"? I don't understand what you are trying to do. – Jasper de Vries Dec 14 '22 at 16:39
  • I mean the text that displays on bar as first element. itemLabel="choose signer". And also i need ability to set the default value (for example first element from list). – OlyaS Dec 14 '22 at 17:19
  • Simply set `#{Bean.signer}` in your bean. See for example https://stackoverflow.com/questions/14468667/jsf-bean-property-initialization. Also, you seem to be missing a converter. https://stackoverflow.com/questions/4734580/conversion-error-setting-value-for-null-converter-why-do-i-need-a-converter. – Jasper de Vries Dec 15 '22 at 06:14

0 Answers0