Ming Chang

Greenhorn
+ Follow
since Nov 06, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ming Chang

Susan,

Perhaps an alternate strategy for handling the action and passing the data to JSP is:

1. processAction() detects which option the user chose. Then passes a parameter to doView() method through setRenderParam()

2. in doView(), perform the database query.

3. At end of doView(), set the objects from DB into request, so your JSP can retrieve them.

This way your JSP won't be doing SQL queries.
17 years ago
When you run the line:

lArray.toArray (sArray);

and get the exception: ArrayStoreException, it is indicating object type in sArray are not the same type (or are not the super type) as the objects in lArray.

It is failing here because lArray contains object of class eg. XYZ, while sArray contains String.

In short, you can only perform toArray if both lArray and sArray will contain objects of the same type.

To achieve what you want in this case, you are probably better off iterating through each element in lArray, and then copy the toString() value into the sArray.

Hope this helps.

Ming
[ November 11, 2007: Message edited by: Ming Chang ]
17 years ago