Page 1 of 1

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

Posted: 01 Aug 2011, 12:35
by Narayan
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:

Code: Select all

<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:

Code: Select all

<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:

Code: Select all

<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

Re: redirecting from a page in one module to a page in anoth

Posted: 01 Aug 2011, 12:47
by leventgny
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.

Re: redirecting from a page in one module to a page in anoth

Posted: 01 Aug 2011, 13:28
by Narayan
Hi,

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

Re: redirecting from a page in one module to a page in anoth

Posted: 01 Aug 2011, 14:00
by leventgny
Can you try your navigation with action? JSF implementation does not handle actionListener navigations.

Re: redirecting from a page in one module to a page in anoth

Posted: 01 Aug 2011, 15:25
by Narayan
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.

Re: redirecting from a page in one module to a page in anoth

Posted: 01 Aug 2011, 16:28
by leventgny
Maybe you are getting some validation errors or try an implicit navigation like;

Code: Select all

//on your method : myBean.viewPageY
return "/testY/pageY?faces-redirect=true";