• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to handle session scope and request scope???  RSS feed

 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • 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
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!