?? urlservlet.java
字號:
package com.middle.graduate.servlet.teacher;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class UrlServlet extends HttpServlet {
private static final long serialVersionUID = -7866663297825791395L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Enumeration e = request.getParameterNames();
request.setCharacterEncoding("gbk");
response.setContentType("text/html;charset=gb2312");
String name = null;
while(e.hasMoreElements()) {
name = (String)e.nextElement();
System.out.println(name);
}
String nextPage = null;
if(name.equals("add_topic")) {
nextPage = "/teacher/operation/addtopic";
} else if(name.equals("update_topic")) {
nextPage = "/teacher/operation/updatetopic";
} else if(name.equals("query_submitted_topic")) {
nextPage = "/teacher/operation/querysubmittedtopic";
} else if(name.equals("query_selected_topic")) {
nextPage = "/teacher/operation/queryselectedtopic";
} else if(name.equals("change_password")) {
nextPage = "/teacher/operation/changepassword";
} else if(name.equals("quit")) {
nextPage = "/teacher/operation/quit";
}
ServletContext application = getServletContext();
RequestDispatcher dispatcher = application.getRequestDispatcher(nextPage);
dispatcher.forward(request, response);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -