0 Replies Latest reply on Apr 18, 2007 4:08 AM by mvlach

    listener action not called

    mvlach

      I have an IncidentViewAction which display detail of entitfy incident. On the page are located some button, some do action and refresh page and some redirect to page to obtain some information. Finally all action ends on the same (detail) page.

      My problem is:
      How to do this correctly - best practise.

      When I create the entity and go to the detail page, click the button all works fine. But another buttons no nothing - only redirect the page.

      I would like how to get error (or any reason of this behaviour) and best practice how do it.

      <h:form>
       <h:commandButton rendered="#{incident.reject}"
       action="#{incidentViewAction.reject(incident.id)}" value="Odmítnout" />
      </h:form>
      


      @Name("incidentViewAction")
      @Restrict("#{identity.loggedIn}")
      public class IncidentViewAction {
       @In
       Session agendaDatabase;
      
       @Out(required=false)
       Incident incident;
      
       @Logger
       Log log;
      
       @In(create = true)
       IncidentService incidentService;
      
       private Long incidentId;
      
       public void loadIncident(Long id) {
       log.info("Loading the incident...: " + id);
       incident = (Incident) agendaDatabase.load(Incident.class, id);
       }
      
       public Long getIncidentId() {
       return incidentId;
       }
      
       /** business logic */
       public String reject(Long incidentId) {
       log.info("Rejecting the incident: " + incidentId);
       this.incidentId = incidentId;
       return IncidentState.IN_REJECTED;
       }
      
      


       <!-- incident view - action execute before show -->
       <page view-id="/actions/incident/view.xhtml">
       <param name="incidentId" value="#{incident.id}" />
       <action
       execute="#{incidentViewAction.loadIncident(incident.id)}" />
      
       <navigation from-action="#{incidentViewAction.reject(incident.id)}">
       <redirect view-id="/actions/incident/reject.xhtml">
       <param name="incidentId"
       value="#{incidentViewAction.incidentId}" />
       </redirect>
       </navigation>
       .......