Two Laptop Bag*
The moose likes JSF and the fly likes jsf equivalent code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf equivalent code" Watch "jsf equivalent code" New topic
Author

jsf equivalent code

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
in JSP i have the code:
RequestResponse rqrp = new RequestResponse(request, null);
String fullURL ="";// rqrp.getFullURL("");


In JSF, how to do i do it? I need to get the full URL of the application on the server.

Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

Why do you want the URL?

JSF URLs are more what I call "conversation handles" than absolute indicators of what page will be displayed. The same page URL that you originally jumped to may still be in use when that page navigates to the next page.

This is one of JSF's major annoyances, since it means you can't bookmark pages, and it's something that JSF 2.0 is supposed to address. In the mean time, I've had very good results using PrettyFaces to make bookmarkable URLs for JSF.


Customer surveys are for companies who didn't pay proper attention to begin with.
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
I need to get the URL, from the url, it will tell my the environment that my apps is in (production or uat).. because in different environment, i need to present different things..

for example my url may look like this:
uat environment: http://servername/appuat/appinstance/
production environment:http://servername/appinstance/

Any alternative i can get the URL?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

OK, for that, an exact page URL isn't necessary, so you should have no problems.

This may help:


Kiran Shirali
Ranch Hand

Joined: Jan 26, 2009
Posts: 34
Hi,

Maybe this will also help. To get the point of execution on server i use the following on my JSF page:




Say i want to navigate to a relative url (a view page of NewPage.xhtml):




So maybe you can use something like:



This would allow you to set somethings only if the path is equivalent to your uat environment.

I hope this helps.

Kiran


SCJP 1.6 86%, SCWCD 5.0 on
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
hi guys,

thanks for your help.. it solve my problem
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jsf equivalent code
 
Similar Threads
Redirect in a JSF page itself dependent on which panelGrid is rendered:
Can I add JSF components through Ajax?
AJAX and Flash
How can i implement security in field level
example of source code for insert a date