JSP¶ÔÎļþµÄ²Ù×÷
Ò»¡¢ÔÚJSPÒ³ÃæÖжÁÈ¡±¾µØÎļþÄÚÈÝ£º
<%
try {
BufferedReader in = new BufferedReader(new FileReader("D:/test.txt"));
String file = "";
String temp = "";
while((temp=in.readLine())!=null) {
file += temp + "<br>";
}
out.println(file);
in.close();
out.flush();
} catch(Exception e) {
e.printStackTrace();
}
%>
¶þ¡¢ÔÚJSPÒ³ÃæÖÐдÈëÎļþÄÚÈÝ£º
<%
try {
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("D:/test.txt", true)));
writer.write(content);
writer.close();
out.println("ÒѾдÈëµ½ÎļþÖÐ");
} catch(Exception e) {
e.printStackTrace();
}
%>
Ïà¹ØÎĵµ£º
pageEncoding£ºÉèÖÃJSPÔ´ÎļþºÍÏìÓ¦ÕýÎÄÖеÄ×Ö·û¼¯±àÂë¡£
contentType£ºÉèÖÃJSPÔ´ÎļþºÍÏìÓ¦ÕýÎĵÄ×Ö·û¼¯±àÂë¼°MIMEÀàÐÍ¡£
¿É¼û,pageEncodingºÍcontentType¶¼¿ÉÒÔÉèÖÃJSPÔ´ÎļþºÍÏìÓ¦ÕýÎÄÖеÄ×Ö·û¼¯±àÂë¡£µ«Ò²ÓÐÇø±ð:
ÉèÖÃJSPÔ´Îļþ×Ö·û¼¯Ê±,ÓÅÏȼ¶ÎªpageEncoding>contentType¡£Èç¹û¶¼Ã»ÓÐÉèÖã¬Ä¬ÈÏISO-8859-1¡£
......
ºìÆì×ÀÃæLinux4.1Ï°²×°ºÍÅäÖÃJSP·þÎñÆ÷È«¹¥ÂÔ
ÕâÁ½ÌìÊÔ×ÅÔÚºìÆìLinux×ÀÃæ°æ4.1Ï°²×°WEB·þÎñÆ÷£¬Òѳɹ¦°²×°£¬ÏÖ°ÑÎҵݲװ¹ý³Ì½éÉÜÈçÏ£¬ÒÔ¸øÓÐÏàËÆÐèÇóµÄÍøÓѲο¼¡£
ÎҵݲװҪÇóÊÇÖ§³ÖJSP¡¢html¡¢htmÍøÒ³£¬ËùÒÔÑ¡ÓÃJDK1.5.0+Tomcat5.5.4+mySQL4.1.7£¬ÕâЩ¶¼Êǵ±Ç°¸÷Èí¼þ×îеÄÎȶ¨°æ±¾£¨·Ç²âÊ԰棩¡£ÔÝûÓа²×°Apacheº ......
I used Eclipse to try the google app engine demo project: guestbook.
when i create a *.jsp file in the WAR directory,the error information appear:
"Your Web Application Project must be configured to use a JDK in order to use JSPs."
solution:
It is because Eclipse put the JRE to the JRE directory ......
package com.gc.tool;
import java.util.ArrayList;
import java.util.List;
public class MyPagination {
private int recordCount = 0;
private int pagesize = 0;
private int maxPage = 0;
&n ......