I have this code snippet ::
When you need value of variable temp1
inside gotoa()
do the following:
<% String temp1; // Store value in temp1 variable for later use
PopulateTextbox obj = new PopulateTextbox();
temp1 = obj.method();
%>
First you assign the value to variable temp1. And then you Render your JSP with a Hidden Input component with value=temp1 by using scriptlet. If you want to verify, just View the Source of generated HTML and you should see the value of input hidden equal to the variable.
When the form is submitted the value of hiddenTemp1 will be available in Request. If you intend to change the value of this hidden component, you can set the value back in the component.