Hi Casper,
No you are definitely not wrong :-)
Creating an extra layer may not be necessary. It is possible to write
a JAX-RS/Jersey application that serves machine processable clients,
AJAX for browsers, and browsers directly.
Jersey provides support for the Model View Controller pattern, and
provides support for JSPs using this, but you can plug in your own
template technology if you wish.
See the Bookstore sample:
http://download.java.net/maven/2/com/sun/jersey/samples/bookstore/1.0.3-SNAPSHOT/bookstore-1.0.3-SNAPSHOT-project.zip
and this blog:
http://blogs.sun.com/sandoz/entry/mvcj
Documentation is a bit sparse but i plan to improve this area. And,
this area is a top level goal for me to pursue with Jersey i.e. make
it easier to build Web applications for browsers specifically for the
cases where the work is more evenly distributed between the client and
server, which i think simplifies the server side and empowers the
client side (i.e. JavaScript!)
We have made a number of small improvements, thanks to James's input,
in the area of filtering to support serving static resources and
better support for implicit views. And some other issues kindly logged
by developers such that MVC works correctly with Spring-proxied
objects and can work correctly when returning views in the context of
no resources available etc.
I believe it should be possible to combine a light weight template
technology, or alternative to JSPs, with the likes of a JavaScript API
like jQuery.
Does that help?
Paul.
On Mar 27, 2009, at 1:04 PM, Casper Bang wrote:
> O'Reilly's RESTful Web Services suggests one representation of a
> resource could be for the human web, i.e. serving application/xhtml
> +xml or even text/html for people to use directly. While I realize
> creating webpages (however simple) is not the focus of REST or
> Jersey, I'm trying to combine it since I've fallen in love with its
> simplicity (having had painful encounters with gigantic and complex
> JSF stacks in the past).
>
> One problem with this however is that I'm finding myself either
> writing html/css/javascript inside Java Strings and/or serving JSP.
> I wonder if others have taken this path before and if they have any
> recommendations/experiences to share? I expect one possible answer
> is not to do it, but rather create another layer for the human web
> that simple consumes the resources. However, I can't help feeling
> that there could be space for a simpe human web framework on top of
> Jersey at a provider level. Am I wrong?
>
> Thanks in advance,
> Casper