how to persist values

in jsp when i click button all text boxes gets clearrather all conrols get back to its original state means if check box is checked it becomes unchecked how i can avoid that while page gets post back?thanks
[227 byte] By [NikisinProblema] at [2007-11-27 8:22:06]
# 1

Hi,

Actually, I am not quite understand what your design for your JSP. Howerver, I will try the best to help you.

Example, you have 2 JSP files. We say those as A.jsp and B.jsp.

We have text fields on A.jsp. There is also a submit button on A.jsp. If a user clicks on that button, browser will send a request to B.jsp. In B.jsp, there is a button that has a functionality to back to A.jsp.

For the above, scenario, you can create some hidden fields in B.jsp for each text fields defined in A.jsp. So, when a user clicks on back button on B.jsp, the browser will re-send again the prevous values in A.jsp.

Hope this help. Let me know if I am wrong to understand your problem.

regards,

daniel

java4every1a at 2007-7-12 20:10:43 > top of Java-index,Java Essentials,New To Java...
# 2
Hi I am new to this technologySuppose i have A.jsp in that on form one text field and one submit button when i enter some value in text field and then click on submit button textfield gets cleared how to avoid that?thanksMessage was edited by:
NikisinProblema at 2007-7-12 20:10:43 > top of Java-index,Java Essentials,New To Java...
# 3

You can't.

This (JSP and HTML in general) seems to be yet another topic in which you are struggling along doing things before you really have a clue.

Anyway the answer is to simply set the value in the form when you create it.

For example to make the third item on a list selected we would do this.

<select name="fruits">

<option>Apple

<option>Banana

<option SELECTED>Cherry

<option>Orange

<option>Pineapple

</select>

For buttons it is the same. Set them SELECTED. For text elements set the value. For textareas drop the content between the opening and closing tags.

cotton.ma at 2007-7-12 20:10:43 > top of Java-index,Java Essentials,New To Java...
# 4

But you really should be spending some time on the following issues:

1) Learning Java

2) Learning more about web applications in general

3) Learning to do your own research. You didn't even need Google for this one. You could have gone to post and viewed the source for the page. You would have seen how the subject line for example gets set.

cotton.ma at 2007-7-12 20:10:43 > top of Java-index,Java Essentials,New To Java...
# 5
Hi NikisinProblem,Do you have jsp code that you have written?May I know it so I can help you better.thanks,daniel
java4every1a at 2007-7-12 20:10:43 > top of Java-index,Java Essentials,New To Java...