943,982 Members | Top Members by Rank

Ad:
Jul 8th, 2005
0

Passing paramter from javascript to jsp

Expand Post »
Hi ,

I have a function as :
function doCheck(str1,str2)
{
top.LocalCacheLoadStatus = false;
parent.SearchFrame.location.href=str1;
g_str_Mode = str2;
alert (g_str_Mode);
}

This has str1 as the name of the jsp file and str2 is the value which i have to pass to the jsp file given in str1.How do i do that ?

Thanks & Regards
Soni
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Soni_7 is offline Offline
3 posts
since Jul 2005
Jul 8th, 2005
0

Re: Passing paramter from javascript to jsp

Try this:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function doCheck(str1,str2) {
  2. top.LocalCacheLoadStatus = false;
  3. parent.SearchFrame.location.href=str1;
  4. g_str_Mode = str2;
  5. alert (g_str_Mode);
  6. var url = str1+".jsp?str2="+str2;
  7. alert(url);
  8. document.location = url;
  9. }

If you need to pass the variable to the jsp page, and you don't need your user to ever see the output from that jsp page--that is, you want the user to stay on the current page without noticing the value was submitted, you can use a hidden iframe--and navigate it instead of your main page. You can also use an AJAX solution, but an iframe does just fine and is easier to make compatible across browsers.
Reputation Points: 36
Solved Threads: 6
Posting Whiz
Troy is offline Offline
354 posts
since Jun 2005
Jul 11th, 2005
0

Re: Passing paramter from javascript to jsp

Hi,
Thanks a lot. I hope it works.Let me try.

Regards,
Soni
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Soni_7 is offline Offline
3 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Dropdown menu
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Javascript generated drop down menu





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC