InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

JSPWeaver removes the first-person penalty from JSP development

Posted by Charles Humble on Feb 05, 2008

Sections
Development,
Enterprise Architecture
Topics
Enterprise Architecture ,
Java ,
Dynamic Languages
Tags
JBoss ,
WebLogic
ZeroTurnaround's JSPWeaver is a real-time interpreter for JSP which aims to remove the first-person penalty encountered when the server creates and compiles the background servlet from the JSP mark-up.

 

Configuring the product is straightforward. You put the jspweaver.jar into your web application's \WEB-INF\lib, and add some basic configuration information to the application's web.xml file to tell it to use the interpreter for *.jsp URLs:

<servlet> 
<servlet-name>weaverServlet</servlet-name>
<servlet-class>com.zeroturnaround.jspweaver.JspInterpretingServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>weaverServlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

 

Once the application server is re-started JSP pages will be interpreted on the fly.

The interpreter currently supports JSP 1.2-2.0. The 1.0 release supports the full JSP standard including common syntax, XML syntax and Java scriplets. It is container agnostic and should work with any JSP compliant container although the currently tested containers are:

  • BEA Weblogic 8.1SPX, 9.X
  • Jakarta Tomcat 4.X, 5.X, 6.X
  • JBoss 4.X
  • Jetty 5.X
  • Oracle Application Server 9.X, 10.X

Support for JSP 2.1 is planned for the next release and Jevgeni Kabanov at ZeroTurnaround told InfoQ he expects it to be available in about a month. He also gave us a few more details on how the product works:

"It pretty much parses the JSP (either XML-style or original syntax, two separate parsers) and creates an in-memory representation of the pages, which can be used to render the actual output. Since the parsing is very quick and there is no translation it is much faster than compilation can ever be. We also use a patched version of BeanShell to interpret the embedded Java scriplets."

A free trial version is available from ZeroTurnaround. A license costs $49/seat.

How well does it deal with scriptlets? by Tim Vernum Posted
Re: How well does it deal with scriptlets? by Jevgeni Kabanov Posted
Re: How well does it deal with scriptlets? by Jevgeni Kabanov Posted
Great Job by Khaled Habiburahman Posted
  1. Back to top

    How well does it deal with scriptlets?

    by Tim Vernum

    Disclaimer: I wrote what is effectively a competing project, but I don't make any money from it, and I don't have a huge amount of attachment to it

    Parsing scriptlets in an interpreter is hard.
    You have conditionals that cross scriptlets, and it's incredibly difficult to support those without converting the whole thing into Java.
    Does JSPWeaver really do it, or does it just do a "good enough" job (which is all slim does too)

    Side note: Strictly speaking, JSPWeaver cannot be a standard compliant JSP implementation (not that it claims to be) as the JSP spec requires that pages be converted into servlets. (Uck!)

  2. Back to top

    Re: How well does it deal with scriptlets?

    by Jevgeni Kabanov

  3. Back to top

    Re: How well does it deal with scriptlets?

    by Jevgeni Kabanov

    Parsing scriptlets in an interpreter is hard.
    You have conditionals that cross scriptlets, and it's incredibly difficult to support those without converting the whole thing into Java.
    Does JSPWeaver really do it, or does it just do a "good enough" job (which is all slim does too)

    Yep, it's hard, and yes we do that.

    Somehow every time I post here formatting ends up messed up :(

  4. Back to top

    Great Job

    by Khaled Habiburahman

    Great job, keep it up.
    I am going to give it a try.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.