Getting passed variable and displaying it on the page??

How do I get a variable being passed (named "myVar") from one page and display it once it is passed to another page? it is a hidden form element.
894359Asked:
Who is Participating?
 
jimmackCommented:
<%
String value = request.getParameter("myVar");
%>

<P>myVar = <%= myVar %>
0
 
kotanCommented:
Enumeration e = request.getParameterNames();
while (e.hasMoreElements())
{
    System.out.println(e.nextElement());
}
0
 
894359Author Commented:
My jsp page chokes on this:
<P>myVar = <%= myVar %>

???????
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
kotanCommented:
<P>myVar = <%= value %>
0
 
applekannaCommented:
extending jimmacks answer

in page 1 set the values as
<input type = "hidden" name = "myVar" value = "sampleData">

in page 2 where you want to get the data

 add the following in ur jsp page
<%
String myVar = request.getParameter("myVar");
%>

to display the data in HTM on the page

use <%=myVar%>

Cheers!
0
 
jimmackCommented:
Oops :-(

Good catch kotan ;-)

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.