<%@ page import="java.io.BufferedReader" %> <%@ page import="java.io.File" %> <%@ page import="java.io.FileReader" %> <%@ page import="java.io.IOException" %> <html> <head> <title>ThaiCreate.Com JSP Tutorial</title> </head> <body> <% String path = application.getRealPath("/") + "thaicreate.csv"; File file = new File(path); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { String[] arr = line.split(","); out.print(arr[0]); out.print(" - "); out.print(arr[1]); out.print(" - "); out.print(arr[2]); out.print(" - "); out.print(arr[3]); out.print(" - "); out.print(arr[4]); out.print(" - "); out.print(arr[5]); out.println("<br>"); } br.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } %> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท