This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes URL same Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "URL same" Watch "URL same" New topic

URL same

RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi all,

i have 4 links on my page. Each link has its own ActionClass and its own action. Thus correspondingly whenver i click on any link the correspoding action is appended to URl.

I want to keep the URL same for the same page even if I click the varoius options.
http://localhost:8082/bookapp/check/ (for xyz)
http://localhost:8082/bookapp/check/ (for abc)
How can i do that?

Regards,<br />Roshani
Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Please give more insight into the scenario..Can you give some more details/code about the jsp and the struts-config.xml file

- Christian
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
One possibility would be to specify redirect="true" on the forwards for each action. That way the URL would point to the JSP instead of the action, and it would always be the same for the same page. The down side of using redirect="true" is that you can't pass values from the action to the JSP using request attributes. You have to either use session attributes, or pass parameters. If you did this, any time an action forwards to myPage.jsp, your URL would always be:


Consultant, Sima Solutions
Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
Have you looked into URL rewriting?
I agree. Here's the link:
subject: URL same
jQuery in Action, 3rd edition