• 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

request dispacher URL update

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i made a struts application..when i do POST or GET to my actionservlet and it forwards the view to other page using findForward()..in browser it will still show the URL to which i did POST/GET. i want to update it with my latest view...how can i do that?
For example..
in my login.jsp page i entered my userid and password and hit enter which has a ACTION='/loginaction.do' in the form. after the successfull login of failed login it will show in browser URL as http://localhost:8080/loginaction.do in browser but i want this URL to be updated with my current view which is one the two http://localhost:8080/loginfailed.jsp or http://localhost:8080/loginsuccess.jsp
any suggestion???

i knw it happens because of requestDispacher. its same with the case when someone from servlet does it using requestDispacher. it will still show the address of servlet in place of jsp to which i forwarded...any suggestion for that???
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello "system crash "-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, to solution to it may be the PostRedirectGet pattern. This article goes into the details of this and some related issues; it's well worth a read.
 
ashutosh dhiman
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But how do i use that in struts?? struts has to return using findForward() method in execute method....so where do i use that?? do you want me to put this before return statement??? then what would be the use of <forward > tag inside <action>mapping tag?? that is useless then....how to do this with a actionSErvlet in struts tell me...pplz
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a redirect option in Struts config file, instead of forward

for this you have to use the forward element as

I am sure it will work for you..
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello! i'm also having this kind of problem.

For example, after a user clicks on "save" to update his profile, the next page must be the list of profiles with a message like "succesfully saved" (stored in request as "result").

If i use, redirect="true" in my forward, the request attributes are lost. And the user, has no idea if his update was successful.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic