It could be a rapid solution for the problem.
<managed-bean>
<managed-bean-name>yourController</managed-bean-name>
<managed-bean-class>YourController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-outcome>list</from-outcome>
<to-view-id>/List.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>view</from-outcome>
<to-view-id>/View.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>edit</from-outcome>
<to-view-id>/Edit.jsp</to-view-id>
</navigation-case>
</navigation-rule>
public class YourController {
String lastOutcomeName = "list";
public String edit() {
String param =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().\
get("outcomeName");
if(param != null && !param.trim().eaquals("")) {
lastOutcomeName = param;
} else {
lastOutcomeName = "list";
}
return "edit";
}
public String save() {
.....
return lastOutcomeName;
}
public String cancel() {
.....
return lastOutcomeName;
}
}
List.jsp
============
<h:commandLink value="Edit" action="#{yourController.edit}">
<f:param name="outcomeName" value="list"/>
</h:commandLink>
View.jsp
==========
<h:commandLink value="Edit" action="#{yourController.edit}">
<f:param name="outcomeName" value="view"/>
</h:commandLink>