我想從javascript調用serlvet。下面的代碼:如何從javascript函數調用servlet doPost方法?
document.location.href="service1servlet";
它完美地代表打電話給servlet但有錯誤爲:
HTTP Status 405 - HTTP method GET is not supported by this URL
我猜它希望在servlet的doGet方法。如何讓它在該servlet中調用doPost方法? Servlet doPost方法如下:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("THIS IS IN SERVICE!SERVLET AND CAN CHANGE DATABASE");
}