Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

after refreshing values should remain same

 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 4588
302
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amrita singhal wrote:when i refresh the previous page.

Did you mean refreshing the current page, or clicking the back button ?
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use bean property to store these values.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every form element has a value attribute that can be used to set the initial values.
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if we set the initial value then how can we edit it in jsp
not in javascript
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending upon the flow of the requests, the session may be overkill. But we don't know enough to say
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 4588
302
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the EL, null values simply result in the empty string.
 
ashwin chitransh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic