1.加入jersey的jar包,包括api,ex,lib
2.在web.xml中增加配置:
<filter>
<filter-name> Jersey Web Application</filter-name >
<filter-class> org.glassfish.jersey.servlet.ServletContainer</filter-class >
<init-param>
<param-name> jersey.config.server.provider.packages</param-name >
<param-value> webservices</param-value >
</init-param>
</filter >
<filter-mapping >
<filter-name >Jersey Web Application </filter-name>
<url-pattern >/rest/* </url-pattern>
</filter-mapping >
3.新建java文件: