开发者

Servlet mapping in jetty server

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜