I am sending params using jquery.load(loadUrl). My loadUrl is : ${baseUrl}/1.jsp?a=1&b=2
How can i receive these params a and b in 1.jsp?
This question is followup question for Best way to pass parameters to jQuery's .load().
I am sending params using jquery.load(loadUrl). My loadUrl is : ${baseUrl}/1.jsp?a=1&b=2
How can i receive these params a and b in 1.jsp?
This question is followup question for Best way to pass parameters to jQuery's .load().
<%
String a = request.getParameter("a");
String b = request.getParameter("b");
%>
You can also use them directly in EL:
${param.a} ${param.b}
or ${param['a']} ${param['b']}
function GetUrlValue(VarSearch){
var SearchString = window.location.search.substring(1);
var VariableArray = SearchString.split('&');
for(var i = 0; i < VariableArray.length; i++){
var KeyValuePair = VariableArray[i].split('=');
if(KeyValuePair[0] == VarSearch){
return KeyValuePair[1];
}
}
}
These are GET parameter. you can simply use following in JSP Scriptlets
<%= request.getParameter("a") %>
<%= request.getParameter("b") %>
You can also use Use EL (JSP Expression Language):
${param.a}
${param.b}