• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to change the URL

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I am using struts in one of my application , everything is going out fine but when i submit the form then it will be redirected to Second page.

after submit
a.jsp -------------->>> b.jsp

Now what i see in URL is http://localhost:8080/testing/abc.do , but the page which is actually opened is a JSP page and i want that it will show by its original name in URL like: http://localhost:8080/testing/b.jsp but not as http://localhost:8080/testing/abc.do.

Please tell me what to do out for this.

Thanks
Regards
Gaurav
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you really want to do this, just specify redirect="true" when you define the forward to b.jsp in the struts-config.xml file.

However, there are some really good reasons for not doing this. The first one is that if you do this, anything you put in the request object will be lost. Anything you want passed on to the JSP will have to be either passed as a parameter in the URL, or put in the session. The second one is... well, here's an example:

Suppose that abc.do retrieves data from the database before displaying b.jsp, and that if you try to display b.jsp without hitting the abc action first, the page will throw exceptions. Then suppose the user bookmarks the page with the url of http://localhost:8080/testing/b.jsp. What's going to happen? You got it... exceptions.
reply
    Bookmark Topic Watch Topic
  • New Topic