Witam. Mam taki panel dodawania użytkownika:
<h:body>
<h1>Dodaj administratora</h1>
<f:view>
<h:form>
<h:panelGrid columns="3">
<h:outputLabel for="firstName" value="Imie:"/>
<h:inputText id="firstName" value="#{userMB.user.firstName}" label="firstName" required="true">
<f:validateRegex pattern="[A-Z{1}]+[a-z]+"/>
</h:inputText>
<h:message for="firstName" style="color:red" />
<h:outputLabel for="lastName" value="Nazwisko:"/>
<h:inputText id="lastName" value="#{userMB.user.lastName}" label="lastName" required="true">
<f:validateRegex pattern="[A-Z{1}]+[a-z]+"/>
</h:inputText>
<h:message for="lastName" style="color:red" />
<h:outputLabel for="personalId" value="Pesel:"/>
<h:inputText id="personalId" value="#{userMB.user.personalId}" label="personalId" required="true">
<f:validateRegex pattern="[0-9]{11}"/>
</h:inputText>
<h:message for="personalId" style="color:red" />
<h:outputLabel for="password" value="Haslo:"/>
<h:inputSecret id="password" value="#{userMB.user.password}" label="password" required="true"/>
<h:message for="password" style="color:red" />
</h:panelGrid>
<h:panelGrid columns="2">
<h:commandButton action="#{userMB.createUser()}" value="Dodaj"/>
<h:commandButton action="#{userMB.adminList()}" value="Anuluj" immediate="true"/>
</h:panelGrid>
</h:form>
</f:view>
</h:body>
Mam 4 pola do wypełnienia, ale chcę aby 5 pole odpowiedzialne za typ było automatycznie ustawione na wartość np. admin. Jednak zupełnie nie wiem jak tak domyślnie ustawić wartość:
userMB.user.role
na admin. Najlepiej nie musząc tego prezentować na stronie. Chodzi o to żeby było to od razu w domyśle.