Wednesday, September 22, 2010

Opening New Window in JSF

Create a temp jspx page and redirect to the page by calling ur param values.
while redirecting to the temp jspx page, call onload an action which calls ur actually method to get values.

Call the below line from ur actually Jspx page.
oncomplete="window.open('redirect.jspx')" action="actuallyBean.redirectMethod"

In ur actuallyBean, redirectMethod read the parameters using request values

public String redirectMethod()
{
      HttpServletRequest request=(HttpServeltRequest)FacesContext.getCurrentInstance()
.getExternalContext().getRequest();
     session.setAtribute("valueInSession", request.getPerameter("id")) ;
      return "";


keep this value in httpsession, until it redirects to the  redirect.jspx.


now, In redirect.jspx, onload call the action
In action get the values from the httpsession and removeattribute from httpsession.

This redirect of page, opening new window takes less than sec, so There won't be any problem.

No comments :

Post a Comment