0

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().

Community
  • 1
  • 1
Tarun Kumar
  • 5,150
  • 6
  • 26
  • 30

3 Answers3

0
<%
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']}

Maurice Perry
  • 32,610
  • 9
  • 70
  • 97
0
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];
    }
}
}
0

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}
Manwal
  • 23,450
  • 12
  • 63
  • 93