ajaxÓëjsp »ñµÃ¿Õxml½â¾ö·½·¨
AjaxºÍjspµÄ¹ÖÏÖÏó
Èç¹ûÓÃAjaxÈ¥ÇëÇóÒ»¸öjspÒ³Ãæ£¬¸ÃjspÒ³Ãæ·µ»ØµÄÊÇxml£¨response.setContentType("text/xml; charset=GB2312");£©£¬²¢ÇÒ¸Ãjsp°üº¬ÏÂÃæÕâЩͷ@pageÖ¸ÁîµÄ»°£¬ÔòÔÚ¿Í»§¶Ëxml=XMLHttpRequest.responseXMLµÃµ½µÄÊÇÒ»¸ö²»°üº¬ÈÎÎñ¶«Î÷µÄxml¶ÔÏ󣬼´xml.childNodes.length½«»áÊÇ0.
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.suntek.notes.sql.DBGrid"%>
<%@ page import="java.util.Vector" %>
ÔÒòÊÇÒÔÉϵÄ@pageÖ¸Áî(ÆäʵÊÇÈκÎÒ»¸öÖ¸Áî)»á²úÉú¿ÕÐС£¼´ÔÚjspÀï±ßµÄout.print(xml)µ½¿Í»§¶ËµÄ֮ǰ£¬ÒѾÓпÕÐÐÊä³öÁË¡£½â¾ö°ì·¨¿ÉÒÔÊÇÈ¥µôÉÏÃæµÄÓï¾ä£¬»ò°Ñjsp¸ÄΪservlet
ͬʱ£¬jspÀï±ßµÄÈκοÕÐж¼ÓпÉÄܻᵼÖÂͬÑùµÄÎÊÌâ¡£
Ó¦¸ÃÓÃservlet½ÏºÃ¡£
Ïà¹ØÎĵµ£º
XmlDocument doc = new XmlDocument();
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "GB2312", null);
doc.AppendChild(dec);
//´´½¨Ò»¸ö¸ù½Úµã£¨Ò»¼¶£©
XmlElement root = doc.CreateElement("First");
doc.AppendChild(root);
//´´½¨½Úµã£ ......
ÎÒÊÇÔÚÒÔÏÂÕâÁ½ÖÖÇé¿öÏÂʹÓõ½Õâ¸öÎļþµÄ£º
µ±ÄãÐèÒªÏò·þÎñÆ÷ÉÏ´«Ò»¸öÎļþ£¬µ«ÊÇÕâ¸öÎļþ²¢²»ÔÚÄãµÄ±¾»úÉÏ£¬¶øÇÒÔÚÁíһ̨·þÎñÆ÷ÉÏ£¬µ«ÊÇÄãÓÖûÓб¾Ì¨·þÎñÆ÷µÄÔ¶³Ì×ÀÃæµÄȨÏÞÈÃËüÈ¥ÏÂÔØÄǸöÎļþ£¬ÕâʱÄã¾Í¿ÉÒÔʹÓôËÎļþÈ¥ÏÂÔØ¡£
¶þ¾ÍÊÇÄ¿±ê·þÎñÆ÷µÄÉÏ´«Ëٶȷdz£µÄÂý£¬ÓÚÊÇÎÒ½«ÎļþÏÈ´«µ½ÁËÁíһ̨ÉÏ´«ËٶȽϿìµÄ·þÎñÆ÷ÉÏ£¬ ......
<%@ page contentType="application/msexcel" %>
<%
//¶ÀÁ¢´ò¿ªexcelÈí¼þ
response.setHeader("Content-disposition","attachment; filename=MyExcel.xls");
//ǶÌ×ÔÚieÀï´ò¿ªexcel & ......
jspÒ³Ãæµ÷Óà <link type="text/css" rel="stylesheet" href="css/style.css"/>Ñùʽ±í
ÆäËûÑùʽ¶¼¿ÉÒÔÔÙÒ³ÃæÕý³£ÏÔʾ
.button-qingchu{background:url(images/qingchu.jpg); width:70px; height:30px; border:0px;} ÏñÕâÑùµÄ±³¾°Í¼Æ¬Ñùʽ¾ÍÏÔʾ²»³öͼƬÊÇʲôÎÊÌ⣡ Myeclipse 6.5
ÔÚhtmlÖж¼¿ÉÒÔÏÔʾ ÔÚjspÖÐÏÔʾ ......
jsp(java server pages)ÊÇÒ»ÖÖ¼¼Êõ,ÓÃÀ´´¦Àí¿Í»§¶ËÇëÇóµÄ,(Ä¿µÄÊÇΪÁË´ïµ½¶¯Ì¬ÍøÒ³µÄЧ¹û),´¦Àíºó´«¸ø¿Í»§¶Ë(Ò²¿ÉÒÔ˵¸øÁËä¯ÀÀÆ÷),¾Í³ÉÁËÎÒÃÇ¿´µ½µÄ¾²Ì¬ÍøÒ³(HTML)
HTML ¼ÓÈëJava´úÂë(±ÈÈç<%...%>)²»»áÓÖÈκÎЧ¹û,Ö»»á½²<%...%>ÏÔʾµ½Ò³ÃæÐÐ,»òÕ߸ù¾ÝλÖÃÓ°Ïì±àÒë. JSP(Java Server Page)Ò³ÃæÆäʵ¾ÍÊÇ ......