我想在netbeans中创建一个servlet。它必须从HTML表单中调用并从中获取一些数据。在netbeans和index.jsp中创建一个servlet
我覆盖了doget和dopost,只是在它们中进行了一些测试。
当我尝试运行servlet时,它只显示一个hello word jsp页面,我发现这是servlet默认具有的index.jsp页面。
我该如何让servlet运行并实际进行一些输出?除了索引欢迎页面?
我使用哪个网址来从表单调用servlet?
日的doGet和doPost方法看起来像这样
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
ResourceBundle rb =
ResourceBundle.getBundle("LocalStrings",request.getLocale());
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
String title = rb.getString("helloworld.title");
out.println("<title>" + title + "this is my anser</title>");
out.println("</head>");
out.println("</html>");
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);}