编写Servlet的doPost方法时,需要抛出异常为()。
第1题:
下列______选项不是InputStream类中的方法。
A.public abstract int read() throws IOException
B.public final void writeInt (int V)throws IOException
C.public int available() throws IOException
D.public void close() throws IOException
第2题:
在编写过滤器时,需要完成的方法是()。
第3题:
在J2EE中,有如下代码在Servlet1.Java中 Import javax.servlet.*; Import javax.servlet.http.* Import java.io.IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init () throw ServletException {} Public void service(HttpServletRequest request, HttpServletResponce response) throws ServletException,IOException{ PrintWriter out=response.getWriter(); Out.println(“hello!”); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下成熟正确的是()
第4题:
在编写程序时如何在抛出异常的方法内部处理异常?
第5题:
在编写Servlet时,需要继承()类,在Servlet中声明doGet( )和doPost( )需要()和()类型的两个参数。
第6题:
哪个不是Servlet接口的方法?()
第7题:
下列哪一项不是Servlet中使用的方法?()
第8题:
下面Servlet的哪个方法载入时执行,且只执行一次,负责对Servlet进行初始化。()
第9题:
在J2EE中,有如下代码在Servlet1.java中 Import javax.servlet.*; Import javax,servlet.http.*; Import java.io,IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init() throws ServletException{} Public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ PrintWriter out = reponse.getWriter(); Out.println("hello!"); } } 假如要编 译的环境已都已经搭建好。现在用完全正确的命令编译该文件,对于以下陈述正确的是();
第10题:
ServletException,IOException
ServletException,RemoteException
HttpServlet Exception,IOException
HttpServletException,RemoteException
第11题:
ServletException,IOException
ServletException,RemoteException
HttpServletException,IOException
HttpServletException,RemoteException
第12题:
( 难度:中等)编写一个Servlet的步骤包含以下哪几个()
A.创建一个类继承HttpServlet
B.重写doPost与doGet方法
C.重写init(ServletConfig confg)方法
D.在wexml对Servlet进行配置
E.重写close()方法
答案:ABD
第13题:
下列哪个选项不是InputStream类中的方法?
A.public abstract int read( )throws IOException
B.public final void writeInt(int v)throws IOException
C.pubfic void close( )throws IOException
D.pubfic int available( )throws IOExcepfion
第14题:
下面哪个方法不是HttpServlet类:()
第15题:
在J2EE中,有如下代码在Servlet1.java中。 import javax.servlet.*; import javax.servlet.http.*; import java.io.IOException; import java.io.PrintWriter; public class Servlet1 extends HttpServlet { public void init() throws ServletException { } public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("hello!"); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。
第16题:
在J2EE中,对于HttpServlet类的描述,错误的是()。
第17题:
下面关于ServletException的方法说法正确的是()
第18题:
下面哪个方法当服务器关闭时被调用,用来释放Servlet所占的资源。()
第19题:
Servlet的初始化参数只能在Servlet的()方法中获取。
第20题:
编写Servlet的doPost方法时,需要抛出的异常是()
第21题:
ServletException()方法构建一个新的Servlet异常
ServletException(Stringmessage)方法构建一个指定信息的新的Servlet异常
ServletException(ThrowablerootCause)方法构建一个新的Servlet异常,Servlet需要时抛出,包含妨碍正常操作的根异常信息
getRootCause()方法返回引起Servlet异常的原因
以上方法只有AB正确
第22题:
第23题:
编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息