This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaServer Faces - forwarding (like JSP:FORWARD) but ...

 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I would like to (auto)forward in the first page of my app (without user influence).
But I dont know how to activate an action with this "forward".

If I use <JSP:FORWARD ...> no action is being activated...

Has JSF something there? Or there is another way...

Thanks!
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do this for the weclome-file. I have an index.jsp that has the following code:



So when the user goes to http://whatever/appname the get automatically redirected to my welcome page which is a faces page. Is that what you were looking for?

A little reasoning: JSF and the welcome-file part of web.xml don't work together. MyFaces has a welcome file filter that is supposed to make it work, but I have been unable to get it to work correctly.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Javoso Torso:
Hello!

I would like to (auto)forward in the first page of my app (without user influence).
But I dont know how to activate an action with this "forward".

If I use <JSP:FORWARD ...> no action is being activated...

Has JSF something there? Or there is another way...

Thanks!


I faced this problem too, couldn't look into it but did managed to find a work around.

I created a page, with a button (I hided the button with DHTML). Now "onload" of that page, I "clicked" the button "programmatically", hence the action method of button was called and in the action method, I used NavigationHandler.handleNavigation to direct the request to the page
I wanted.
Thuogh it worked perfectly, I know it's probably ugly
[ December 29, 2004: Message edited by: K Varun ]
 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg: but you are not going through an action to that welcome page (or ...?).
That is the functionality I am looking for.

Varun: is funny, I was also thinking in such a solution. And beside the style problem (as you said, not looking very well), I though the user will see a flicker (because of the page being loaded and immediately submited). Is that happening to you?

Regards,
Javo
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Javoso Torso:

I though the user will see a flicker (because of the page being loaded and immediately submited). Is that happening to you?
Regards,
Javo


We use a "please wait" kind of image, whenever user submits any request.
I put that image in this page too, hence there wasn't any break.

But even if you use jsp:forward, that page will appear momentarily so instead of jsp:forward you can use this approach.

But again, it's dodgy. I have seen examples of jsp:include in sun specs. jsp:forward should also work.
 
Majid Al-Fifi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a better way with JSF1.2 ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic