| | |
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
![]() |
•
•
Join Date: Jul 2005
Posts: 3
Reputation:
Solved Threads: 0
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
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
Try this:
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.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function doCheck(str1,str2) { top.LocalCacheLoadStatus = false; parent.SearchFrame.location.href=str1; g_str_Mode = str2; alert (g_str_Mode); var url = str1+".jsp?str2="+str2; alert(url); document.location = url; }
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.
![]() |
Similar Threads
- Passing variable value from javascript to jsp page at run time (JSP)
- javascript to jsp (JSP)
- javascript variable in jsp session (JSP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Dropdown menu
- Next Thread: Javascript generated drop down menu
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql textarea unicode w3c window windowofwords wysiwyg \n





