If you are upgrading from an older version of GNU JSP, please note that 90 percent of the code has changed, and that GNU JSP no longer supports the JSP 0.91 syntax. If you are queasy about making this change, you can map files with the .jsp10 extension to org.gjt.jsp.JspServlet and leave your 0.9 mappings intact. This way you can test out the new spec without compromising your legacy jsp files. However, it is recommended that you do not mix and match files for both 0.9 and 1.0 specs if you use session-related features.
GNU JSP supports most features of the JSP 1.0 specification, with the following exceptions:
taglib
directive. Taglib is an optional, unspecified feature of JSP 1.0; GNUJSP plans to implement full tag extension support as illustrated by the JSP 1.1 specification, currently in public release.jsp:plugin
directiveThe testsuite which comes with GNU JSP demonstrates and tests most features of the JSP syntax.
JSP 0.91 and JSP 0.92 are not supported. If you need a version of GNUJSP that supports JSP 0.91, please check the archive section for version 0.9.10 and refer to the documentation that comes with 0.9.10.
GNU JSP supports the precompilation protocol specified
in the JSP 1.1 specification. If a request is received for a JSP page
with the parameter jsp_precompile
set to any non-null value,
GNU JSP will ensure that the page is compiled, but will not process the
request.
A great deal of work has been spent on providing wrapper classes to allow
servlet engines that implement only JSDK 2.0 (Apache JServ is probably the most popular of these) to use the JSP features that
require JSDK 2.1. If you have a JSDK 2.1 compliant server, these wrappers
aren't used. Every effort has been made to make GNU JSP function just as
well under JSDK 2.0 as JSDK 2.1, but there are a few caveats. If you run under JSDK 2.0, you should be aware that although GNU JSP
makes things like jsp:forward
and
jsp:include
possible, it doesn't remove the corresponding
limitation from your servlets that aren't processed by GNU JSP.
Because GNUJSP can be used with such a large number of webservers and servlet engines, it is impossible to provide a detailed installation guide for each. You should consult the documentation that comes with your webserver or servlet engine for details.
Detailed instructions are currently provided for the following engines:
INSTALL.apache
INSTALL.jigsaw
INSTALL.vqserver
lib/gnujsp10.jar
file to the CLASSPATH used by the web server.
Configure the GNUJSP servlet. The servlet alias should be "gnujsp" and the class name should be "org.gjt.jsp.JspServlet" (note that this has changed from version 0.9.x). The init parameter "scratchdir" is required, and should contain the name of the directory created in the previous step.
For a lot of servlet engines this means adding the following lines to a file called "servlets.properties":
servlet.gnujsp.code=org.gjt.jsp.JspServlet
servlet.gnujsp.initArgs=scratchdir=[directory created in step two]
See Initialization Parameters for all options.
Most troubleshooting can be done by investigating the log files generated by your servlet engine or webserver. Because configuration details vary, we cannot provide detailed troubleshooting instructions, but you are welcome to post your problems on the GNU JSP mailing list (see Reporting Bugs).
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.
When you use beans from JSP pages, you can put them in one of two places:
In a deployment or production environment, you'll generally want to
scrutinize the init parameters. Typically you will enable
checkclass
and turn off debug
. You can
probably also gain a little performance by turning off
checkdependencies
if you're certain you don't need it.
The full list of available init parameters is:
false
.
If set to "true", the source files produced by GNUJSP are retained in the
specified scratch directory. Otherwise they are removed once the class is
successfully compiled.
builtin-javac -classpath %classpath%:%scratchdir% -d %scratchdir% -deprecation %source%
If you want to use spaces in the classpath argument put the argument in quotes:
-classpath "%classpath%;%scratchdir%;c:\I like quotes"
.
On Windows systems, the Runtime.exec(String[]) method seems to reparse the parameters, so make sure there are no spaces in the classpath or scratchdir when you are not using the builtin java compiler.
You can use IBM's open source jikes compiler with GNUJSP; remember to add
[JDK_HOME]/jre/lib/rt.jar
to the servlet engine's
classpath.
Using external compilers with the Blackdown JDK 1.2 prereleases for
GNU/Linux requires the use of the -green
option for the JVM.
checkdependencies
; it merely means that if a .class file
already exists for a JSP page, it should be loaded instead of regenerated
on the first request.
true
.
Set this init parameter to "false" to prevent GNUJSP from
checking the file dates of the source JSP file (and the files
included by it) when running the generated class file.
false
.
Set this init parameter to "true" to make GNUJSP generate
some debug output (in the servlet log).
false
.
Set this init parameter to "true" to make GNUJSP generate
extra debug output (in the servlet log). This is useful
for debugging path problems when jsp files are not found
or include files are not found.
In general, GNU JSP behaves exactly the same under a Java 2 virtual
machine (JDK 1.2, for example) as it does when running under JDK 1.1.
However, if you want to use the built-in compiler (javac), you'll want
to add "[JDK_HOME]/lib/tools.jar
" to the classpath setting.
If you think you've found a bug or have a question, comment, or contribution, check the mailing list at http://www.gjt.org/servlets/MailingLists/ListInfo.html/gnujsp.