File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem while retrieving 2d array

 
kesava chaitanya
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had 3 rows and 3 cols in the UI forum ;
i am creating 2 dimensional array in jsp and assigning requests to 2D array and after that storing into session object;

when i retrive the session object i am getting only last value of the 2D ARRAY thats is [3,3] value;

what wrong did i made in the below code

String formData[][] = null ;


for(int i=1;i<4;i++)
{
for(int j=1;j<4;j++)
{

if(request.getParameter("mytextbox"+i+j+"_"+pageNumber) != null && !"".equals(request.getParameter("mytextbox"+i+j+"_"+pageNumber)))
{
formData =new String[4][4];
formData[i][j] = request.getParameter("mytextbox"+i+j+"_"+pageNumber);
}

}
}
session.setAttribute("myFormDataForPage"+pageNumber, formData);


if(session.getAttribute("myFormDataForPage"+pageNumber) != null && !"".equals(session.getAttribute("myFormDataForPage"+pageNumber)))
{

formData =(String[][])session.getAttribute("myFormDataForPage"+pageNumber);
for(int i=1;i<4;i++)
{
for(int j=1;j<4;j++)
{
System.out.println("session values in controllerrrrrrrrrrr="+formData[i][j]);
}
}
}
 
sanjeevmehra mehra
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
formData =new String[4][4];

above statement is in for loop. a logical problem (error).

hope this would be helpful.

pls. use code tag for posting code. u would get more reply & much earlier. just a suggestion


thanks & regards,
sanjeev.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic