Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSP vs Velocity what is better?

Tags:

java

jsp

velocity

What is better between JSP and velocity in - Performance - Ease of use - Ease of creating reusable components - Availability of open source 3rd parties - IDE support

like image 281
flybywire Avatar asked Mar 04 '09 10:03

flybywire


People also ask

Is velocity deprecated?

Well, the reason is that the Velocity Engine has been deprecated for a while, and a lot of developers around the world need to find well-fitting alternatives.

What is Apache Velocity used for?

Velocity can be used to generate web pages, SQL, PostScript and other output from templates. It can be used either as a standalone utility for generating source code and reports, or as an integrated component of other systems.

What is velocity .VM file?

Developer file used by Velocity, a Java-based template engine; written using the Velocity Template Language (VTL); contains VTL statements inserted in a normal text document; often used for auto-generating Web source code and class skeletons.

What is velocity macro?

Velocity is a server-side template language used by Confluence to render page content. Velocity allows Java objects to be called alongside standard HTML. If you are are writing a user macro or developing a plugin you may need to modify Velocity content.


1 Answers

@Vartec: I don't think that the "strict separation of view from business logic" is a velocity feature that is not present in jsp. You can do business logic in jsp (more or less) but it's not recommended at all. But I agree in your point regarding the syntax.

Performance

JSP is compiled to Java, so I don't think that velocity is faster. (have not done benchmarks myself)

Ease of use

For designers: velocity For programmers: (IMHO) jsp, because it's closer to code

Ease of creating reusable components

JSP has lots of components Velocity has no components itself (not component oriented)

Availability of open source 3rd parties

I have seen far more projects using JSP or JSP related technologies than velocity. Maybe because velocity is really low level... :-)

IDE support

There are plenty of tools for jsp. Especially the eclipse jboss plugin/tool suite has a good jsp editor.

Plugins for Velocity are mostly not functional or pretty basic (you get lucky if you have syntax highlighting)

Update If you are looking for a templating engine now, I'd suggest to have a look at thymeleaf. It's comparably lightweight to velocity and can be used just to template some text based templates with a few lines of code or used as a full featured templating engine for example within a webapp.

like image 64
Patrick Cornelissen Avatar answered Sep 20 '22 14:09

Patrick Cornelissen