开发者

Servlet mapping in jetty server

开发者 https://www.devze.com 2023-03-03 13:55 出处:网络
I am trying to edit a website: server : Jetty framework : spring index.h开发者_如何学JAVAtml page is in ./web/

I am trying to edit a website:

From this, mapping to webpages in ./web/WEB_INF/template using Servlet. We would like to add one more module in this index.html.. requests help on Servlet mapping.


A servlet is mapped in web.xml:

<servlet>
  <servlet-name>MyServlet</servlet-name>
  <servlet-class>com.myclass.etcetera.MyServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>MyServlet</servlet-name>
  <url-pattern>/MyServlet</url-pattern>
</servlet-mapping>

It is thus accessible through http://localhost:8080/app/MyServlet

If you are using the latest version of the servlet API (3.0), you can map it using the @WebServlet annotation on the servlet itself (and of course, specify there the url-pattern on which the servlet will respond)

0

精彩评论

暂无评论...
验证码 换一张
取 消