1
我寫此代碼爲servlet的的Servlet程序表示HTTP STATUS 404
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Httpservlet1 extends HttpServlet
{
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
String color = request.getParameter("color");
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<B>The selected color is: ");
pw.println(color);
pw.close();
}
}
我已經編譯它和它的相應的HTML文件action屬性值是
action="http://localhost:8765/HS/HTTPSERVLET">
和 web.xml中包含
servlet-name四
servlet-class Httpservlet1
servlet的名稱四至
的url-pattern/HTTPServlet的以XML格式的代碼仍然顯示其上運行它
您的應用程序是否命名爲「HS.war」或放置在/ webapps/HS目錄中? –
它被放置在/ webapps/HS目錄中 – Abhishekkumar