• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Want to use forward in render response phase

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone
We are having an issue in JSF.We are developing a web application using RAD(Rational Application developer).Application server used is WAS.

The JSF implementation is jsf-ibm.jar

The scenario is as follows:-

On the homepage (The first page of the application) we need to fetch the data from the database. For which we use the prerender attribute of hx:scriptcollector tag. In the onloadPageBegin method of the managed bean we are making a database call.Now in the exception block we want to add a message to the facescontext and forward (cannot do a redirect as want to maintain the faces message and avoid putting the message in the session because we are not forcing the user to keep session) the user to customer_help.jsf page.

How will I be able to do that?

Follwing things were tried by me but didn't seem to find any solution:

1) facesContext.getExternalContext().dispatch("/customerhelp.jsf") - It does not work because by the time it reach the exception block it is already in the reder response phase.

2) It would be possible if somehow we could change the viewroot of the page. Tried using a phaseListener but was not able to still acheieve the desired result.

Can you please give us your views on the same.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are also facing smilar problem.

We tried putting the query on various forums but had no success.

Our Java Center Of Excellence group has said that even they have not been able to find anything proper for this problem.

If you get it please post it urgently.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I'm not sure if i understand exactly, but maybe you could implement a
custom NavigationHandler. There you can change the ViewRoot with
something like (i think)

FacesContext ctx = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = ctx.getViewRoot();
viewRoot.setViewId("/page.jsp");

Then you can forward using the handleNavigation method.

Maybe that helps, im not exactly sure how it would work in your case
but its how i think you can change the viewRoot
 
himesh mishra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That still wont work because the viewroot is picked up before rendering the page right.If I change the view root , It still takes me to the old page
reply
    Bookmark Topic Watch Topic
  • New Topic