将 XML 数据导入 Google App Engine
2010-10-22 17:18:53 来源:WEB开发网<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Create all employee</title>
</head>
<body>
<form action="/CreateEmployee" method="POST">
<textarea name="employeeXML" cols="25" rows="25">
</textarea>
<input type="submit" value="Create Employee(s)"/>
</form>
</body>
</html>
由于表单使用 POST 方法,需要向 CreateEmployeeServlet 类添加 doPost() 函数(参见 清单 9),以便在用户单击 Create Employee(s) 按钮时调用。
清单 9. 将 doPost 方法添加到 EmployeeServlet.java
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
new EmployeeHandler(request.getParameter("employeeXML");
RequestDispatcher view = request.
getRequestDispatcher("/createEmployee.jsp");
view.forward(request, response);
}
更多精彩
赞助商链接