File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes after refreshing values should remain same Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "after refreshing values should remain same" Watch "after refreshing values should remain same" New topic
Author

after refreshing values should remain same

deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
when i refresh the previous page i want to fill textfields with values that i am supplied before
so i save those values in hidden fields
now the problem is that after refreshing how can i filled the textfields with hidden fields values
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3011
    
  34

amrita singhal wrote:when i refresh the previous page.

Did you mean refreshing the current page, or clicking the back button ?


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
means i gave same page url in form action
so the same page will be opened again but all fields are empty
Roma Datta
Greenhorn

Joined: Jun 26, 2010
Posts: 3
use bean property to store these values.


SCJP
Open Source is the world!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

Every form element has a value attribute that can be used to set the initial values.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
if we set the initial value then how can we edit it in jsp
not in javascript
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

Using the usual JSP mechanism that you would use to set any other template text.

Do you know anything about JSP? or are you a complete novice?

If the latter, I strongly suggest a tutorial -- one that emphasizes use of JSTL and EL over scriptlets.
ashwin chitransh
Greenhorn

Joined: Jun 27, 2010
Posts: 4
set the values in session and at the start check if that particular field exist in session or not. if it does not let the fields be empty but if the value is there just let the values to be pre populated.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

Depending upon the flow of the requests, the session may be overkill. But we don't know enough to say
deep raj
Ranch Hand

Joined: Dec 11, 2009
Posts: 186
i already know that use of session or hidden variables i can get the textfield value that i have entered
but the problem is to set that retrieve value in text
if i am using
<input type="text" name="df" value="<%=z%>">
then at the first time when i open the page
it will show null in text because there is no value in z variable

so how can i solve this one?
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3011
    
  34

amrita singhal wrote:at the first time when i open the page
it will show null in text because there is no value in z variable.

What do you want to show at the first time? A blank text field, or some text on it?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

Using the EL, null values simply result in the empty string.
ashwin chitransh
Greenhorn

Joined: Jun 27, 2010
Posts: 4
amrita singhal wrote:i already know that use of session or hidden variables i can get the textfield value that i have entered
but the problem is to set that retrieve value in text
if i am using
<input type="text" name="df" value="<%=z%>">
then at the first time when i open the page
it will show null in text because there is no value in z variable

so how can i solve this one?


so when the application is loaded what do you intent to show for the first time. I mean when the page loads for the first time.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: after refreshing values should remain same
 
Similar Threads
maintainig the value of a select box onsubmit of a form
persistent values in jsp
How to nest tags?
jsp include:
JTextfield