Hi Guys,
this is the code that reads the data from a text file and displays it in a jsp.
iam trying to put the data in a array so that each time the code readfs the data the previous data is stored, however this is not working can someone please help.
this is the code that reads the data from a text file and displays it in a jsp.
iam trying to put the data in a array so that each time the code readfs the data the previous data is stored, however this is not working can someone please help.
Code:
<HTML>
<HEAD>
<TITLE>The result.....</TITLE>
</HEAD>
<BODY>
<%@ page language = "java" import="java.io.*"%>
<% try
{
String strPath ="W:/www/ee05u041/data.txt";
String j;
int []i;
i=new int[10];
for( i[0]; i[0]<10; i++)
{
BufferedReader objReader = new BufferedReader(new FileReader(strPath));
i[0] = objReader.readLine ();
j=Integer.parseInt(i[0]);
while (i[0] != null)
{
out.println(j);
j = objReader.readLine();
i[0]=j;
}
}
out.println(i[0]);
out.println(i[1]);
out.println(i[2]);
catch(IOException e){}
}
%>
</BODY>
</HTML>
Comment