Selectonemenu does not back the description of the object in editing

Asked

Viewed 62 times

0

I’m performing a registration that has a relationship with another, I’m using Selectonemenu to bring it, when performing a new works all correctly, but in editing it is not bringing the object of the other class, and when I finish saving a register and try to edit it brings the object, but just refresh the page that does not bring more, the other text fields, usually back.

public void updateInterface() {

    try {

        Sistema sistema = new Sistema();
        SistemaDao sistemaDao = new SistemaDao();
        sistema = sistemaDao.buscaPorId(idSistema);

        InterfaceDao interfaceDao = new InterfaceDao();
        interfaceSistema.setSistema(sistema);
        interfaceDao.atualizar(interfaceSistema);

        String msg = "Interface " + interfaceSistema.getDescricao() + " Alterada com sucesso";

        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, message);

    } catch (RuntimeException e) {
        throw new RuntimeException("Erro ao atualizar a interface no Bean");
    } finally {
        listarInterface();
    }
}

public void selectingInterface(Actionevent event) {

    interfaceSistema = (Interface) evento.getComponent().getAttributes().get("interfaceSelecionado");
  • <p:selectOneMenu filter="true" value="#{interfaceBean.idSistema}">&#xA; <f:selectItem itemValue="" itemLabel="Selecione um Sistema"/>&#xA; <f:selectItems value="#{interfaceBean.listarSistema()}" var="system" itemValue="#{system.id}" itemLabel="#{system.Description}"/> </p:selectOneMenu>

  • Already tried to popular the Selectonemenu list when editing ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.