Something similar is in here, which stores the submitted data in the session instead. But pay attention to the text "this does not mean that you should use scriptlets in your pages. It is done here for illustration purposes only!", because using scriptlets are outdated long before. But you may use it to see how it works.