Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

problem using generics jdk1.5 in jsp  RSS feed

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this part is in servlet
myData is List<String> myData = get the data from java file
then in the servlet i call the code to show the jsp file which has the following code to recieve the data from servlet

this part is in jsp
List<String> myData = request.getAttribute("myData");
Iterator<String> it = myData.iterator();

but jsp page is now shown
gives this error
Type mismatch: cannot convert from Object to List

am using jdk 1.5
and tomcat 5.5
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat 5.5 ships with and uses it's own compiler (JDT from the Eclipse group). This compiler is not fully 1.5 compliant yet so, even if you're using a Java 1.5 JDK/JRE, JSPs compiled by Tomcat won't understand all of the 1.5 features.

Yet another reason not to put scriptlets in JSPs.
You can write all the Java 1.5 stuff you like in your servlets, beans, and other Java objects with the current version of Tomcat.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!