Hi,
I have a JSP page that has a 2D Array of Strings. I need to pass this 2D Array to another JSP. But when I pass its a null. The code is as follows
<html>
<body>
<from method = "post" action = "two.jsp">
<% String[][] data = {{"USER", "TOM"}, {"EMAIL", "tom@xyz.com"}};
%>
<%
session.setAttribute("MyData", data);
%>
<input type = "submit" value = "Click">
</form>
</body>
</html>
The code of two.jsp is as follows
<%
String[][] data = session.getAttribute("MyData"
%>
<% for(int i = 0; i < data.length; i++)
{
for(int j = 0; j < data[0].length; j++)
System.out.print(" Name/Value " + data[j]);
System.out.println();
}
%>
It throws a null pointer Excpetion at the line data.length.
Could anybody say me why.
With Regards
Murali
But it does now worl
I have a JSP page that has a 2D Array of Strings. I need to pass this 2D Array to another JSP. But when I pass its a null. The code is as follows
<html>
<body>
<from method = "post" action = "two.jsp">
<% String[][] data = {{"USER", "TOM"}, {"EMAIL", "tom@xyz.com"}};
%>
<%
session.setAttribute("MyData", data);
%>
<input type = "submit" value = "Click">
</form>
</body>
</html>
The code of two.jsp is as follows
<%
String[][] data = session.getAttribute("MyData"
%>
<% for(int i = 0; i < data.length; i++)
{
for(int j = 0; j < data[0].length; j++)
System.out.print(" Name/Value " + data[j]);
System.out.println();
}
%>
It throws a null pointer Excpetion at the line data.length.
Could anybody say me why.
With Regards
Murali
But it does now worl