77范文网 - 专业文章范例文档资料分享平台

JSP程序设计习题解答(2)

来源:网络收集 时间:2019-03-28 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

two.jsp:

<%@ page contentType=\<%@ page import =\

<%@ taglib tagdir=\

面积保留6位小数点: <%

NumberFormat f=NumberFormat.getInstance(); f.setMaximumFractionDigits(6); double result=area.doubleValue(); String str=f.format(result); out.println(str); %> GetArea.tag:

<%@ attribute name=\<%@ attribute name=\<%@ attribute name=\

<%@ variable name-given=\ <%

double a=Double.parseDouble(sideA); double b=Double.parseDouble(sideB); double c=Double.parseDouble(sideC); if(a+b>c&&a+c>b&&c+b>a) { double p=(a+b+c)/2.0;

double result=Math.sqrt(p*(p-a)*(p-b)*(p-c)) ; jspContext.setAttribute(\ } else

{ jspContext.setAttribute(\ } %>

8.答:

linxi8.jsp:

6

<%@ page contentType=\<%@ taglib tagdir=\

Biaoge.tag:

<%@ attribute name=\<%@ attribute name=\<%@ attribute name=\<%@ attribute name=\ <%=name%> <%=phone%> <%=email%>

习题四

1.答:(C)。

2.答:将获取的字符串用ISO-8859-1进行编码,并将编码存放到一个字节数组中,然后再将这个数组转化为字符串对象。 3.答:

inputString.jsp:

<%@ page contentType=\

computer.jsp:

<%@ page contentType=\

<% String textContent=request.getParameter(\ byte b[]=textContent.getBytes(\ textContent=new String(b); %>

字符串:<%=textContent%>的长度:<%=textContent.length()%>

4.答:实现用户的重定向。

5.答:(1) 不相同。(2)相同。(3)可能消失。(4)一定消失。6.答:

lianxi6.jsp:

<%@ page contentType=\ <%

session.setAttribute(\请您猜字母\ char a[]=new char[26]; int m=0;

for(char c='a';c<='z';c++) { a[m]=c; m++; }

int randomIndex=(int)(Math.random()*a.length); char ch=a[randomIndex]; //获取一个英文字母

session.setAttribute(\ session.setAttribute(\%>

访问或刷新该页面可以随机得到一个英文字母.


单击超链接去猜出这个字母: guess.jsp:

8

<%@ page contentType=\<%@ taglib tagdir=\

<% String str=request.getParameter(\ if(str==null) { str=\ }

if(str.length()==0) { str=\ } %>

<% if(message.startsWith(\您猜对了\ {

%>
<% } else {

%>
输入您的猜测:

<% } %> GuessLetter.jsp:

<%@ tag pageEncoding=\

<%@ attribute name=\<%@ variable name-given=\ <% String mess=\

Character ch=(Character)session.getAttribute(\ char realLetter=ch.charValue(); char c=(guessLetter.trim()).charAt(0); if(c<='z'&&c>='a') { 9

if(realLetter==c) {

int n=((Integer)session.getAttribute(\ n=n+1;

session.setAttribute(\ mess=\您猜对了,这是第\次猜测\ }

else if(realLetter

int n=((Integer)session.getAttribute(\ n=n+1;

session.setAttribute(\ mess=\您猜大了,这是第\次猜测\ }

else if(realLetter>c) {

int n=((Integer)session.getAttribute(\ n=n+1;

session.setAttribute(\ mess=\您猜小了,这是第\次猜测\ } } else

{ mess=\请输入a至z之间的英文字母。\ }

jspContext.setAttribute(\%>

习题五

1.答:不能

2.答:调用public long length()方法。

3.答:A和D。

4. 答:RandomAccessFile类既不是输入流类InputStream类的子类,也不是输出流类Outputstream类的子类。想对一个文件进行读写操作时,可以创建一个指向该文件的RandomAccessFile流,这样我们既可以从这个流中读取这个文件的数据,也可以通过这个流给这个文件写入数据。 5. 答:

10

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库JSP程序设计习题解答(2)在线全文阅读。

JSP程序设计习题解答(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/553136.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: