日期:2014-05-17 浏览次数:20765 次
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestSer extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.sendRedirect("../test1.jsp");
//request.getRequestDispatcher("../test1.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
}
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'test1.jsp' starting page</title>
<script type="text/javascript" src="jquery.js"></script>
<script>
$(document).ready(function() {
alert("test");
});
function test() {
alert("test1");
}
</script>
</head>
<body>
<input type="button" value="按钮" onclick="test();" />
</body>
</html>
<script type="text/javascript" src="../jquery.js"></script>