This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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: 60794

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
Unable to find specific product
Problems when viewing specific description when search
problem calling servlet to build a list of data from a database and display a jsp page
JSP two pages
Paging in jsp