Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ö´ÐÐ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() {


Ïà¹ØÎĵµ£º

ÎÒµÄJSPѧϰ±Ê¼Ç JSPÒ³ÃæÖеÄÖ¸Áî

JSPµÄÖ¸ÁîÊÇÓÃÀ´°üº¬ÍⲿÎļþ»òÊǽøÐÐÒ³ÃæÈ«¾ÖÉèÖõģ»ËüµÄÓÐÈýÖÖ£¬·Ö±ðÊÇpage£¬include£¬taglibÖ¸Áî
1.pageÖ¸Áî
 ÐÎÈç<%@page ÊôÐÔ='Öµ'    ÊôÐÔ='Öµ'   ........ %>
 ÊôÐÔÓУº
 language=''java''   £º É趨jspÒ³ÃæµÄ½Å±¾ÓïÑÔ£¬Ä¿Ç°Ö»Ö§³Öjava£¬Ä¬ÈÏÊÇjava ......

js html¶ÔÏóͨÓÃÊôÐÔ×ܽá ÊÕ²Ø


           1£ºstyle¡¢style.cssText¼°style.position,style.leftµÈCSSÑùʽµÄ¸÷¸öÊôÐÔ
            È磺
           var section=document.createEleme ......

HTMLµÄµß¸²ÕßHTWL£¨Î¬ÓïÑÔ£©

      ´´Ð£¬ÔƼÆË㣬web2.0£¬»¹¼«ÓпÉÄÜweb3.0¡¢web4.0...ÇëÞÑÐÄ×ÔÎÊ£¬Óд´ÐÂÂð£¿IT¹»»ìÂÒÂð£¿Ò²ÐíÓÐЩÈ˲»³ÐÈÏ£¬ËûÃÇÖ»»á˵ÄÇЩÊÇ×îÏȽøµÄ¼¼Êõ¡£ÕæµÄÈç´Ë£¿ÕæʵµÄÇé¿öÊÇËûÃÇÏë½ÁÂÒÕâ¸öÊÀ½ç£¬³Ã»ëË®ÃþÓ㣬Ҳ¾ÍÊÇÏëÂÒÊÀ³öÓ¢ÐÛ¶øÒÑ¡£
      ºÜ¶àÈËÓ¦¸ÃÖªµÀ£¬webÓ¦ÓõÄÄÇ ......

JS»ñÈ¡ÍøÒ³ÖÐHTMLÔªËصļ¸ÖÖ·½·¨·ÖÎö

getElementById getElementsByName getElementsByTagName ´ó¸Å½éÉÜ
getElementById £¬        getElementsByName £¬getElementsByTagName
byidÖ»Êǵõ½µ¥¸ö¶ÔÏó ¡¡¡¡ºóÁ½¸öÊǵõ½¼¯ºÏ£¬
getElementById µÄÓ÷¨
<a id="link1" name="link1" href=http://homepage.yesky.com> ......

JSPÖж¯Ì¬INCLUDEÓ뾲̬INCLUDEµÄÇø±ð

ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
    <%@ include file=" "%>
    <jsp:include page=" " flush="true"/>
    Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ.
    ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö(ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸)¶¼ÏàͬµÄʱºò,Î ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ