Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 19529, Universal JSP turns JSP into a Macro Language

by Vlad Patryshev Email: Anonymous


JSP can become a macro language if Tomcat is running somewhere around and executing a universal JSP that deploys and executes all other JSPs.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For JBuilder, Version 1.0  to 1.0 60 downloads
Copyright: No significant restrictions


Size: 8,018,951 bytes
Updated on Mon, 17 Feb 2003 22:43:48 GMT
Originally uploaded on Wed, 05 Feb 2003 18:41:09 GMT
SHA1 Hash: 66DA311071FCE0109CDBDE9CD5BBD2E958A4E4CA
MD5 Hash: F9858FC9CE4FA8DDD1CCEEFB103F5F8D

    Explore the files in this upload

Description
If you know JSP, you know how convenient they are to generate text data, HTML, XML, or just any text: you have all the power of Java at your hands, just surround your piece code in <% %>, and that will be it.
Unfortunately, there have not been any tool around that would do just that: get a jsp code as an input and output the generated text to stdout. This program, jsp, does that.

Example: jsp -. "Hello <%= request.getParameter("who")%> on <%= new java.util.Date() %>!" -who World -- in this case jsp code is included as an argument, and it gets a parameter named "who".

Another example: jsp --param . --file sampletable.jsp --param data --file sampledata.txt - here the jsp is passed in a file, and a parameter, data, is also retrieved from a file.

The program should be normally used as a pipe, so that its output is redirected somewhere.

Usage:

The program executes a JSP that is either passed via standard input or as an argument. Parameters for the jsp are passed through arguments. There are three forms to pass a parameter:

- , e.g. -classpath c:\java\lib\myjar.jar
--param --value , e.g. --param classpath --value c:\java\lib\myjar.jar
--param --file - in this case the value of the parameter is retrieved from a file.

A special parameter named '.' can be used to pass the jsp itself, as in examples above.

How does it work? The program retrieves a zip file with Tomcat from its internals, unzips it into a working directory, launches Tomcat with a special "Universal JSP". The Universal JSP then does the trick: it interprets any jsp that is passed to it in POST request - of course it executes requests from localhost only.

The archive contains executables for Windows and Linux; you can build a jar all other platforms from the provided source code and the JBuilder project file.

For more information, see http://patryshev.com/dev/runjsp

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03