Solved

Array required, but java.sql.Array found

Posted on 2010-08-24
6
495 Views
Last Modified: 2012-05-10
Hi,

I am getting the Error at
"out.println("The object present is " + arrobj[1]);"

where ---------------------    
       
         Object[] obj;
        Object[] obj_sat3;

      obj_sat3 = ar2.toArray();
      obj = ar.toArray();

          session.setAttribute("obj1",obj);
      session.setAttribute("obj3",obj_sat3);
      Array arrobj = (Array)session.getAttribute("obj1");
        out.println("The object present is " + arrobj[1]);
------------------------------------------

but when i just use the obj object rather than session name "obj1" it works fine....
out.println("The object present is " + obj[1]);

Environment:-- JSP

thanks
0
Comment
Question by:kishan66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33513476
can you print?
out.println("The object present is " + arrobj.getClass());
out.println("The object present is " + arrobj);
out.println("The object present is " + arrobj.length);
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 33515239
>>session.setAttribute("obj1",obj);
have only one value
so try this arrobj[0]);
 
0
 

Author Comment

by:kishan66
ID: 33516073
Hi Gurvinder,

I tried all the Print statements...

--first two throws nothing...empty string though i used simple text like..
 out.println("The object present is " + arrobj.getClass());
 out.println("The object present is " + arrobj);
 
 "I guess there is some problem with " 
Array arrobj = (Array)session.getAttribute("obj1");

--Third print statement
Error-- Variable length at
out.println("The object present is " + arrobj.length);

thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 33516242
>>>>>>Error-- Variable length at
out.println("The object present is " + arrobj.length);

u cant find array length . u can find only size
0
 
LVL 27

Accepted Solution

by:
rrz earned 350 total points
ID: 33516743
>Array arrobj = (Array)session.getAttribute("obj1");
You set obj1 with  
session.setAttribute("obj1",obj);  
and you declared  
Object[] obj;  
Please try  using  
Object[] arrobj = (Object[])session.getAttribute("obj1");
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 150 total points
ID: 33518195
rather than type casting to Array type cast it to the same object which you have used in setting the attribute 'Object[]'
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft is moving in-place eDiscovery & hold from ECP to EOP console under Content Search in Search and Investigation Options.  In this post, I will be showing you how to export emails to a PST file using the Content Search Options.
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question