1 J2EE 中,()类的()方法用于创建对话。(选择一项)
a) HttpServletRequest、getSession
b) HttpServletResponse、newSession
c) HtttpSession、newInstance
d) HttpSession、getSession
2 给定一个 Servlet 的doGet方法中的代码片段,如下:
request.setAttribute(“name”,”zhang”);
response.sendRedirect(“http://localhost:8080/servlet/MyServlt”)
那么在 MyServlet 中可以使用()方法把属性 name的值取出来。(选择一项)
a) String str=request.getAttribute(“name”);
b) String str=(String)request.getAttribute(“name”);
c) Object str=request.getAttribute(“name”);
d) 无法取出来
3.编写Servlet 的doPost方法时,需要抛出异常为()。(只选一项)
A.ServletException, IOException
B.ServletException, RemoteException
C.HttpServletException, IOException
D.HttpServletException, RemoteException
4.以下()可用于检索session属性userid的值。(只选一项)
A.session. getAttribute (“userid”);
B.session. setAttribute (“userid”);
C.request. getParameter (“userid”);
D.request. getAttribute (“userid”);
¥29.8
¥9.9
¥59.8