Return to Vincent Partington's
homepage
version
0.9.6
GNUJSP is a free implementation of Sun's Java Server Pages. Once
the GNUJSP servlet is correctly installed, files with the extension
.jsp
are translated into java source files, compiled, and ran. This is an early
release, intended for the adventurous. The JSP specification hasn't been
fixed yet, and GNUJSP documentation is scarce, but you should be able to
experiment with this exciting new technology!
This release includes the possibility to use another java compiler (e.g.
jikes) and compatibility with Servlet API specification 2.1. A number of
administrative changes have also been made: the name has been changed,
the Java package name has been changed, mailing lists have been set up,
a public CVS server is available, the toolkit has been removed from the
distribution and the homepage has moved.
Contents
-
Installation
-
Development
-
More Information
-
Version History
-
Todo
-
License
Installation
GNUJSP has been succesfully used with the following web server/servlet
engine and OS/JDK combinations.
-
Apache 1.2.6, 1.3.1, 1.3.2/Apache
JServ 0.9.11, 1.0b1
-
Apache 1.3.0/LiveSoftware
JRun 2.1.3
-
Apache 1.3.1 for Windows 32/LiveSoftware
JRun 2.2a
-
BEA Weblogic Tengah 3.1.1
-
jo! 0.9.1
-
Microsoft Internet Information
Server 3.0, 4.0/LiveSoftware
JRun 2.1.3, 2.2a (Pro)
-
Microsoft Personal Web
Server 4.0/LiveSoftware JRun
2.1.3
-
Netscape Enterprise Server
2.01/LiveSoftware JRun 2.2a
-
Nexus 0.93
-
Quid Pro Quo 2.1/ServletExec
1.1.2, 2.0b1
-
Sun Java
Web Server 1.1.1, 1.1.2
-
FreeBSD 2.1.5/FreeBSD
JDK 1.1.5 V98-2-25
-
GNU/Linux 2.0.36/Kaffe
OpenVM 1.0b3
-
GNU/Linux 2.0.30, 2.0.34, 2.0.35/Blackdown
JDK 1.1.6v2, 1.1.6v4
-
HP/UX 10.20/Hewlett-Packard JDK 1.1.6
-
MacOS 8.1/ MacOS
Runtime for Java 2.0, 2.1ea2
-
Solaris 2.5, 2.6/Sun
JDK 1.1.6
-
Windows 95, Windows
98/Sun JDK 1.1.5
-
Windows NT
4.0 Sp3/Sun JDK 1.1.5,
1.1.6 w/JIT update, 1.2b4
I would like know about other succesful combinations. Once more servlet
engine/web server/OS platform combinations have been tested (and more time
has been spent on writing the documentation), I want to have nice step-by-step
installation guides here. For now, I will describe the general idea:
-
download the latest version of GNUJSP at http://www.xs4all.nl/~vincentp/download/.
-
unpack the downloaded file.
-
add the GNUJSP jar file (lib/gnujsp.jar) to the classpath used
by the servlet engine.
-
create a directory to store the generated java and class files, that can
be written by the servlet engine.
-
configure the GNUJSP servlet like this:
servlet.jsp.code=org.gjt.jsp.JSPServlet
servlet.jsp.initArgs=classfiles=<dir for generated files>
-
associate the extension .jsp with the newly configured servlet
jsp.
For Apache JServ this means adding the following two
lines to your srm.conf:
AddHandler jsp-handler .jsp
Action jsp-handler /servlet/jsp
Please note that you need JDK1.1 (or higher) to run GNUJSP. JRE will not
suffice, because Sun's java compiler is called directly. Future versions
may change this.
If installation was succesful, a file with the extension .jsp should
be handled by the JSP servlet and ran. Copy the JSP examples in the directory
examples
to your web directory and try loading snoop.jsp.
Init parameters
GNUJSP can be configured with the following init parameters:
-
classfiles or compiler.classpath
-
This required parameter specifies where GNUJSP should write the generated
java and class files. If you want JSP pages to be able to use classes in
the servlets directory (of the servlet engine), point the classfiles
(or compiler.classpath) init parameter to the servlets directory.
-
compiler
-
By default GNUJSP uses the builtin compiler of the JDK (javac) to compile
the generated sources. Set this init parameter to a value like /usr/local/bin/jikes
to use a different compiler.
-
compiler.options
-
This init parameter can be used in conjunction with the compiler
init parameter:
-
* If the compiler.options init parameter contains the parameter
%classpath% then %classpath% will be replaced with the system classpath
+ the value of compiler.classpath.
-
* If the compiler.options init parameter contains %1 then %1 will
be replaced by the name of the file to compile. If it does not contain
%1 then the name of the file will be appended to the end of the options.
-
* If the compiler.options init parameter contains other items
of the form %parameter% then the %parameter% will be replaced with the
value of the init parameter obtained by compiler.parameter. If
this init parameter does not exist then an exception will be thrown.
-
If you use jikes as your compiler, setting this to "-classpath %classpath%
+E +V" will allow GNUJSP to correctly translate the error messages.
-
checkuri
-
By default jsp pages can be called either as /secure/file.jsp
or as /servlet/jsp/secure/file.jsp. This is a security hole when
when authentication is required to access the directory /secure,
but not for /servlet. If the optional checkuri init parameter
is set to true, GNUJSP will not accept request that contain the strings
"/servlet/" or "/jsp/".
-
extension
-
By default GNUJSP refuses to handle files whose extension is not .jsp.
This required extension can be changed by setting the optional extension
init parameter to a different value.
-
pagebase
-
When determining the JSP file to compile, GNUJSP calls ServletContext.getRealPath(request.getServletPath()).
If that fails to return a valid filename, GNUJSP tries request.getPathTranslated()
instead. The optional pagebase init parameter can be set to prefix
the result of getPathTranslated() with a constant string. This can be useful
when the servlet engine runs on a different server than the webserver.
Development
GNUJSP conforms to JSP draft specification 0.91 (available at
http://www.xs4all.nl/~vincentp/gnujsp/jspspec091.tar.gz).
This draft is nearly identical to the JSP implementation in the JavaServer
Pages preview pack, apart from the class and
serializedfile
attributes to the <BEAN> tag; GNUJSP follows the draft specification
and calls these attributes
type and beanName. The additions
to the Servlet API (HttpServletRequest.setAttribute() and
HttpServletResponse.callPage())
are not implemented by GNUJSP.
Additions
Awaiting the definitive JSP specification, GNUJSP adds a feature that is
very useful to the JSP developer; file inclusion. Both the SSI and the
JRun syntaxes are supported:
-
<!--#INCLUDE FILE="file" --> and <%@ include="file"
%>: These tags include the contents of the specified file at the current
location in the JSP file. The filename is interpreted relative to the JSP
file containing the directive.
-
<!--#INCLUDE VIRTUAL="uri" --> and <%@ vinclude="uri"
%>: These tags include the contents of the specified file at the current
location in the JSP file. The uri is interpreted relative to the JSP file
containing the directive.
Reloading and dependency checking
GNUJSP automatically detects changes to a JSP file (and the JSP files it
includes), and recompiles the JSP file if necessary. When a change (or
a new file) is detected, the JSP file is translated to a Java file, and
javac is run. If javac reports any errors, GNUJSP does its best to translate
the Java line numbers to JSP line numbers and reports the errors in the
browser window.
More Information
If you want to know more about GNUJSP, one of the following options may
help you:
-
Frequently Asked Questions
-
I've set up a list of the most frequently asked questions at http://www.xs4all.nl/~vincentp/gnujsp/faq.html.
I will update this list separately from the GNUJSP releases.
-
Mailing Lists
-
Tim Endres of the Giant Java Tree has kindly set up two mailing lists:
-
gnujsp-ann: a low volume list used for announcements related to
GNUJSP. For subscription info and archives, please visit http://www.gjt.org/servlets/MailingLists/ListInfo.html/gnujsp-ann
-
gnujsp: a general mailing list about anything related to GNUJSP.
For subscription info and archives, please visit
-
http://www.gjt.org/servlets/MailingLists/ListInfo.html/gnujsp
-
Public CVS Server
-
If you want to see the latest version of the GNUJSP code, you can have
a look at the Giant Java Tree's public CVS server at
-
http://www.gjt.org/cgi-bin/cvswebgjt/cvswebgjt.cgi/java/org/gjt/jsp.
If you want to participate in the GNUJSP project, the easiest way is to
join the Giant Java Tree and use CVS.
-
Feedback
-
I'm very interested to hear what people think about GNUJSP and I'd like
to hear about any problems you may be having with it, or suggestions you
might have. Please email me at
vincentp@xs4all.nl
and check my homepage (http://www.xs4all.nl/~vincentp/)
for the latest version.
Version history
Version 0.9.6 (17 Dec 1998):
-
updated error mapping code to handle errors generated by jikes +E.
-
added possibility to use other compiler instead of javac (thanks to Tim
Delaney).
-
servlet API 2.1 compatibility (thanks to Hendrik Schreiber and Peter Rossbach).
-
added "-d" to the call to the compiler.
-
the package name has been changed from nl.nmg.jsp to org.gjt.jsp.
Your configuration will have to be updated.
-
changed name from GnuJSP to GNUJSP to reflect the fact that GNU is an acronym
(thanks to Richard Stallman for pointing this out and to Erwin Bolwidt
for updating the logo).
-
integrated GNUJSP into the Giant Java Tree.
Mailing lists, a CVS server and a friendly community spirit are being suppored
by Tim Endres.
-
removed the GNUJSP toolkit from the GNUJSP distribution. Most of it (and
some new stuff) will reappear as "libvinny" soon.
-
moved GNUJSP homepage to http://www.xs4all.nl/~vincentp/gnujsp/.
-
a FAQ page has been set up.
Version 0.9.5 (11 Oct 1998):
-
the directory containing the generated java files is now passed in the
classpath to javac (thanks to Tim Delaney).
-
added "_jsp." prefix to generated package name, preventing collision with
existing package names.
-
added "_" prefix to each component of the generated package name to prevent
generation of illegal package names (thanks to Jörn Heid).
-
fixed a few (documentation) bugs in HTMLWriter.
-
added credits (sorry I forgot last time).
Version 0.9.4 (23 Sep 1998):
-
major part of GNUJSP toolkit released.
-
fixed bug with backslashes in HTML code (thanks to Martijn van Berkum).
-
compiler errors are now HTML encoded.
Version 0.9.3 (15 Sep 1998):
-
fixed bug that prevented POST forms from working (the variable "BufferedReader
in" has been removed).
Version 0.9.2 (12 Sep 1998):
-
JRun compatibility (thanks to Hendrik Schreiber and Jörn Heid).
-
added -classpath argument to the javac command line (thanks to Hendrik
Schreiber).
-
test for ".jsp" extension.
-
MailBean takes multiple To-recipients and Bcc-recipients.
Version 0.9.1 (5 Sep 1998):
-
java line number to jsp line number mapping for javac error messages.
-
<BEAN> support (including introspection and <PARAM> tags).
-
JSP example pages.
-
developed a bean that can send email messages (MailBean).
-
vinclude directive.
-
SSI style includes.
-
a nice logo (thanks to Erwin Bolwidt).
-
optional checking of request URI for /servlet/ and /jsp/.
-
changed some parser details. Shouldn't affect well-formed pages.
-
backslashes in filenames are encoded (thanks to Jörn Heid).
-
lots of other small things.
Version 0.9.0 (27 Aug 1998):
Todo
-
implement JSP specification 1.0.
-
implement generic language and compiler framework.
-
implement page caching.
-
use JavaCC of Antrl to generate the parser.
License
This software is distributed under the terms of the
GNU
Public License. Please see the file COPYING included with
the distribution for details.
Copyright (C) 1998, Vincent Partington <vincentp@xs4all.nl>,
Last Updated: 17 Dec 1998.