aspose file tools*
The moose likes Struts and the fly likes using forwarded url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using forwarded url" Watch "using forwarded url" New topic
Author

using forwarded url

Kevin DesLauriers
Ranch Hand

Joined: Nov 28, 2005
Posts: 43
I am fairly new to struts (using 1.2) and was hoping that someone could help me with my question.

I am configuring the struts-config.xml file to forward to a particular page and it does with the path's original url as expected with a forward.

My question is, how do I place the forwarded URL in the address bar instead of the .do resource?
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
Originally posted by Kevin DesLauriers:
.
.
.
I am configuring the struts-config.xml file to forward to a particular page and it does with the path's original url as expected with a forward.
.
.



is the page static or dynamic???


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Kevin DesLauriers
Ranch Hand

Joined: Nov 28, 2005
Posts: 43
Currently the page is static. I am using a link on the page to update a database and then return back to the same page.

The page is jsp/home.jsp and it has a link to update.do that is mapped to a class in the struts config. When it returns success it is supposed to forward back to the same page "home.jsp" (for now).

It words except that when I return to the home.jsp page it shows update.do and I would much rather it show home.jsp in the address bar.

Thanks
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
I simply dont get why you want to change the URL in address-bar ? :roll:
Kevin DesLauriers
Ranch Hand

Joined: Nov 28, 2005
Posts: 43
It is not that I want to change the URL in the address bar; I would just rather it reflect the page it is displaying instead of a fake .do name that is used to send a request to a particular action class.

Ex.

A user is on the /jsp/home.jsp page and has the option of refreshing data in the database by clicking a button or link. When this is done I want the user to be forwarded to the same page /jsp/home.jsp and have the URL in the address bar reflect that they are at /jsp/home.jsp not /stats.do.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

Originally posted by Kevin DesLauriers:
When this is done I want the user to be forwarded to the same page /jsp/home.jsp and have the URL in the address bar reflect that they are at /jsp/home.jsp not /stats.do.
Then in that case you would redirect to that URL instead of forwarding to it. But if you do that, the user can bookmark that URL and go directly to it at some time in the future. This is a feature, not a bug, so if it doesn't make sense for the user to go directly to that URL then you shouldn't expose it to the user in the way you are proposing.
Kevin DesLauriers
Ranch Hand

Joined: Nov 28, 2005
Posts: 43
Much appreciated! I will make the change in my design.
 
wood burning stoves
 
subject: using forwarded url