3

This article on Spring MVC vs Jersey suggests that Jersey is more geared towards Web services rather serving up HTML pages.

I Like the idea of Jersey and don't want to use a proprietary solution as this link Jersey w/ Spring 3.0? suggests spring uses. In the future I will want to create a RESTful web service however for now I need to create a fairly standard webapp what queries a SOAP service and presents the responses in a web page. I don't want to use JSP or JSF just simple javascript hitting a service for updates

Is there a standard way to serve up web pages in Jersey like some sort of templating engine? Should I be looking at an alternative to Jersey such as Spring MVC or something completely different?

Community
  • 1
  • 1
rogermushroom
  • 5,486
  • 4
  • 42
  • 68
  • If your pages are static, then servlet container can manage this content for you (just map e.g. `*.html` to default servlet). If you need real templating in HTML, then [Velocity](http://velocity.apache.org/engine/) under Jersey will work just fine. – dma_k Apr 11 '12 at 19:04
  • @dma_k Write your comment as answer, it's more or less what I was looking for, by the way can you point me to a tutorial or any resources for this. – rogermushroom Apr 11 '12 at 21:23

1 Answers1

1

When you want to work with Jersey than you need no template. It can produce different kinds of output like XML, JSON, PLAINTEXT, etc. It will do all the marshaling/unmarshaling transparently. The important point about REST is how you designe your services. REST with Java (JAX-RS) using Jersey - Tutorial this is really a good tutorial that shows how to work with Jersey. I have no experience with Spring MVC RESTful services but it looks really simular to Jersey.

martin s
  • 1,121
  • 1
  • 12
  • 29
  • So if I was to create a web app where I needed to serve up html is this not really what Jersey is useful for – rogermushroom Apr 10 '12 at 20:44
  • Do you want to access SOAP over javascript? Javascript is not the best language to access SOAP. Or do you want to create a website that only requests your data via a service. Than REST should work well. – martin s Apr 10 '12 at 20:51
  • Nope, I have a SOAP service which provides data, I need to process that data and present it in html format so it can viewed in the browser, SOAP requests will be taken care of by business logic in the app server – rogermushroom Apr 10 '12 at 20:54