I have this code snippet ::
First let me tell you couple of things i have observed in this
1) Setting and getting from request needs a page submission otherwise it will not be available in the parameter
2) Scriplet and jsp compiles in different ways, since your scriplet compiliation always happens (no matter where it is header body or footer) first
Now the suggestions for how we can do this
1) Use a EJB object instead of request object
2) Use a hidden input tag to set and get the value needed, assign the getter method to the value of input tag some like ', and when you need to varaible to be changed you need to submit the form, if you do not need to whole page to be reloaded refer ajax methods to change the value alone without reloading the page