You are here:

JSP - Java Server Pages/Read text file into your JSP

Advertisement


Question
Hi,

Were you able to get your JSP page to read your text file? I'm trying to do the same thing.
I want to take the values after is parsed and create an array, and somehow I need the array to be the source for my drop down list.
Please help if you can.



Thanks,
Youssef

Answer
first time i'm helping some one with code and don't ask me more for code. now u can put the line in the array and arrange your text file in a way each line is a value of the drop box

i think this will help you
<%
BufferedReader input = new BufferedReader(new FileReader("prueba.txt"));
String line = "";
while ((line = input.readLine()) != null) {
   out.println(line);
}
output.flush();
input.close();
%>

JSP - Java Server Pages

All Answers


Ask Experts

Volunteer


k2patel

Expertise

Only based on the pure jsp and the taglibs related question`s I can answer up to expert level. Do not ask me question regarding to the servlet

Experience


Past/Present clients
shhhhhhhh...

©2012 About.com, a part of The New York Times Company. All rights reserved.