I have <p:hotkey>
which is the component of Primefaces to work with shortcuts. Every time I press ctrl + 1 two new fields appear on the page, however I would like every time I press this combination the data that is in imputText
Codigo
% are added to a list.
For example, I press ctrl + 1 two new fields appear and the values of the first fields are added to a list. I'm trying this way:
Fields:
<p:outputLabel value="Código Serviço" />
<p:inputText id="codigoServico" size="40" value="#{cadastroReembolsoBean.servico.codServico}"/>
<p:outputLabel value="Descrição" />
<p:inputText id="descricaoServico" size="46" value="#{cadastroReembolsoBean.servico.descricao}"/>
Hotkey:
<p:hotkey bind="ctrl+1" handler="desenvolvimento()"></p:hotkey>
<p:remoteCommand name="desenvolvimento"
action="#{cadastroReembolsoBean.adicionarCodigos()}" immediate="true"
update="pnlCadastroServico"></p:remoteCommand>
Method Descrição
:
public void adicionarCodigos() {
if (contador < 0) {
contador = 0;
}
solicitacao.getListaServicos().add(servico);
System.out.println("Serviço Adicionado: "+solicitacao.getListaServicos());
contador++;
}
Note that I have a adicionarCodigos
that shows System.out.println
, but it is coming null. That is, it is not taking the values of listaServicos
. How do I get these values when entering the shortcut?