Here's a technique that you could use that is very effective and does
not require
any third party software or a new language. It uses JavaScript in the
HTML.
The basic concept is that all of the dynamic data page required is
placed into
JavaScript objects. With the data in objects, you can reference the
information
from JavaScript blocks within the HTML page. It is good to prototype
all the
data in the page and be sure that page operates correctly. Once that it
done
then you can move the data objects into a separate file and reference
the data
with <script src='data.js'></script>. Now with the data in a separate
file, you
can eventually move the data all the way into a servlet which will
create the
data. Just point the script source to the servlet instead of a file.
If you would like to see an example of this in action, go to
http://www.gallaware.com . The 'Not-So-Precise Computer Terms' on that
page uses
this technique. It calls a servlet that returns data in JavaScript.
The actual
servlet is:
http://www.gallaware.com/servlet/com.gallaware.nab.NABServlet
Take a look at the source code for the main page and you will see how
the data is
separated from the HTML.
This servlet is built on the ServletActionBroker framework that allows
you to get
the complete interface for the servlet with:
http://www.gallaware.com/servlet/com.gallaware.nab.NABServlet?get_interface
Tim Gallagher
Justin Wells wrote:
> You can use WebMacro to do this.
>
> http://webmacro.org/
>
> It's possible under JSP too, but under WebMacro there is some architectural
> enforcement of the separation. Otherwise late some tired night you may
> slip some programming code into the HTML template and break the
> separation in a way that won't be obvious until you try and switch
> things around.
>
> You can also use WebMacro to generate the HTML offline if you like.
>
> Justin
>
> Quoting Stephen Kuo ([EMAIL PROTECTED]):
> > Hi forks, does any has idea about any projects that help us
> > separate servlets and html files, or even do not need html templates,
> > but dinamically generate htmls ?
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html