In this tutorial , we will discuss how to display text ,saved in a text file using JSP & jQuery.
In this tutorial , we will discuss how to display text ,saved in a text file using JSP & jQuery.
Showing content of a file using JSP & jQuery
In this tutorial , we will discuss how to display text ,saved in a text file
using JSP & jQuery. In this example, the content of the text file is fetched and
display on the browser. The html file contains a text area and a button. On
clicking button, jQuery requests JSP for text saved in text file ,which it will
display in the text area provided.
Here is the video of “How to get server side content using jQuery and display on page?”:
JSP Code(includetxt.jsp)
<%@ page import="java.io.*" %>
<%
BufferedReader input = new BufferedReader(new FileReader
("C://rose.txt"));
String line = ""; while ((line = input.readLine()) != null)
{
out.println(line);
}
input.close();
%>
Content of the text file (rose.txt):
Welcome to RoseIndia.Net
jQuery Tutorial
Learn how you can do a lot of work with small code.
jQuery is here to help us in achieving high result with less coding.
jQuery is great!!!!