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

UI Components for JSF
Post Reply
Narayan
Posts: 46
Joined: 23 Mar 2011, 08:35

01 Aug 2011, 12:35

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

User avatar
leventgny
Posts: 238
Joined: 24 May 2011, 16:49
Contact:

01 Aug 2011, 12:47

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

Narayan
Posts: 46
Joined: 23 Mar 2011, 08:35

01 Aug 2011, 13:28

Hi,

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

User avatar
leventgny
Posts: 238
Joined: 24 May 2011, 16:49
Contact:

01 Aug 2011, 14:00

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

Narayan
Posts: 46
Joined: 23 Mar 2011, 08:35

01 Aug 2011, 15:25

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.

User avatar
leventgny
Posts: 238
Joined: 24 May 2011, 16:49
Contact:

01 Aug 2011, 16:28

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";
PrimeFaces Team Member

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests