Click here to Skip to main content
15,797,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Programmers
I have a code where I'm trying to get parameters from one jsp to another can someone help please.

Here is my home.jsp script where i have used AJAX:

C#
var xmlhttp = new getXMLObject();   //xmlhttp holds the ajax object
function ajaxFunction() {
  var getstr = new String();  //Used to prevent caching during ajax call
  if(xmlhttp) {
    xmlhttp.open("GET","Test.jsp?",true, function(results)
            {
                getstr = results;
            });
    xmlhttp.onreadystatechange  = handleServerResponse;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(null);
  }
}
function handleServerResponse() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
       document.myForm.time.value=xmlhttp.responseText; //Update the HTML Form element
     }
     else {
        alert("Error during AJAX call. Please try again");
     }
   }

AND THIS IS MY TEST.JSP PAGE:
XML
<body>
        <input id="ptk" name="ptk" value="I'm COOL"><input/>
        <%
        PrintWriter outt = response.getWriter();
        outt.println(" : DUDE");
        %>
</body>
Posted
Updated 24-May-11 23:48pm
v2

1 solution

I did not find the question here. What is the issue you are facing.

Based on what your question title says, it's looks like you want to pass on the value via GET request to other page. I find you forgot to add the querystrings (with desired value) in the GET request URL.

See if that was your issue and if it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900