File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts : URL Problem during Action forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts : URL Problem during Action forward" Watch "Struts : URL Problem during Action forward" New topic

Struts : URL Problem during Action forward

mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120

I am able to get to the correct forward page from my Action Class, but the problem is the URL shown on the browser is the path to the my Action Class in the struts config

i,e http://blah.blah/do/MyActionServlet

I was expecting it to show http://blah.blah/common/tools/AdminScreen.

As I said above even though the page i see is the correct one but the URL is still the do Action. Is there any way to actually show the right URL.
mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
some body should have answer for this.
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Well, the do action IS the right URL.

The browser will display whatever the user last requested. In the case of Struts, this is .do and it's a bit of a paradigm shift for web developers. I don't know what else to tell you.

A good workman is known by his tools.
Lionel Port

Joined: Sep 14, 2002
Posts: 19
The do action is the correct url.

If it really bothers you can set redirect=true in your forward definition in struts-config.xml. This has two problems though, first you have extra communcation with the browser, where the browser gets a redirect and then has to request the the next page, secondly it will stop you storing an information you want to pass on the the forward in the request, instead if there is information you want to keep you will have to store it in the session.
I agree. Here's the link:
subject: Struts : URL Problem during Action forward
It's not a secret anymore!