• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

URL same

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
http://localhost:8082/bookapp/check/abc.do
http://localhost:8082/bookapp/check/xyz.do

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?
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please give more insight into the scenario..Can you give some more details/code about the jsp and the struts-config.xml file
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

http://localhost:8082/bookapp/check/myPage.jsp
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you looked into URL rewriting?
 
Your mother is a hamster and your father smells of tiny ads!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic