日期:2014-05-19 浏览次数:20713 次
<script type="text/javascript"> function loadXMLDoc(username) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var text = xmlhttp.responseText; if (text == "1") { document.getElementById("myDiv").innerHTML = xmlhttp.responseText; } } } xmlhttp.open("GET", "Demo", true); xmlhttp.send(null); } </script>
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("ooo v587"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("1"); out.flush(); out.close(); }
<servlet> <description>This is the description of my J2EE component</description> <display-name>This is the display name of my J2EE component</display-name> <servlet-name>Demo</servlet-name> <servlet-class>Filter.Demo</servlet-class> </servlet> <servlet-mapping> <servlet-name>Demo</servlet-name> <url-pattern>/servlet/Demo</url-pattern> </servlet-mapping>