aspose file tools*
The moose likes Other Open Source Projects and the fly likes jsp and template framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "jsp and template framework" Watch "jsp and template framework" New topic
Author

jsp and template framework

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Can we mentioned jsp as a template language or its just a technology for controlling the content of Web pages through the use of servlets?

How come a template engine framework such as velocity differ from jsp?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60996
    
  65

Yes, JSP is a template for creating text response, especially HTML.

You can find out information on Velocity here.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Bear Bibeault wrote:Yes, JSP is a template for creating text response, especially HTML.

You can find out information on Velocity here.


Thank you bear for the information. We can say jsp is a template language for template's a html page by replacing text response which is not a 100% define the word template. But velocity far more than it and you can template the html page it self by making separate areas for separate components. I mean more like tiles know.

The second fact is, it says Velocity is twiceas fast as JSP. Is the main reason for that is the jsp translation and compilation process? But jsp claims compilation into a Servlet for speed and efficiency reasons? Really whats the advantage here for bind the jsp in to a servlet container instead of just parse it and run as velocity.

I have read that,
The point being that this whole process of edit->transform->compile->load->run is really unnecessary and in particular, a bad design. On the other hand, Velocity will simply load templates, parse them a single time and then store an Abstract Syntax Tree (AST) representation of the template in memory which can then be re-used over and over again. The process is simply edit->parse->run.

The benefit is that working with Velocity templates ends up being much faster and it also removes the requirement of having a javac compiler and temporary scratch directory hanging around. In Velocity, when the template changes, the existing cached template is simply replaced with a freshly parsed version. The other important thing is that the actual template data can be stored anywhere, including a database or remote URI. By using configurable template loaders, it is possible to create template loaders that can do anything that you want.

Reference:http://geeknizer.com/velocity-vs-jsp-comparison-and-advantages/









Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60996
    
  65

I'll move this to a forum more appropriate for discussing Velocity.

Personally, it is not a system I use -- I find JSP 2 perfectly suitable and don't need a stand-in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp and template framework