jsp基础教程代码(第2版)

2026/1/25 3:51:43

请输入三角形的三个边a,b,c的长度:

请输入三角形边a的长度:请输入三角形边b的长度:请输入三角形边c的长度:

<%--获取客户提交的数据--%>

<% String string_a=request.getParameter(\ string_b=request.getParameter(\ string_c=request.getParameter(\ double a=0,b=0,c=0;

%>

<%--判断字符串是否是空对象,如果是空对象就初始化--%> <%if(string_a==null) { string_a=\ string_b=\ string_c=\ }

%>

<%--求出边长,并计算面积--%>

<%try{ a=Double.valueOf(string_a).doubleValue(); b=Double.valueOf(string_b).doubleValue(); c=Double.valueOf(string_c).doubleValue(); if(a+b>c&&a+c>b&&b+c>a)

{double p=(a+b+c)/2.0;

double mianji=Math.sqrt(p*(p-a)*(p-b)*(p-c)); out.print(\三角形面积:\ } else

{ out.print(\您输入的三边不能构成一个三角形\ }

}

catch(NumberFormatException e)

{ out.print(\请输入数字字符\ } %> 例子8

first.jsp

<%@ page contentType=\

使用html处理所接受到的信息.

second.jsp

<%@ page contentType=\

启动MS-Word应用程序处理所接受到的信息.

例子9

example2_9.jsp

<%@ page contentType=\

<%@ include file=\

example2_10.jsp

<%@ page contentType=\

请输入一个正数,单击按钮求这个数的平方根。 <%@ include file=\ 例子11 Hello.txt

你好,祝学习进步!


学习JSP要有Java语言的基础。
要认真学习JSP的基本语法。 image.html

example2_11.jsp

<%@ page contentType=\

加载的文件 加载的图像

例子12 tom.jsp

<%@ page contentType=\

<% String str=request.getParameter(\获取值 int n=Integer.parseInt(str); int sum=0; for(int i=1;i<=n;i++) { sum=sum+i; }

%>

从1到<%=n%>的连续和是: <%=sum%>

example2_12.jsp

<%@ page contentType=\

加载文件效果:

例子13

example2_13.jsp

<%@ page contentType=\

<% double i=Math.random(); if(i>0.5) { %>

{

%>

例子14 come.jsp

<%@ page contentType=\ <% String str=request.getParameter(\ double n=Double.parseDouble(str); %>

您传过来的数值是:
<%=n%>

example2_14.jsp

<%@ page contentType=\

<% double i=Math.random();

%>

例子15

example2_15.jsp

<%@ page contentType=\

Plugin tag OBJECT or EMBED not supported by browser.

第3章 Tag文件与Tag标记 example3_1.jsp

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

<%@ taglib tagdir=\


jsp基础教程代码(第2版).doc 将本文的Word文档下载到电脑
搜索更多关于: jsp基础教程代码(第2版) 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219