QUOTE(Inspiron @ Feb 4 2006, 06:12 AM)

I've a project on creating a Movie online booking website that is powered with JSP.
Now I'm trying to write and read from the file I wrote, but didn't know how.
Can anyone with such expertise please teach me.. It has to be done with JSP.
Thanks in advance..
Since you are coding jsp, I am assuming you have java programming knowledge. To read a file, you need java io package to be imported. So, here goes the import page directive at top of your jsp.
CODE
<%@page import="java.io.*"%>
Now, you have to create input stream using the file. Assuming the file is in the class path, you can get the stream by
CODE
java.net.URL url =config.getServletContext().getResource("yourfile.txt");
BufferedReader buffreader =new BufferedReader(new InputStreamReader(url.openStream()));
Rest of the things are same as reading from a BufferedReader in java. Make sure that the java code in jsp is inside <% and %> tags.
Reply