#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    1
    Rep Power
    0

    casting of 2D array


    Hi,

    I have try to forward from a servlet to a JSP.
    Code in my servlet is below:

    String[ ][ ] carrot;
    :
    :
    RequestDispatcher rd = getServletContext().getRequestDispatcher("/summary.jsp");
    request.setAttribute("Data", arr);
    rd.forward(request, response);


    Code in my summary.jsp is below:

    <%
    String[ ][ ] listSort = (String[ ][ ])request.getParameter("sortedData");
    :
    :
    %>


    But i keep getting the below error message:
    Invalid cast from java.lang.String to java.lang.String[ ][ ].

    May I know which is the correct way to retrieve an 2D array??
    Thanks a lot..
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Try using request.getAttribute() instead of request.getParameter().

IMN logo majestic logo threadwatch logo seochat tools logo