Calling one servlet form another servlet

hi

i am calling one servlet form another servlet but this error is coming

HTTP Status 405 - HTTP method GET is not supported by this URL

could anybody plz help where is the problem as i m new to this technology and eager to learn…
my code is

FromServlet.java

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class FromServlet extends HttpServlet {
public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher RD = getServletContext().getRequestDispatcher("/ToServlet?param=method1");
RD.forward(request, response);
}
}

I]ToServlet.java[/I]

import java.io.;
import javax.servlet.
;
import javax.servlet.http.*;
public class ToServlet extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException {
String param;
param = request.getParameter(“param”);
if (param.compareTo(“method1”)==0) {
try {
method1();
} catch (Exception ex) {}
}
}

public void method1() {
//Do something

}
}

Have you tried using response.sendRedirect() ?

no i have not as i said earlier i m new to this so plz could u plz change my code and i can try it?

The idea is that we help you solve your programming problems. vikrantkorde gave you a great hint, maybe you should try it out before you give up.

If you would like someone to do your work for you, I suggest you drop your programming classes and start working towards your MBA.