Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jon Brasted
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Jon Brasted
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 293
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic