File: FAQ

package info (click to toggle)
gnujsp 1.0.0-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 2,292 kB
  • ctags: 781
  • sloc: jsp: 4,932; java: 4,052; makefile: 173; sh: 61
file content (60 lines) | stat: -rw-r--r-- 1,333 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$Id: FAQ,v 1.3 1999/10/17 01:37:24 wes Exp $

GNUJSP Frequently Asked Questions

1. Using beans
Q: I started using beans and my example looks like


><jsp:useBean id="test" class="JspBean" scope="application" />
>
><p><%= test.getInt() %>
><p><% test.setInt(test.getInt()+1); %>
>

the example compiles O.K. but at application time 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;"

Reason: You are using the "default package" (= no package).
        The default package has a special meaning regarding searching.
        Normally it's the "current directory" thats not true if
        you just mentioned it in the CLASSPATH.
 
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 pre <1.0 to 1.0 and above.

In this case:

Old Syntax:

<%@ import="java.io.File" %>

New Syntax:

<%@ page import="java.io.File" %>

So the name "page" was missing.