2019-05-29 17:09:11 Java

Java

Copy Copied! Full
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class GoServlet extends HttpServlet{ protected void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { String id = req.getParameter("id"); String page; page = id.equals("1") ? "end.html" : "go.html"; req.getRequestDispatcher(page).forward(req, res); } }
RECOMMEND