free web page hit counter
Wednesday Sep 28, 2005

Forward vs Redirect dispatching in a JSF application

Couple of Creator users have reported problems with relative URLs in their JSF web application. To solve these problems it is necessary to understand the JSF Controller Servlet request dispatch mechanism. While navigating to another page, the JSF Controller Servlet can either do a forward or a redirect dispatching. Read more details at

http://winstonprakash.com/articles/jsf/jsf_url_dispatch

Comments:

Very useful, thanks! Do you have any suggestions for <redirect/> causing a problem with apache proxy? The absolute URL path is in the request & page after a redirect; but that URL is an internal domain address which is not recognized in the external domain anymore. Can I tell my app server (JBOSS) Navigator to use relative paths?

Posted by Artemis on October 18, 2005 at 03:13 PM PDT #

hi, i is there anyway to rewrite the url to the new one after doing a foward ? Thanks Sandhya

Posted by sandhyauc on January 05, 2006 at 03:26 AM PST #

Tag should be <redirect/> after the </to-view-id> tag cvj

Posted by Carlos Vaquerizo on February 16, 2006 at 04:59 AM PST #

How does this work within a JSF portlet? Sun Creator seems to tie navigation only to a user clicking on a component. How would I forward to a page within the portlet, programmatically based on a request value?

Posted by Evelyn Reasoner on April 04, 2006 at 11:09 AM PDT #

how we modify default css theme , or can we creat our own theme, pls reply

Posted by Amit shastri on June 21, 2006 at 04:48 AM PDT #

Amit, you can create your own theme by editing the theme.jar or creating a new one and add it as library reference. However, we do not have a visual editor for themes, which we are planning for future release. You can read about structure of a theme file here http://developers.sun.com/prodtech/javatools/jscreator/reference/docs/help/components/theme_structure.html

Posted by Winston Prakash on June 21, 2006 at 07:22 AM PDT #

how about redirecting to an external website, for example google-maps. i do it with this.getFacesContext().getExternalContext().redirect("maps.google.com") with target in a second window. That works, but after that all my other links are pointing the google maps? thanks, michael

Posted by michael on August 28, 2006 at 07:56 AM PDT #

Hi Winston. Thank you for your articles. The ones I read already solved a lot of problems. There's still something I'd like to know about forward/redirect. I have a main application (like a portal) in which I authentify the user, show links to applications he's authorized to use. Is it possible to forward/redirect to another jsf application AND send parameters from the main application to the other application ? I hope i'm not wrong posting this question here. Thank you in advance.

Posted by Steve on September 10, 2006 at 11:13 PM PDT #

Hi I am new to JSF. You might be able to help me with an absolute path problem I encountered in my project. Our team has a JSF project called PHA, it has been deployed to 8 production machines. Recently I made some change to it and want to test it on one of my company's testing machine n251. In order to access n251, I need to use my company's proxy bbweb1. Here is the URL I ran: http://bbweb1.xxxxx.com/bravo/pxhistory/map/n251/charlie/pha/ to access PHA on n251.(BTW, we use http://bbweb1.xxxxx.com/charlie/pha/ to access our production machines.) It seems like I got my main PHA page from N251. But when I clicked any of the menu bars, bbweb1 proxy always ignores the relative path "bravo/pxhistory/map/n251" and simply rediect me to the main page again on one of our production machines. Here is the URL AFTER I clicked the menu bar:"http://bbweb1.xxxxx.com/charlie/pha/faces/jsp-pages/main page.jsp;jsessionid=CC8BD42D458EB5361532FF99FC1F5D83". I studied my code for the last 3 days and didn't find any problem. An only wild guess is: when I view source on my IE, I found JSF always use absolute path : src="/charlie/pha/faces/myFacesExtensionResource/tree2.HtmlTreeRenderer/1161281 90776/javascript/tree.js"></script><script type="text/javascript" I don't know if this indicates why I failed to route to N251. Could this cause by a wrong config on bbweb1? or is there some trick I don't know? ... Since I don't have much experience on JSF, can you please help me with this? Thanks in advance.

Posted by Shi Feng on October 20, 2006 at 01:27 PM PDT #

Very informative. I am having some problem with IE7 redirect or foward. Have you encountered in problem in this case? Thanks, Ron

Posted by 65.195.133.120 on October 27, 2006 at 06:29 PM PDT #

Artemis links within HTML documents on the deployed web application should all be relative, rather than absolute; because I don't think it would work for users using the content via the proxy server... that would cause the request to no longer hit the proxied portion of the server.

Posted by Timotheos on January 02, 2007 at 01:01 PM PST #

Sharad Singh

Posted by Sharad Singh on February 21, 2007 at 01:12 AM PST #

Hello Shi Feng. It is possible to redefine the url generated by JSF components. Have a look at http://javanotepad.blogspot.com/2007/04/problem-sometimes-application-servers.html

Posted by Demon Hills on April 13, 2007 at 12:11 PM PDT #

The redirection runs very well, now I need before to display the page content execute a method, is this possible? and could you help me?

Posted by Eleazar on June 19, 2007 at 08:41 AM PDT #

Hi Winston, I have a JSF application and has to connect to an external url ith some hidden parameters, an the external url is going to send back to the same page with few of the passed in parameters modified. When it sends back, however, the session is lost. What's the best way to handle this.

Posted by Himansu Behera on June 20, 2007 at 11:24 PM PDT #

Hi,
I am trying to solve same problem. Did you solve your? It will be nice to post it here. It looks like Winston is too busy to post his opinion ;-).

Regards Tomas

Posted by Tomas Babic on October 30, 2007 at 08:26 PM PDT #

gf

Posted by 117.192.226.214 on March 13, 2008 at 01:43 AM PDT #

About Redirect to other web address // html code --

http://html-lesson.blogspot.com/2008/06/redirect-to-web-addres.html

Posted by grafik tasarım dersleri on June 24, 2008 at 05:21 AM PDT #

HI i need your help i really want to create my own website/web page but i dont know how to go about doing it so can you please help me out

Posted by Css Lessons on July 05, 2008 at 07:58 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed