rest - Restful web service using @formparam to produce xml file(marshalling) -
i have basic html form text box , submit button interested in creating restful web service wherein exposing method of ejb(from working search based application) retrieve values database.. using value entered in text box clause of sql query in ejb method of application.
i new restful service. want generate xml file on click of submit button suggestions..?
the ide using net beans.
if want retrieve data, simple get request should enough.
html form
<form action="/path/to/the/resource" method="get"> <input type="text" name="query" id="query"/> <input type="submit" value="submit query/> </form> jax-rs resource
@path("/path/to/the/resource") public class myresource { @get @produces("application/xml") public response query(@queryparam("query") string query) { // retrieve values database using query myjaxbannotateddataclass result = ...; return response.ok(result).build(); } } jaxb annotated class
@xmlrootelement public class myjaxbannotateddataclass { // many fields, getters, setters jaxb annotations }
Comments
Post a Comment