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>
| .......
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038252#4038252
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038252
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user