--------------------------------- GNUJSP Frequently Asked Questions --------------------------------- $Id: FAQ,v 1.6 2000/09/29 17:39:28 alph Exp $ 1. Using beans 1.1 Q: I want to use beans, where do I configure my directory? A: Add the directory containing your bean classes to 1. the "-classpath" argument of the compiler definition in gnujsp initArgs in the zone file. This is for the java compiler to find the classes. 2. a repositories line in the zone file. This is for the java servlet runtime to find the classes. 1.2 Q: I started using beans and my example looks like > > >

<%= test.getInt() %> >

<% test.setInt(test.getInt()+1); %> > The example compiles, but at runtime I get a "NoClassDefFoundError". What is wrong? A: Use a package! You should always use a package to put your bean in. Packaging means: 1. Create a directory "mypkg", 2. Put your bean "JspBean.java" in it, 3. Prepend the file with the line "package mypkg;" 4. Change the "class" attribute in the JSP page to "mypkg.JspBean". The example above doesn't work because your bean is using the "default package" (that is, no package at all). In most Java code, the default package means the current directory, but that concept does not apply to a JSP/servlet environment. 2. Error: Encountered unnamed JSP directive. Q: I get the following error on my JSP page after upgrading from GNUJSP 0.9 to GNUJSP 1.x: >Error parsing JSP file /snoop.jsp:/snoop.jsp:4: Encountered unnamed JSP >directive. So what does this mean? A: In short: The JSP syntax has changed from the old 0.92 specification, which is what GNUJSP 0.9.x implemented, and JSP 1.0 and above. In this case: Old Syntax: <%@ import="java.io.File" %> New Syntax: <%@ page import="java.io.File" %> So the tag "page" was missing. 3. Error with sun.tools.javac.Main after updating to JDK 1.2.X Q: After updating to JDK 1.2.X I get an error > Error compiling source file: file:/www/docs/thedir/jsptest/snoop.jsp > > sun.tools.javac.Main What does this mean? A: In JDK 1.2.X the java compiler (sun.tools.javac.Main) is in tools.jar. You need to put {jdk_home}/lib/tools.jar in your classpath when using JDK 1.2.