Passing paramter from javascript to jsp

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jul 2005
Posts: 3
Reputation: Soni_7 is an unknown quantity at this point 
Solved Threads: 0
Soni_7 Soni_7 is offline Offline
Newbie Poster

Passing paramter from javascript to jsp

 
0
  #1
Jul 8th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: Passing paramter from javascript to jsp

 
0
  #2
Jul 8th, 2005
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.
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 3
Reputation: Soni_7 is an unknown quantity at this point 
Solved Threads: 0
Soni_7 Soni_7 is offline Offline
Newbie Poster

Re: Passing paramter from javascript to jsp

 
0
  #3
Jul 11th, 2005
Hi,
Thanks a lot. I hope it works.Let me try.

Regards,
Soni
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC