cancel
Showing results for 
Search instead for 
Did you mean: 

JSF Navigation, Navigation Rules

damiri
Champ in-the-making
Champ in-the-making
Hi everyone,

i have a simple custom JSF application and one big problem with navigation in Alfresco:

cardform.jsp,


<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core'%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html'%>

<h:form>
      <h:outputText value="#{webclient['card.number']}" />
      <h:inputText value="#{CardFormDialogBean.cardNumber}"></h:inputText>

      <h:commandButton action="#{CardFormDialogBean.save}"/>
</h:form>

one managed Bean:

CardFormDialogBean {

   public String save(){
      return "success";
   }
   public String getCardNumber() {
      return cardNumber;
   }
   public void setCardNumber(String cardNumber) {
      this.cardNumber = cardNumber;
   }
private String cardNumber;
}

and  success.jsp :

<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core'%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html'%>
<h:outputText value="SUCCESS"></h:outputText>


faces-config.xml:

<navigation-rule>
  <from-view-id>/jsp/extension/cardform.jsp</from-view-id>
  <navigation-case>
   <from-outcome>success</from-outcome>
   <to-view-id>/jsp/extension/success.jsp</to-view-id>
  </navigation-case>
</navigation-rule>


if I start my application:

cardform.jsp will be shown
if I click "submit" (   <h:commandButton action="#{CardFormDialogBean.save}"/>),
the bean method will be not executed and success.jsp NOT DISPLAYED


Can somebody help me, what must be changed ?
    faces-config-navigation.xml?
    web-client-config-custom.xml?
   any other conf files?
1 REPLY 1

jayjayecl
Confirmed Champ
Confirmed Champ
what you wrote into faces-config.xml must be written in a file called "faces-config-custom.xml", that file has to be located under WEB-INF


<navigation-rule>
  <from-view-id>/jsp/extension/cardform.jsp</from-view-id>
  <navigation-case>
   <from-outcome>success</from-outcome>
   <to-view-id>/jsp/extension/success.jsp</to-view-id>
  </navigation-case>
</navigation-rule>