Good evening.
I have an application in java / jsf I'm having a hard time showing information in XHTML,
Well I have SelectOneMenu
to save an information in the database:
<p:selectOneMenu id="PermissaoAcesso"
value="#{usuarioManageBean.usuario.permissaoAcesso}" required="true"
label="PermissaoAcesso">
<f:selectItem itemLabel="Selecione" itemValue="" />
<f:selectItems value="#{permissaoView.permissoes}" />
<f:validateLength minimum="1" />
<p:ajax event="change" update="displayEquipe1" process="@this" />
<p:ajax event="change" update="displayEquipe2" process="@this" />
</p:selectOneMenu>
It pulls information from a class called PermissaoView
:
@PostConstruct
public void init() {
permissoes = new HashMap<String, String>();
permissoes.put("Supervisor", "1");
permissoes.put("Atendente", "2");
permissoes.put("Pronta Resposta", "3");
}
Because of some business rules, it saves the values 1, 2 and 3 in the bank
Ok, it saves in the database, when I pull the information in a dataTable
it is logical that it will pull the information 1, 2 and 3. here is the line of code that pulls the information in datatable
is this :
<p:column headerText="Permissão de Acesso"
style="text-align: center">
<h:outputText value="#{listausuario.permissaoAcesso}" />
</p:column>
As I said, it shows the information I saved, which in the case are 1, 2 and 3, now my difficulty is in xhtml
change this data to for each value names example value 1 in datatable
Supervisor show, I've seen in some places on the net that I can use Enum
, but I'm not sure how it works. Can anyone give me a light? Thank you.