File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 63839

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] [About Bear] [Books by Bear]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
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
It's not a secret anymore!