Ö´ÐÐJSPºóÉú³ÉHTML¾²Ì¬Îļþ
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
public class toHtml extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url="";
String name="";
ServletContext sc = getServletContext();
//ÄãÒª·ÃÎʵÄjspÎļþ,Èçindex.jsp
//ÔòÄã·ÃÎÊÕâ¸öservletʱ¼Ó²ÎÊý.
//Èçhttp://localhost/toHtml?file_name=index
String file_name=request.getParameter("file_name");
//ÕâÊÇÄãÒªÉú³ÉHTMLµÄjspÎļþ,Èç
//http://localhost/index.jspµÄÖ´Ðнá¹û.
url = "/"+file_name+".jsp";
//ÕâÊÇÉú³ÉµÄhtmlÎļþÃû,Èçindex.htm.
name="/home/resin/resin-2.1.6/doc/"+file_name+".htm";
RequestDispatcher rd = sc.getRequestDispatcher(url);
final ByteArrayOutputStream os = new ByteArrayOutputStream();
final ServletOutputStream stream = new ServletOutputStream() {
public void write(byte[] data, int offset, int length) {
os.write(data, offset, length);
}
public void write(int b) throws IOException {
os.write(b);
}
};
final PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));
HttpServletResponse rep = new HttpServletResponseWrapper(response) {
public ServletOutputStream getOutputStream() {
Ïà¹ØÎĵµ£º
1 javascript £¬ÉèÖÃÒ»¸ö±äÁ¿£¬Ö»ÔÊÐíÌá½»Ò»´Î¡£
2 »¹ÊÇjavascript£¬½«Ìá½»°´Å¥»òÕßimageÖÃΪdisable
onsubmit="getElById('submitInput').disabled = true; return true;">
3 ÀûÓÃstrutsµÄͬ²½ÁîÅÆ»úÖÆ
......
1.Ê×ÏÈÒª±£Ö¤jspÒ³ÃæµÄ±àÂë¸ñʽ¡¢Êý¾Ý¿â±àÂë¸ñʽ¡¢javaÎļþ±£´æ¸ñʽ¡¢·þÎñÆ÷server.xmlÖеÄURIEncoding±àÂë¸ñʽ±£³ÖÒ»ÖÂ
2 ÊÖ¶¯Ð´Ò»¸ö¹ýÂËÆ÷£¬²¢ÇÒÔÚweb.xmlÎļþÖнøÐÐÅäÖá£
¾ßÌå´úÂë²Î¿¼ÈçÏ£¨µ÷ÊÔͨ¹ý£©£º
package cn.com.model2.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.se ......
getElementById getElementsByName getElementsByTagName ´ó¸Å½éÉÜ
getElementById £¬ getElementsByName £¬getElementsByTagName
byidÖ»Êǵõ½µ¥¸ö¶ÔÏó ¡¡¡¡ºóÁ½¸öÊǵõ½¼¯ºÏ£¬
getElementById µÄÓ÷¨
<a id="link1" name="link1" href=http://homepage.yesky.com> ......
ÎÄÕÂÀàÐÍ:¼¼ÊõÎĵµ ¸üÐÂʱ¼ä:2009-03-03 ·¢²¼Õß:HIT-ASP ÎÄÕÂÀ´Ô´:HIT-ASP µã»÷´ÎÊý:550
Õª×Ô:
http://www.zzsky.cn/build/content/658.htm
http://www.blueidea.com/tech/multimedia/2 ......
¿ÉÄÜ´ó¶àÊýJsp¿ª·¢Ô±ÔÚдÍê³ÌÐò²âÊÔͨ¹ýºó£¬²»Ì«»á¹Ø×¢JspÉú³ÉµÄJavaÎļþ£¬Æäʵ£¬Í¨¹ýJava´úÂ룬¸üÄÜÌåÏÖ³ÌÐò´úÂëµÄÕæÕýº¬Ò壬¶Ô½øÒ»²½Ñо¿³ÌÐò´úÂëµÄºǫ́ÔËÐÐÇé¿öÊǷdz£ÓаïÖúµÄ¡£ÀýÈ磬ÓÃJsp±àд´úÂëʱ£¬ÓÐʱºòÓÃ<%! %>£¬ÓÐʱºòÓÃ<% %>£¬¼Ó²»¼Ó¸Ð̾º ......