Show Topics
Hide Topics

 12. @PathParam annotation Example


In RESTful (JAX-RS) web services @PathParam annotation will be used to bind RESTful URL parameter values with the method arguments


http://localhost:8001/<Rest Service Name>/rest/customers/100/Satya

Here the two parameters appear in the end of the above URL [100 & Satya], which are separated by forward slash (/) are called as path parameters


We will read those URL paramters in our webservice method using

@PathParam("paramname") String variablename


1.Create Dynamic web project in eclipse, convert that into Maven Project



2.Add Jersey jar files manually / through Maven by writing repo details in pom.xml



3.Create RESTFul webservice



4.Configure web.xml



5.Test Webservice directly by using URL / writing webservice client



Download Example Code