File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes JavaServer Faces - forwarding (like JSP:FORWARD) but ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JavaServer Faces - forwarding (like JSP:FORWARD) but ..." Watch "JavaServer Faces - forwarding (like JSP:FORWARD) but ..." New topic
Author

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

Javoso Torso
Ranch Hand

Joined: Aug 15, 2003
Posts: 88
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 hate 'trial and error'<br />and I am doing it all the time
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

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.


GenRocket - A Test Data Generation Platform
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
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 ]

- Varun
Javoso Torso
Ranch Hand

Joined: Aug 15, 2003
Posts: 88
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

Joined: May 30, 2002
Posts: 1400
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

Joined: Aug 22, 2006
Posts: 45
is there a better way with JSF1.2 ?


SCJP1.4, SCWCD1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaServer Faces - forwarding (like JSP:FORWARD) but ...
 
Similar Threads
Difference between <jsp:forward> and RequestDispatcher
Titles and IllegalStateException
How To Redirect to jsp from another jsp
Help with getOutputStream() Exception
Pop up new HTML page in JSP