• 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 do a jsp:forward on clicking a link/button

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am building a content upload application using JSPs - I seem to get stuck at one point.
The scenario is like this - There is a JSP page, page A that has a form. Here the user enters some data that he wants to upload to a site. On clicking submit, page A does some validations and forwards to page B. Page B has a link, on clicking this, the user can preview the uploaded data. If he does not like what he sees, page B has a Return link. This should take him back to page A with all the data he entered intact. I am using a Bean that has all the form values, and it is in request scope, so I need to be able to forward to Page A on clicking the return link/button.
I tried to explicitly set the bean in the request, but what happens is on clicking the link, it seems to be a new request entirely. I want to somehow use the same request object when I click this link.
I also tried calling a javascript function on clicking the link, and forwarding inside the function, but then the forward seems to get executed the first time itself, so that page B is never displayed.
Using the bean in session scope is not ok, since I do not want the form data to be valid for the entire browser session, only for the request.
My guess is that there is something simple here that I am missing. Can someone please point me in the right direction?
Thanks so much,
Sindhu
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u can always do session.removeAttribute() for the bean u added in the session scope...it wont be there in the session object anymore...
i need to try this yet...but i can't try it as i'm using iPlanet 4.1 web server on which i 'm not able to run jsp:useBean etc tags (i don know why tho...)
let me know if this works for u...
regards
maulin
 
Sindhu Ananth
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I finally did. I was initially reluctant to store in session because then whenever the user clicks on a link to the page, it would display the values. But I guess that is the most painless way, and it works!
Thanks!
Sindhu
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic