aspose 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 Soft Skills this week in the Jobs Discussion 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: 3266
    
  52

amrita singhal wrote:when i refresh the previous page.

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


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
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: 61760
    
  67

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: 61760
    
  67

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: 61760
    
  67

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: 3266
    
  52

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: 61760
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: after refreshing values should remain same