users@jersey.java.net

[Jersey] example application(s) using some kind of template system (JSP, StringTemplate, Velocity, etc)

From: Rob Koberg <rob.koberg_at_gmail.com>
Date: Wed, 29 Feb 2012 15:56:38 -0800

Hi, (trying out Jersey after a few years away)

Is there a current sample/example webapp that shows best practices
using Jersey to deliver HTML pages? I sure I am missing something
basic but haven't been able to find anything using the google. *Maybe
I am approaching this wrong.* How do people build real world web
apps/web sites that serve (JSON or) HTML with Jersey? Ideally there
would be some kind of layout.jsp(s) that wrap the specific page
content.

I am using Netbeans and Glassfish because that seems to be the path of
least resistance (I have more experience with Eclipse and Tomcat). I
am not very familiar with Maven, but willing to try.

I haven't been able to find documentation or an example on how to use
JSPs (or any recommended templating system). (I think I can see a way
to use XSL as a template system by forwarding or redirecting an XML
'response' to an XSL Templates object to do a transformation, but
hoping for a less memory intensive way. This might be the way to go?)

I found an old Bookstore example, which is apparently tied to a 3 year
old version. I was hoping for the latest best practices for serving
HTML pages with Jersey doing the routing. Ideally, I would like to be
able to return a JSON response when requested or an HTML full/complex
page (based on HTML5 Boilerplate - http://html5boilerplate.com/)

Here is what happened with the Bookstore example:

* first error was that the web page was launched as
http://localhost:8080/bookstore when it needs
http://localhost:8080/bookstore/ (trailing forward slash).

* next error is when viewing a Book or CD, because it fails to find
the footer.jsp. It should according to:

http://java.net/projects/jersey/lists/users/archive/2009-11/message/415
(Book and CD should inherit footer.jsp from Item, but it doesn't)

I see this error after a Netbeans 'Clean' and then 'Build with
Dependencies' and not sure what to do to fix:

Some problems were encountered while building the effective model for
com.sun.jersey.samples:bookstore:war:1.0
'build.plugins.plugin.version' for
org.glassfish:maven-glassfish-plugin is missing. @ line 83, column 21
'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 74,
column 21
'repositories.repository.layout' for maven-repository.dev.java.net
uses the unsupported value 'legacy', artifact resolution might fail. @
line 117, column 21
'pluginRepositories.pluginRepository.layout' for
maven-repository.dev.java.net uses the unsupported value 'legacy',
artifact resolution might fail. @ line 131, column 21