Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

refresh browser without losing page data

Posted on 2003-03-03
4
Medium Priority
?
2,596 Views
Last Modified: 2012-05-04
hello all,
I have a page which has to be refreshed according to a
certain action taken by the user.
The problem is once the page is refreshed ,all the data
that was in the form before (text fields,text area etc.)
is now blank and the user has to wrire the whole thing again.
I know the solution is related to the <div> tag and hidden iframe and some JSP,but i can seem to make the connection and solve this problem.


thank you for your kind help
0
Comment
Question by:ronn1212
3 Comments
 
LVL 4

Expert Comment

by:boxy73
ID: 8056657
Refresh the page by using the submit method of your form and using the same page as the action target. When starting the page, in JSP code, use request.getParameter() to collect the values it already had, and insert them in the form. You can send then via post method.

Be careful those values can be null for the first time the page loads.

0
 

Accepted Solution

by:
kaushikgmehta earned 120 total points
ID: 8070983
I think this code should work for u. Check out let me know.

<%
     String strProcess = "";
     String strData = "";

     try {
          strProcess = request.getParameter("Process");
     }
     catch(Exception e) {
          strProcess = "";
     }

     if ((strProcess != null) && (!strProcess.equals("")) && (strProcess.equals("Y"))) {
          strData = request.getParameter("TxtChecker");
     }
%>
<html>
<head>
<title>Test</title>
<script language = "JavaScript">
function goCheck(FrmName) {
     var strData = document.forms[FrmName].elements['TxtChecker'].value;
     if (strData == "") {
          alert("Enter a value in Textbox!");
          return false;
     }
     else {
          document.forms[FrmName].submit();
     }
}
</script>
</head>

<body>
<form name = "FrmCheck" method = "POST" action = "test.jsp">
<input type = "text" name = "TxtChecker" value = "<%=strData%>">
<input type = "hidden" name = "Process" value = "Y">
<br>
<input type = "button" name = "Check" value = "Try" onClick = "javascript:goCheck('FrmCheck');">
</form>
</body>
</html>
0
 
LVL 35

Expert Comment

by:girionis
ID: 10040893
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kaushikgmehta

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Nowadays, technologies make investments easier and it's not even necessary to look for investors in some cases. In this article, we will consider Initial Coin Offering (ICO) investment scheme.
Often, the users face difficulty in accessing Outlook 2016 PST files on Windows 10 computer. One of the reasons behind it is the improper functioning of MS Outlook when the user tries to open it. MS Outlook suddenly stops working, or it will not op…
Integration Management Part 2
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

581 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