This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes problem in displaying correct url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "problem in displaying correct url" Watch "problem in displaying correct url" New topic
Author

problem in displaying correct url

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi All,

i am developing a web application using RichFaces and trinidad in JSF. I am facing a strange issue. After successful login when user moves to any of the page in address bar of browser , correct url is not getting displayed.
But if user refreshes the page then correct url appears..

Any pointer how to correct it.


Regards,
Gaurav
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

This isn't due to RichFaces, Trinidad, or even whatever security system you may have cobbled in. JSF URLs are more like web conversation "handles" than absolute resource locators. This is simply how JSF works.


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

Joined: Apr 08, 2008
Posts: 108
Hi,

Thanks for your reply.. Do you mean to say this problem will remain as is??
Or any thning can be done in this regard to correct it??
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

The architects of JSF don't really consider that a "problem". There are some things planned for JSF 2.0 to allow for bookmarkable URLs and stuff like that, but I doubt that they're going to completely eliminate the issue.

You can use PrettyFaces to make URLs bookmarkable.
Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Thanks
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Or you can code your own phaselistener and convert post to get by copying all paramaters and redirecting it in turn.

Thanks,
Rahul


Rahul Juneja
ThoughtClicks - http://techlabs.thoughtclicks.com
Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi Rahul,

Thanks for your reply. I implemented my own phaseListener still problem is persisting
Mahendra Pratap
Ranch Hand

Joined: Feb 25, 2008
Posts: 42

Hi Kumar,

I think if you usebefore the closing navigation-case tag in your faces-config.xml then the displayed url will be correct.


Mahendra
http://randomtechieblog.blogspot.com
Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Thanks mahendra
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Kumar Gaurav wrote:Hi Rahul,

Thanks for your reply. I implemented my own phaseListener still problem is persisting


Gaurav,

Paste your code for phaselistener here and we might be able to assist you better.

Thanks,
Rahul
Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi Rahul,

Find below my Phaselisenter:

package com.infy.iRecon.core;

import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

public class IreconPhaseListener implements PhaseListener{

private static String cphase = null;
@Override
public void afterPhase(PhaseEvent phe) {

System.out.println("After---->"+ phe.getPhaseId());
}

@Override
public void beforePhase(PhaseEvent phe) {

System.out.println("Before---->"+ phe.getPhaseId());
}

@Override
public PhaseId getPhaseId() {

PhaseId phaseId = PhaseId.ANY_PHASE;
if (cphase == null) {

FacesContext context = FacesContext.getCurrentInstance();
if (context == null)

return phaseId;

cphase = (String)context.getExternalContext().getInitParameter("PHASE_PARAM");

if (cphase != null) {

if ("RESTORE_VIEW".equals(cphase)) {

phaseId = phaseId.RESTORE_VIEW;
} else if ("APPLY_REQUEST_VALUES".equals(cphase)) {

phaseId = phaseId.APPLY_REQUEST_VALUES;
} else if ("PROCESS_VALIDATIONS".equals(cphase)) {

phaseId = phaseId.PROCESS_VALIDATIONS;
} else if ("UPDATE_MODEL_VALUES".equals(cphase)) {

phaseId = phaseId.UPDATE_MODEL_VALUES;
} else if ("INVOKE_APPLICATION".equals(cphase)) {

phaseId = phaseId.INVOKE_APPLICATION;
} else if ("RENDER_RESPONSE".equals(cphase)) {

phaseId = phaseId.RENDER_RESPONSE;
} else {

phaseId = phaseId.ANY_PHASE;
}
}
}
return phaseId;
}

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in displaying correct url