Jersey RESTful Web服务
<servlet>
<servlet-name>JerseyServlet</servlet-name>
<servlet-class>
com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<!--服务类所在的文件夹 -->
<param-value>com.mirrors.action</param-value><!-- 之所以我定义为com.mirrors.action就是说明此包中类的作用类似于struts中action层类的作用--!>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JerseyServlet</servlet-name>
<url-pattern>/new/*</url-pattern><!--项目服务总体前缀 -->
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
@Path("/student")//处理student对象的签注
public class StudentAction
{
private StudentDao studentdao;
public void setStudentdaoStudentDao studentdao)
{
this.studentdao =studentdao;
}
@GET//获取方式
@Path("getStudentInfo")//最后前缀
public List<Student> getTrade()
return studentdao.getStudent();
}