Board index JavaServer Faces General redirecting from a page in one module to a page in another

redirecting from a page in one module to a page in another

Components, Ajax Framework, Utilities and More.


Posts: 46
Hi

we are trying on a functionality of accessing a pageX.xhtml in testX module being in a page pageY.xhtml of testY module.
In pageX.xhtml of testX , on click of command link, it should get redirected to pageY.xhtml of testY module.
In pageX.xhtml, the commandLink is defined as below:
<h:commandLink styleClass="textLink"  actionListener="#{myBean.viewPageY}" value="View pageY">
  <f:param ..../>
</h:commandLink>


in the myBean.viewPageY, after processing the business logic, returning the string as return "toPageY".

For the String "toPageY", defined a navigation rule in faces-config.xml as below:

<navigation-case>
   <from-outcome>toPageY</from-outcome>
   <to-view-id>/testY/pageY.faces</to-view-id>
   <redirect />
</navigation-case>



But the application is getting redirected to a page where the menu s of the application are displayed(the menu page after the login page).

the menu page is configured in faces-config as below:

<navigation-case>
   <from-outcome>home</from-outcome>
   <to-view-id>/menupage.faces</to-view-id>
   <redirect />
</navigation-case>


Any help on this is highly appreciated.

Thanks in advance


Posts: 238

Hi,

Let me ask if your testX and testY modules are different web applications or not ?
If they are different apps, you can use outputLink to do your navigation.
PrimeFaces Team Member


Posts: 46
Hi,

The testX and testY are two different modules belong to a single web application.


Posts: 238

Can you try your navigation with action? JSF implementation does not handle actionListener navigations.
PrimeFaces Team Member


Posts: 46
Hi,

i tried with attribute "action" as well. But still the application is getting redirected to menu page.
And from menu page if we repeat the same navigation, it is redirecting to page in another module, but not on the first go.

Also tried with another approach like,
Instead returning a label in the myBean.viewPageY method, i defined the target url as below:
FacesContext.getCurrentInstance().getExternalContext().redirect("/testY/pageY.jsf");

Here the observation is :
Being in pageX.xhtml, on first click of the link, nothing is happening. Only on the second click of the link it is getting to the pageY in testY module.

Tried with defining the update attribute with the form id of pageY.xhtml.

still the same output, as mentioned above.


Posts: 238

Maybe you are getting some validation errors or try an implicit navigation like;
//on your method : myBean.viewPageY
return "/testY/pageY?faces-redirect=true";
PrimeFaces Team Member


Return to General