jQuery Ajax URL函数调用

this is my Jquery Ajax Part:-

$.ajax({
    type: "GET",
    data: 'name=' + dept+"&emp=1",
    async: false,
    url: "master/loginCreateUser.jsp/getEmpName()",    //i m not able call thisgetEmpName Function call in this location
    success: function(data) {                    
        for(var item in data){
          $("#empName").append("<option>" + data[item] + "</option>");
        }                     
    }
 });

and this is my loginCreateUser.jsp page:

<%!
public ArrayList<String> getEmpName() throws Exception { 
   ArrayList<String> emp = new  ArrayList(); %>          
   <% String s1 = request.getParameter("name"); %>
   <%! emp =  new UserRights().showEmp(s1); %> //i am not access this s1 variable on this location,it shows the error can't find symbol"
   <% 
     return emp;
}
%>

How can I call this function from jsp page?

<% String s1 = request.getParameter("name"); %>

Scriptlets go under the body of service method. s1, here, is local to the service method. It cannot be accessed from the declaration part.

<%!
public ArrayList<String> getEmpName() throws Exception { 
   ArrayList<String> emp = new  ArrayList();          
   String s1 = request.getParameter("name"); //Wouldn't work because the implicit request object is available only within the service method or a scriptlet.
   emp =  new UserRights().showEmp(s1);
   return emp;
}
%>

You can modify your getEmpName() to this:

<%!
    public ArrayList<String> getEmpName(String name) throws Exception { 
       ArrayList<String> emp = new  ArrayList();     
       emp =  new UserRights().showEmp(name); //showEmp() must return an ArrayList<String>
       return emp;
    }
%>

And make the method call inside a scriptlet.

<%
   String empName = getEmpName(request.getParameter("name"));

%>