#1
  1. Golden Member =p
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Final Frontier
    Posts
    9
    Rep Power
    0

    Question Retieving array from session


    i set the session
    ...
    ResultBean[] result = new ResultBean[n];
    ...
    session.setAttribute("results",result);


    and try to retrieve it:

    ResultBean[] rb = (ResultBean) session.getAttribute("result");


    i get:

    Incompatible type for declaration. Can't convert event.ResultBean to event.ResultBean[].
    ResultBean[] rb = (ResultBean) session.getAttributes("result");


    Thanks in advance.
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    You are casting to a ResultBean object when retrieving. It is not a ResultBean, it is a ResultBean array. This is a different kind of object. Try this instead:
    Code:
    ResultBean[] rb = (ResultBean[]) session.getAttribute("result");

IMN logo majestic logo threadwatch logo seochat tools logo