Using JSP branch of the write-read paper

  Abstract: JSP branch of the write-read paper 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 
  <table Width="705" border="0"> <tr> <td width="421"> <% @ page contentType = "text / html; charset = GB2312"%> 
  <% @ Page language = "java"%> 
  <% @ Page import = "java.io. *"%> 

<head>

  </ Head> 
<body>


  Branch writes data 






  </ Td> <td width="274"> </ td> </ tr> </ table> 
<%
  Request.getRealPath ("/"); String path = / / actual location of the root 
  FileWriter fw = new FileWriter (path + "\ \ WriteFile.txt"); / / build FileWrite variables, and set the variables used by fw 
  BufferedWriter bw = new BufferedWriter (fw); / / build BufferedWriter variables, and set the variables used by bw 
  / / String into the file 
  Bw.write ( "Good morning!"); 
  Bw.newLine (); / / branch 
  Bw.write ( "You are welcome to study jsp!"); 
  Bw.newLine (); / / branch 
  Bw.write ( "I wish you all a happy learning jsp!"); 
  Bw.newLine (); / / branch 
  Bw.write ( "Byebye!"); 
  Bw.flush () / / will be updated to file information 
  Fw.close () / / close file 
%>

  To write the contents of the documents 



<%
  FileReader fr = new FileReader (path + "\ \ WriteFile.txt"); / / build FileReader variables, variables and set variables used by the fr 
  BufferedReader br = new BufferedReader (fr); / / read the variable BufferedRead 
  String Line = br.readLine (); / / read his information 
  While (Line! = Null) / / read the information obtained by the judge whether null 
  ( 
  Out.println (Line + " 
  "); / / Output read the information obtained 
  Line = br.readLine (); / / read his information 
  ) 
  Fr.close () / / close file 
%>

  </ Body> 
  </ Td> </ tr> <tr> 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply