Hello Rob,
bookstore sample should be still fine for what you want, we are updating
that with each release, latest one can be found at maven central, see
http://search.maven.org/#artifactdetails|com.sun.jersey.samples|bookstore|1.12|war
// download bookstore-1.12-project.zip
<
http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/bookstore/1.12/bookstore-1.12-project.zip>
or bookstore-1.12-gf-project.zip
<
http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/bookstore/1.12/bookstore-1.12-gf-project.zip>
(gf-project doesn't include jersey dependencies in generated war so you
will use Jersey version from Glassfish - you should use this one. But if
you want to try it on Tomcat, you'll need to use "regular" one).
We don't support html5boilerplate templating engine yet, but you should
be able to add it by yourself, see jersey-freemarker module and
freemarker sample for more details (it adds support for freemarker, but
you can similarly implement support for any templating engine).
Regards,
Pavel
On 3/1/12 12:56 AM, Rob Koberg wrote:
> 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
>