-
1. Re: How to redirect to external URL in pages.xml?
christian.bauer Sep 3, 2008 6:48 PM (in response to benmoore)Didn't you ask the same question three weeks ago? I remember answering this at least twice already. Or, you could just look at the schema (I know, difficult to open with a text editor...).
-
2. Re: How to redirect to external URL in pages.xml?
benmoore Sep 3, 2008 7:15 PM (in response to benmoore)My previous question was how to redirect to an external URL from an action in the Seam way (not using FacesContext). The answer to that was to use FacesManager.instance().redirectToExternalURL(url) if using trunk (it's not in the GA releases yet).
This question is slightly different: how to redirect to an external URL from pages.xml, not from an action. And yes, I've looked thoroughly at the XSD.
-
3. Re: How to redirect to external URL in pages.xml?
benmoore Sep 3, 2008 10:48 PM (in response to benmoore)The xsd only shows view-id as possible attributes of <redirect/>. What am I missing?
-
4. Re: How to redirect to external URL in pages.xml?
christian.bauer Sep 3, 2008 11:03 PM (in response to benmoore)pages-2.1.xsd
-
5. Re: How to redirect to external URL in pages.xml?
csaho Sep 4, 2008 7:17 AM (in response to benmoore)Hello!
Try something like this:
<page view-id="/someView.xhtml"> <action execute="#{ facesContext.externalContext.redirect( 'www.jboss.org' ) }" /> </page>
-
6. Re: How to redirect to external URL in pages.xml?
accountclosed Sep 4, 2008 8:42 AM (in response to benmoore)1 of 1 people found this helpfulIt appears that 2.1 of the pages.xsd now contains a url attribute for the redirect element so, in theory, one could say something like this:
<page view-id="/purchaseproduct.xhtml" conversation-required="true" scheme="https"> <restrict>#{purchasesession.started}</restrict> <navigation from-action="#{purchasesession.submitpurchase}"> <redirect url="#{purchasesession.getURL}"/> <!-- Where #{purchasesession.getURL} could be something like: http://www.onlineservice.com/mycompany?id=123&custid=456 --> </navigation> </page>
I say in theory because I've never used this before. :)
-
7. Re: How to redirect to external URL in pages.xml?
benmoore Sep 4, 2008 3:38 PM (in response to benmoore)cool. which version of seam do i need for pages-2.1.xsd to be supported? Will it only work in Seam 2.1? and above?
-
8. Re: How to redirect to external URL in pages.xml?
accountclosed Sep 4, 2008 4:27 PM (in response to benmoore)I'm hedging a guess that it's 2.1 and up since that attribute is not found in the pages.xsd of 2.0.x. You could always put that attribute in there and run it with 2.0.3 and see if it spews exceptions.
-
9. Re: How to redirect to external URL in pages.xml?
didier Sep 4, 2008 5:07 PM (in response to benmoore)Bonjour,
If you write this :
<page view-id="/someView.xhtml"> <action execute="#{facesContext.externalContext.redirect('http://www.jboss.org')}" /> </page>
It works fine.
Thank you, it helps me.
-
10. Re: How to redirect to external URL in pages.xml?
coldgin May 6, 2009 5:14 PM (in response to benmoore)Thanks, Didier. That config example helped me out a lot.
-
11. Re: How to redirect to external URL in pages.xml?
kchintoju Nov 1, 2012 6:36 PM (in response to benmoore)1 of 1 people found this helpfulI know this is an old article but this is on top when looking pages.xml redirect options in google.
<page view-id="/some-view.xhtml">
<action execute="#{bean.action()}" />
<navigation>
<rule if-outcome="true">
<redirect url="#{bean.url}" />
</rule>
<rule if-outcome="false">
<redirect view-id="/error/error.xhtml">
<message>#{bean.message}</message>
</redirect>
</rule>
</navigation>
</page>