This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes jsp error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp error" Watch "jsp error" New topic

jsp error

monis raza
Ranch Hand

Joined: Sep 05, 2011
Posts: 38

whinig over this error please some one help
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60082

At some point in the JSP you are trying to cast a String to an ArrayList, and obviously you can't do that.

Why is there Java code in the JSP? That's a practice that has been obsolete and discredited for 10 years. Please see this JspFaq entry.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1016
The problem is caused by this line:

What that method does is add all the items in the datalist to the polist.
What you seem to want is to add the datalist to the polist (ie end up with a list of lists)
in which case what you want is:

I would echos Bear's comments about java code in JSPs.
I would also suggest you come up with a better structure than a List of Lists.
Why not create a java bean to represent what you want, and return a list of them?

Here is the sasme page converted to using JSTL:

I agree. Here's the link:
subject: jsp error
Similar Threads
Problems when viewing specific description when search
Unable to find specific product
Paging in jsp
problem calling servlet to build a list of data from a database and display a jsp page
JSP two pages