Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

After JSF Post, Redirection required to Non-JSF (HTML) page

843842Sep 4 2006 — edited Jan 15 2007
Hi,

I am in pressing need for a problem that seems not go away with JSF.
I have a JSF page that collect userName and Pasword info. Now on submit ( commandLink) the action points to a backing bean action method.

<h:commandLink id="logoonLink" action="#{loginController.submitAction}">

When control is received in submitAction() method. I need to redirect the data posted ( userName, passWord) from previous step to an outside link ( say, http://anyWebsiteOutSideMyDomain ).
I tried three different ways to achieve this:

1) RequestDispatcher ( after re-constructing request object by adding attrivutes:

FacesContext context=FacesContext.getCurrentInstance();
ExternalContext externalContext=context.getExternalContext();
HttpServletRequest request=(HttpServletRequest)externalContext.getRequest();
RequestDispatcher rd=request.getRequestDispatcher("http://www.yahoo.com/");
request.setAttribute("username",this.getUsername());
request.setAttribute("password",this.getPassword());


and forwarded it like this:

try{
rd.forward(request,response);

}
catch(Exception e){

System.out.println(e.toString());
//return "failure";
}


It didn't work.

Secondly, I used,

externalContext.redirect("http://outsideOfMyWebDomain:1111/login.form);

This actually helps, but there is no way to transfer userName, password values, except http://outsideOfMyWebDomain:1111/login.form?userName=name;passWord=password

which is against the law of data privacy and a security breach, so this failed as well.

Third one was to use jakarta common API HttpClient, but that didn't do anything at all.

Can somebody please let me know, how can I collect information on a JSF form and then should be able to POST that info from my backing bean to a non-JSF page ? Please don't suggest, why I need this. I am connecing with a legacy system and I have to live with these lmitations.
Urgent help is highly appreciated.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2007
Added on Sep 4 2006
7 comments
230 views