I believe I am not taking the actual HttpServletRequest interface into account when I pass the parameter using reflection.
This is what I am doing:
In my servlet, I have the HTTPServletRequest and Response are available.
cl = Class.forName(receivingClassName);
Class[] classArray = { string1.getClass(),
string2.getClass(), request.getClass(), response.getClass() };
Object[] argVals = new Object[] {string1,string2, request , response};
Method method = cl.getMethod("loadRequestData", classArray);
objVal = method.invoke(cl.newInstance(), argVals);
And in my receiving class, the method "loadRequestData" looks like this:
public String loadRequestData(String string1, String string2,HttpServletRequest request, HttpServletResponse response) {
System.out.println("invoked successfully");
}
Looking at this do you think I am doing something wrong?
Thanks in advance for taking time to look at this..