Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

how to handle session scope and request scope???

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

I am developing a report module. based on the values entered by the user i have to generate a report.

once the result is displayed from there user can navigate to other pages (there is no user input here) using hiperlinks.

my problem is since i am using session scope for my backing bean. when i go back to the search page again to give some new condition, but the values given by user are still there.

so i wrote a javascript to clear the values(i know this is not correct). After executing the search condition when i click back button on the browser the values entered by the user are also cleared, since i am clearing the values using javascript and i am calling the function on body onload.

when i set my session scope to request scope then my navigation is not working.


i dont know what to do???

i need navigation as well as when the user click the back button he has to see the values entered by him in the text box.

so how to do this???

thanks in advance
Gopal
 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can clear the variables inside all the action methods with navigation rules leading to the page, but not do so with actions leading out of the page. That way when they go back the values are still there, but when they click on a link that leads to the search page the search values are cleared in the action method of the commandLink
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gerardo,

Thanks for the reply. But i didn't understand, how to clear the form values when you click the commandlink.

because when you click link it calls the search page.

because i have 2 beans one for commandlinks and another for searchform.

so how will you clear the values of searchform in commandlink bean action method . how will you access those variables in commandlink bean method???

please clarify me.
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gerardo,

I got it. thanks.

what i did was i defined a clearAllValues() method in every backing bean.

Then in Search Menus command link i am calling these method first.
and set the navigation to the userinput page. so when it loads clear all the values and then it loads that search page.

thanks for your help...because of your idea i got this solution.

 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic