Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

store jsp value of one page in another

Posted on 2011-02-16
1
785 Views
Last Modified: 2012-06-21


I had a jsp page and index.jsp


<form method="post">

<select name ="getselected" id="getselected">
<option>fox</option>
<option>fox2</option>
<option>fox3</option>
</selected>

<input type="hidden" name="hidden" value="<%=getselected%>">

</form>


 
which had a drop down list...
I get that value in server...
and set it to request

String selected_value = request.getParameter("getselected");
request.setAttribute("selected_value", selected_value );



now in index2.jsp

I imported this class and

used

Selected is <%=request.getAttribute("selected_value") %>


I got the value, i mean i got the output something like
selected is fox

but once i reload the page

I get output like

selected is null

how to store the value and when value is changed in index.jsp how to
reflect it in index2.jsp automatically...

0
Comment
Question by:shragi
1 Comment
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 34910789
>but once i reload the page  
When you reload the page, you are making a new request.
If you want the value to persist, then you could use a session-scoped object.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question