javax.servlet包中包含了两个异常类
A: IOException
B: Exception
C: ServletException
D: UnavilableException
E: Throws
A: IOException
B: Exception
C: ServletException
D: UnavilableException
E: Throws
举一反三
- Servlet包含类包javax.servlet 与javax.servlet.http。( ) 答
- LoginServlet是一个Servlet类,代码如下 public class LoginServlet extends ___________ { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { … } public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { … } } 在下划线处应填写()
- 下列代码中给出正确的在方法体内抛出异常的是( )。 A: new throw Exception(" "); B: throw new Exception(" "); C: throws IOException(); D: throws IOException;
- 给定如下所示的Java Servlet代码片段,用户在浏览器地址栏中键入正确的请求URL并回车后,在控制台上显示的结果是()。 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ System.out.println(“get”); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ System.out.println(“post”); } protected void service(HttpServletRequest req, HttpSergvletResponse resp) throws ServletException, IOException{ System.out.println(“service”); }
- 智慧职教: 在Servlet中有如下代码段: public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dis; _____________________________; dis.forward(request,response); }