<%! long Factorial(int n) { int sum=1; for(int i=1;i<=n;i++) {sum=sum*i;} return sum; } %> 1到10之间的各数字的阶乘
<% long sum; for(int j=1;j<=10;j++) { sum=Factorial(j); out.print("
"+j+"!="+sum); } %> 1)在JSP中,要定义一个方法,需要用到以下(c)元素。
选择一项)a) <%= %> b) <% %>c) <%! %>d) <%@ %>2)JSP页面经过编译之后,将创建一个()选择一项)Ba) applet b) servletc) applicationd) exe文件7) 在JSP中,page指令的()属性用来引入需要的包或类选择一项)Ba) extends b) importc) languge d) contentType8) 在Servlet过滤器的生命周期方法中,每当传递请求或响应时,web容器会调用(C)方法a) initb) servicec) doFilterd) destroy9) 在JSP中,只有一行代码:<%=’A’+’B’%>,运行将输出()选择一项)Ca) A+Bb) ABc) 131d) 错误信息,因为表达式是错误的10)给定一个Servlet的代码片段如下:Public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{ ______out.println(“hi kitty!”);out.close();}运行次Servlet时输出如下:hi kitty!则应在此Servlet下划线处填充如下代码。
选项一项)Aa) PrintWriter out = response.getWriter();b)PrintWriter out = request.getWriter();c) OutputStream out = response.getOutputStream();d) OutputStream out = request.getWriter();13)某JSP程序中声明使用javaBean的语句如下:BC要取出该javaBean的loginName属性值,以下语句正确的是(). (选择两项)a)b) c)<%=user.getLoginName()%>d)<%=user.getProperty(“loginName”)%>15)给顶一个JSP程序源代码,如下:在two.jsp中使用(D)代码片段可以输出参数location的值。
ab)c<%=request.getAttribute("location")%>d)<%=request.getParameter("location")%>18) 如JSP页面执行时遇到自定义标签,doStartTag()方法将被调用(A)次选择一项) a) 1b) 1或多 c) 0或1 d) 0或多19) 给定include1.jsp文件代码片断,如下:<% pageContext.setAttribute("User","HAHA");%> _______//此处填写代码给定include2.jsp文件代码片断,如下:<%=pageContext.getAttribute("User")%>要求运行include1.jsp时,浏览器上输出:HAHA要满足以上条件,jsp1.jsp中下划线处应填入以下(B)语句选择一项)a)b)<%@includefile="include2.jsp"%>c)d)<%response.sendRedirect("include2.jsp");%>24) 要设置某个JSP页面为错误处理页面,以下page指令正确的是(B)。
a<%@pageerrorPage="true"%>b)<%@pageisErrorPage="true"%>c)<%@pageextends="javax.servlet.jsp.JspErrorPage"%>d) <%@ page info="error"%>26) 在Servlet里,能正确获取session的语句是(A) (选择一项)a) HttpSession session = request.getSession(true);b)HttpSession session = request.getHttpSession(true);c)HttpSession session = response.getSession(true);d)HttpSession session = response. getHttpSession (true);27) 在JSP中,(A)动作用于将请求转发给其他JSP页面 (选择一项)a)forward b) includec)useBeand)setProperty30) 给定JSP程序源码如下,可以在下划线处插入并且能够正确输出WELCOME,JACK的语句是()。
(选择二项)
<% String name="JACK"; %>WELCOME,__BD____a)name b)<%=name%>c)out.println(name);d) <% out.println(name); %>32) 在JSP中,使用动作可以将javaBean嵌入JSP页面,对JavaBean的访问范围不能是(C)a)pageb)requestc)responsed)application34) Servlet中,使用()接口中定义的(B)方法来处理客户端发出的表单数据请求 (选一项)a) HttpServlet doHeadb) HttpServlet doPostc) ServletRequest doGet d) ServletRequest doPost35) 给定JSP程序源码如下,该JSP运行后输出的结果是(D) (选择一项) <% int count =1;%> Count: <% ++count; %>a) Count:1b) Count:2c) 1:2 d) Count:给定JSP程序源码如下: <% int count =1;%> _______以下(D)语句可以在下划线处插入,并且运行后输出结果是:1。
a) <%=++count %>b) <% ++count; %>c) <% count++; %> d) <% =count++ %>47) servlet 的生命周期又一系列事件组成,把这些事件按照先后顺序排序,以下正确的是(B)(选择一项)a) 加载类,实例化,请求处理,初始化,销毁b) 加载类,实例化,初始化,请求处理,销毁c) 实例化,加载类,初始化,请求处理,销毁d) 加载类,初始化,实例化,请求处理,销毁1、 Tomcat服务器的默认端口是8080怎样修改tomcat的端口在Tomcat下打开conf文件夹找到server.xml文件用记事本打开在中把8080更改即可,2、 异常的处理,可在该方法的代码段中包含3类代码:try、catch和finally代码块3、 jsp主要内置对象有:application、exception、pageContext、request、session、response_out、config、page5、 application对象是 代表应用程序上下文,它允许JSP页面与包括在同一应用程序中的任何Web组件共享信息,而session对象则是每个客户专用的。
6、 JDBC的主要任务是: 与数据库建立连接、发送SQL语句、 处理结果7、 一个Bean由三部分组成:实现java.io.serializable接口、提供无参数的构造方法、提供getter()和setter()方法访问它的属性8、 Java Servlet的主要特点是:运行高效、方便、功能强大、节省投资运行servlet需要在web.xml注册.9、 Servlet的生命周期分三个时期:装载Servlet、创建一个Servlet实例、销毁10、 JSP开发网站的两种模式分为jsp+javabean_和sp+javabean+servlet 1、下面哪一个不是JSP本身已加载的基本类?(b )A、java.lang.* B、java.io.* C、javax.servlet.* D、javax.servlet.jsp.*2、对于预定义<%!预定义%>的说法错误的是:(c)A、一次可声明多个变量和方法,只要以“;”结尾就行B一个声明仅在一个页面中有效C、声明的变量将作为局部变量 D、在预定义中声明的变量将在JSP页面初始化时初始化 3、从 “员工” 表的“姓名”字段中找出名字包含“玛丽”的人,下面哪条select语句正确:( D )A、 Select * from员工 where 姓名 =’_玛丽_’ B 、Select * from员工 where 姓名 =’%玛丽_’C、 Select * from员工 where 姓名 like ‘_玛丽%’ D、 Select * from员工 where 姓名 like ‘%玛丽%’4、下述选项中不属于JDBC基本功能的是:( D )A. 与数据库建立连接 B. 提交SQL语句 C. 处理查询结果 D. 数据库维护管理5、在JSP中使用标记时,不会出现的属性是:( c )A. name B. propertyC. value D. 以上皆不会出现6、Page指令用于定义JSP文件中的全局属性,下列关于该指令用法的描述不正确的是:(D )A. <%@ page %>作用于整个JSP页面。
B. 可以在一个页面中使用多个<%@ page %>指令C. 为增强程序的可读性,建议将<%@ page %>指令放在JSP文件的开头,但不是必须的D. <%@ page %>指令中的属性只能出现一次7、在JSP中调用JavaBean时不会用到的标记是:( A )A. B.C. D. 8、关于JavaBean正确的说法是:( A)A、Java文件与Bean所定义的类名可以不同,但一定要注意区分字母的大小写B、在JSP文件中引用Bean,其实就是用语句C、被引用的Bean文件的文件名后缀为.java D、Bean文件放在任何目录下都可以被引用10、 不能在不同用户之间共享数据的方法是(A )A、通过cookie B、利用文件系统 C、利用数据库 D、通过ServletContext对象 Winger Tuivasa-Sheck, who scored two tries in the Kiwis' 20-18 semi-final win over England, has been passed fit after a lower-leg injury, while Slater has been named at full-back but is still recovering from a knee injury aggravated against USA.Both sides boast 100% records heading into the encounter but Australia have not conceded a try since Josh Charnley's effort in their first pool match against England on the opening day.Aussie winger Jarryd Hayne is the competition's top try scorer with nine, closely followed by Tuivasa-Sheck with eight.But it is recently named Rugby League International Federation player of the year Sonny Bill Williams who has attracted the most interest in the tournament so far.The Kiwi - with a tournament high 17 offloads - has the chance of becoming the first player to win the World Cup in both rugby league and rugby union after triumphing with the All Blacks in 2011."I'd give every award back in a heartbeat just to get across the line this weekend," said Williams.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifa's anti-racism taskforce, is in London for the Football Association's 150th anniversary celebrations and will attend City's Premier League match at Chelsea on Sunday."I am going to be at the match tomorrow and I have asked to meet Yaya Toure," he told BBC Sport."For me it's about how he felt and I would like to speak to him first to find out what his experience was."Uefa has opened disciplinary proceedings against CSKA for the "racist behaviour of their fans" during City's 2-1 win.Michel Platini, president of European football's governing body, has also ordered an immediate investigation into the referee's actions.CSKA said they were "surprised and disappointed" by Toure's complaint. In a statement the Russian side added: "We found no racist insults from fans of CSKA." Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as Sunda.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm -- winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet ( Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.They blew it in 2008 when they got caught cold in the final and they will not make the same mistake against the Kiwis in Manchester.Five years ago they cruised through to the final and so far history has repeated itself here - the last try they conceded was scored by England's Josh Charnley in the opening game of the tournament.That could be classed as a weakness, a team under-cooked - but I have been impressed by the Kangaroos' focus in their games since then.They have been concentrating on the sort of stuff that wins you tough, even contests - strong defence, especially on their own goal-line, completing sets and a good kick-chase. They've been great at all the unglamorous stuff that often goes unnoticed in the stands but not by your team-mates.It is as though their entire tournament has been preparation for the final.In Johnathan Thurston, Cooper Cronk, Cameron Smith and either Billy Slater or Greg Inglis at full-back they have a spine that is unmatched in rugby league. They have played in so many high-pressure games - a priceless asset going into Saturday.The Kiwis are a lot less experienced but winning a dramatic match like their semi-final against England will do wonders for their confidence.They defeated Australia in the Four Nations final in 2010 and the last World Cup, and know they can rise to the big occasion.。