aspose file tools*
The moose likes JSP and the fly likes Two small problems I can't seem to be able to fix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Two small problems I can Watch "Two small problems I can New topic
Author

Two small problems I can't seem to be able to fix

Jon Brasted
Greenhorn

Joined: Mar 18, 2004
Posts: 19
Hi.

I have a little problem with a JSP I have. I get errors that I can't track down.

By the way, I am not using JSTL because I am not sure if it is installed on the web development server I will be installing this webapp on. (Poor excuse, I know... )

The purpose of the following page is to call on a static class method for an ArrayList, extracts the data from that ArrayList and and build a table from it. The static method fetches data from a database, stores it in objects of class RecordBean (one object of class RecordBean for each row) and then stores those objects in an ArrayList of the type RecordBean.

I would appreciate any advice that can be offered to me.

Many thanks.
Jon



[ July 24, 2005: Message edited by: Jon Brasted ]

[ July 24, 2005: Message edited by: Bear Bibeault ]


EDIT: I have also added code for DBAccess.java


[ July 24, 2005: Message edited by: Jon Brasted ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66


I am not using JSTL because I am not sure if it is installed on the web development server I will be installing this webapp on.


It is trivial to install the JSTL with the web app that you are deploying. No server configuration is necessary. Simply include the JSTL jar files in the web app's WEB-INF/lib folder.

You never did really say what problems you are having.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jon Brasted
Greenhorn

Joined: Mar 18, 2004
Posts: 19
Sorry. I forgot to include the error messages...


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 64 in the jsp file: /mainIndex.jsp
Generated servlet error:
Syntax error on token "<", invalid AssignmentOperator

An error occurred at line: 64 in the jsp file: /mainIndex.jsp
Generated servlet error:
Syntax error on token "=", != expected


I believe I have narrowed the problem down to
'ArrayList<RecordBean> arrList = DBAccess.browseAll();', as uncommenting that makes the compilation problems go away, however, I can't see any fault with that class?
[ July 25, 2005: Message edited by: Jon Brasted ]
Dave Salter
Ranch Hand

Joined: Jul 20, 2005
Posts: 292

Hi,

I think the problem is that you are trying to use JDK 1.5 features (generics) in a JSP page. Tomcat 5 by default doesn't use the JDK 1.5 compiler so it doesn't understand these new features.

If you follow these instructions, you should be able to set Tomcat up to allow you to compile JDK 1.5 compatible JSPs.

Cheers,

Dave.
Jon Brasted
Greenhorn

Joined: Mar 18, 2004
Posts: 19
Thanks. That's sorted the JDK 1.5 errors... now to work out how to reference the classes... maybe in web.xml? I'll have a look.


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 64 in the jsp file: /mainIndex.jsp
Generated servlet error:
C:\Apache\Catalina\localhost\fileserver\org\apache\jsp\mainIndex_jsp.java:119: cannot find symbol
symbol : class RecordBean
location: class org.apache.jsp.mainIndex_jsp
ArrayList<RecordBean> arrList = DBAccess.browseAll();
^


An error occurred at line: 64 in the jsp file: /mainIndex.jsp
Generated servlet error:
C:\Apache\Catalina\localhost\fileserver\org\apache\jsp\mainIndex_jsp.java:119: cannot find symbol
symbol : variable DBAccess
location: class org.apache.jsp.mainIndex_jsp
ArrayList<RecordBean> arrList = DBAccess.browseAll();
^
2 errors


[ July 25, 2005: Message edited by: Jon Brasted ]


SOLVED: Put RecordBean and DBAccess in a separate package and imported them. Silly me!
[ July 25, 2005: Message edited by: Jon Brasted ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two small problems I can't seem to be able to fix