Java 从jsp页面运行servlet

Java 从jsp页面运行servlet,java,tomcat,servlets,Java,Tomcat,Servlets,我有index.jsp页面: </head> <body> <form action="HelloWorldServlet" method="post"> <input class="button" type="submit" value="load list" /> </form> </body> </head> 但不是“Hello,World!”消息,而是尝试加载http

我有index.jsp页面:

</head>
<body>
     <form action="HelloWorldServlet" method="post">
        <input class="button" type="submit" value="load list" />
     </form>
</body>
</head>
但不是“Hello,World!”消息,而是尝试加载
http://localhost:8080/HelloWorld/HelloWorldServlet
page。。重点是什么

这是我的web.xml:

<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD 
  Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>
  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>HelloWorldServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>

你好
HelloWorldServlet
你好
/你好

如果您的servlet映射到
/hello
,那么您的
应该发布到相同的URL

<form action="hello" method="post">


您的servlet映射到哪个URL?/Hello请在问题中包含web.xml的内容。我不想再使用其他URL,我只想让我的servlet在当前页面中添加“Hello,world!”我不知道您具体在问什么,因此,这里有一个建议,让我们来看看一些基本的servlet教程:将鼠标放在您自己在问题上放置的
[servlet]
标记上方,直到出现一个黑框,然后单击其中的信息链接:)祝您发展愉快!顺便说一句,请确保您正在阅读最新的教程/资源,Servlet 2.3已经有将近十年的历史了,我们现在是Servlet 3.0。我明白了,但是有没有办法将“Hello,world”添加到当前页面?您的意思是提交表单后,浏览器仍在原始URL上?然后servlet应该映射到与JSP相同的URL,servlet的
doGet()
正好转发到JSP。但是如何映射它呢?如果我在index.jsp上更改/hello,它将不起作用。URL到servlet类的映射是在web.xml中控制的。
<form action="hello" method="post">