<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴?<BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<% if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}
catch(NumberFormatExceptionexc){
out.println("<BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
}
else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print("<BR>"+answer);
}
}
%>
</body>
</html>
鎴戝湪鍦板潃鏍忚緭鍏ttp://localhost:8080/triangle.jsp 鎵ц鍚庢湁4閿?nbsp;.涓嶇煡閿欏摢閲?鏄笉鏄病璁惧ソ鐜鍙橀噺,浣嗘槸涓婚〉浼氬嚭鏉?.
涓婇潰鐨勯敊璇嗕俊鎭槸:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 29 in the jsp file: /triangle.jsp
Generated servlet error:
C:\Tomcat\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\triangle_jsp.java:82: 闇€瑕?nbsp;<鏍囪瘑绗?gt;
catch(NumberFormatExceptionexc){
^
An error occurred at line: 50 in the jsp file: /triangle.jsp
Generated servlet error:
C:\Tomcat\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\triangle_jsp.java:95: 闇€瑕?nbsp;')'
out.write("\r\n");
^
Generated servlet error:
C:\Tomcat\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\triangle_jsp.java:36: "try" 涓嶅甫鏈?nbsp;"catch" 鎴?nbsp;"finally"
try {
^
Generated servlet error:
C:\Tomcat\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\triangle_jsp.java:110: 闇€瑕?nbsp;'}'
^
4 閿欒
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
17 涓В鍐虫柟妗?/h2>
#1
鍏堝姞涓獇鍐嶈锛屼綘浠旂粏鐪嬬湅锛屾病鏈夎窡if鍖归厤鐨剗
#2
NumberFormatException exc
鏀瑰畬浜嗚繖涓叾浠栫殑閿欏簲璇ヤ篃浼氭病鏈変簡
BTW:杩欎笉鏄粈涔堥珮鎵嬮棶棰?鍐橨ava瑕佸浼氱湅閿欒淇℃伅
#3
纭疄..
#4
妤间富鐨刯sp鏄墜鍐欑殑鍚э紝寤鸿鐢ㄤ釜甯︽牸寮忓寲鐨勭紪杈戝櫒鎴栬€匢DE鍐欏惂锛屽湪閭i噷闈㈠啓鏍煎紡姣旇緝鏈変繚璇侊紝瑕佷笉jsp寰堜贡锛岃繕瀹规槗鍑洪敊
#5
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
}
%>
</body>
</html>
鐪嬬湅琛屼簡娌℃湁
#6
鍔犱簡}杩樻槸鏈夐敊鍟?.
#7
鍟婂摝锛屾墜鍐檍sp寰堝ソ锛屽彲灏辨€曞啓閿欏崟璇嶃€佸皯鍔犲ぇ鎷彿....... 鎵€浠ヨ繕鏄敤IDE鐨勫ソ
#8
鏄墜鍔ㄧ殑
#9
5妤煎お鍚婁簡...宸茬粡濂戒簡,
鎴戝埌搴曞摢閿欎簡 ..鍟?
#10
2妤煎厛鎵惧埌閿欑殑
#11
涓嶆槸璺熶綘璇撮敊璇簡涔?
#12
杈撳叆浜嗕笁杈瑰緱涓嶅埌闈㈢Н鍟? .甯垜鐪嬬湅鍟?
#13
绠椾簡,鎴戞潵瑙e喅..
#14
涓嬮潰杩欒浠g爜閿欎簡锛?
catch(NumberFormatExceptionexc){
娌℃湁鍙傛暟鍟?nbsp;
杩樻湁灏辨槸鎯虫彁閱掍竴涓媗z鍦ㄥ啓html浠g爜鐨勬椂鍊欙紝鏈€濂借繕鏄敤鏍囧噯鐨勬牸寮?nbsp;
鍏ㄩ儴鐢ㄥ皬鍐欏惂 浣犱竴浼氱敤澶у啓鐨勬爣绛?nbsp;涓€浼氬張鐢ㄥ皬鍐欑殑
鐪嬪埌寰堟槸涓嶇埥鍝?
#15
#16
浣犵殑浠g爜鐨剗鍐欑殑鏈夐棶棰?鍦╟atch璇彞閲岃〃绀哄嚭鐜板紓甯告墠浼氭墽琛岀殑浠g爜娈?鑰屼綘鎶婃暣涓绠楅潰绉殑浠g爜閮藉湀鍦ㄩ噷闈簡.
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?nbsp;
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
}
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
%>
</body>
</html>
#17
杩欓敊鎴戜篃鍙戠幇浜?浣嗚繕鏈変簺闂,
鎴戣緭鍏ヤ笁杈?,4,5 鐒跺悗灏辨槸闈㈢Н涓嶄細杈撳埌娴忚鍣ㄤ腑.鐪嬩笉鍒伴潰绉€?
#1
鍏堝姞涓獇鍐嶈锛屼綘浠旂粏鐪嬬湅锛屾病鏈夎窡if鍖归厤鐨剗
#2
NumberFormatException exc
鏀瑰畬浜嗚繖涓叾浠栫殑閿欏簲璇ヤ篃浼氭病鏈変簡
BTW:杩欎笉鏄粈涔堥珮鎵嬮棶棰?鍐橨ava瑕佸浼氱湅閿欒淇℃伅
鏀瑰畬浜嗚繖涓叾浠栫殑閿欏簲璇ヤ篃浼氭病鏈変簡
BTW:杩欎笉鏄粈涔堥珮鎵嬮棶棰?鍐橨ava瑕佸浼氱湅閿欒淇℃伅
#3
纭疄..
#4
妤间富鐨刯sp鏄墜鍐欑殑鍚э紝寤鸿鐢ㄤ釜甯︽牸寮忓寲鐨勭紪杈戝櫒鎴栬€匢DE鍐欏惂锛屽湪閭i噷闈㈠啓鏍煎紡姣旇緝鏈変繚璇侊紝瑕佷笉jsp寰堜贡锛岃繕瀹规槗鍑洪敊
#5
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
}
%>
</body>
</html>
鐪嬬湅琛屼簡娌℃湁
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
}
%>
</body>
</html>
鐪嬬湅琛屼簡娌℃湁
#6
鍔犱簡}杩樻槸鏈夐敊鍟?.
#7
鍟婂摝锛屾墜鍐檍sp寰堝ソ锛屽彲灏辨€曞啓閿欏崟璇嶃€佸皯鍔犲ぇ鎷彿....... 鎵€浠ヨ繕鏄敤IDE鐨勫ソ
#8
鏄墜鍔ㄧ殑
#9
5妤煎お鍚婁簡...宸茬粡濂戒簡,
鎴戝埌搴曞摢閿欎簡 ..鍟?
鎴戝埌搴曞摢閿欎簡 ..鍟?
#10
2妤煎厛鎵惧埌閿欑殑
#11
涓嶆槸璺熶綘璇撮敊璇簡涔?
#12
杈撳叆浜嗕笁杈瑰緱涓嶅埌闈㈢Н鍟? .甯垜鐪嬬湅鍟?
#13
绠椾簡,鎴戞潵瑙e喅..
#14
涓嬮潰杩欒浠g爜閿欎簡锛?
catch(NumberFormatExceptionexc){
娌℃湁鍙傛暟鍟?nbsp;
杩樻湁灏辨槸鎯虫彁閱掍竴涓媗z鍦ㄥ啓html浠g爜鐨勬椂鍊欙紝鏈€濂借繕鏄敤鏍囧噯鐨勬牸寮?nbsp;
鍏ㄩ儴鐢ㄥ皬鍐欏惂 浣犱竴浼氱敤澶у啓鐨勬爣绛?nbsp;涓€浼氬張鐢ㄥ皬鍐欑殑
鐪嬪埌寰堟槸涓嶇埥鍝?
catch(NumberFormatExceptionexc){
娌℃湁鍙傛暟鍟?nbsp;
杩樻湁灏辨槸鎯虫彁閱掍竴涓媗z鍦ㄥ啓html浠g爜鐨勬椂鍊欙紝鏈€濂借繕鏄敤鏍囧噯鐨勬牸寮?nbsp;
鍏ㄩ儴鐢ㄥ皬鍐欏惂 浣犱竴浼氱敤澶у啓鐨勬爣绛?nbsp;涓€浼氬張鐢ㄥ皬鍐欑殑
鐪嬪埌寰堟槸涓嶇埥鍝?
#15
#16
浣犵殑浠g爜鐨剗鍐欑殑鏈夐棶棰?鍦╟atch璇彞閲岃〃绀哄嚭鐜板紓甯告墠浼氭墽琛岀殑浠g爜娈?鑰屼綘鎶婃暣涓绠楅潰绉殑浠g爜閮藉湀鍦ㄩ噷闈簡.
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?nbsp;
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
}
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
%>
</body>
</html>
#17
杩欓敊鎴戜篃鍙戠幇浜?浣嗚繕鏈変簺闂,
鎴戣緭鍏ヤ笁杈?,4,5 鐒跺悗灏辨槸闈㈢Н涓嶄細杈撳埌娴忚鍣ㄤ腑.鐪嬩笉鍒伴潰绉€?
鎴戣緭鍏ヤ笁杈?,4,5 鐒跺悗灏辨槸闈㈢Н涓嶄細杈撳埌娴忚鍣ㄤ腑.鐪嬩笉鍒伴潰绉€?
#1
鍏堝姞涓獇鍐嶈锛屼綘浠旂粏鐪嬬湅锛屾病鏈夎窡if鍖归厤鐨剗
#2
NumberFormatException exc
鏀瑰畬浜嗚繖涓叾浠栫殑閿欏簲璇ヤ篃浼氭病鏈変簡
BTW:杩欎笉鏄粈涔堥珮鎵嬮棶棰?鍐橨ava瑕佸浼氱湅閿欒淇℃伅
鏀瑰畬浜嗚繖涓叾浠栫殑閿欏簲璇ヤ篃浼氭病鏈変簡
BTW:杩欎笉鏄粈涔堥珮鎵嬮棶棰?鍐橨ava瑕佸浼氱湅閿欒淇℃伅
#3
纭疄..
#4
妤间富鐨刯sp鏄墜鍐欑殑鍚э紝寤鸿鐢ㄤ釜甯︽牸寮忓寲鐨勭紪杈戝櫒鎴栬€匢DE鍐欏惂锛屽湪閭i噷闈㈠啓鏍煎紡姣旇緝鏈変繚璇侊紝瑕佷笉jsp寰堜贡锛岃繕瀹规槗鍑洪敊
#5
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
}
%>
</body>
</html>
鐪嬬湅琛屼簡娌℃湁
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
}
%>
</body>
</html>
鐪嬬湅琛屼簡娌℃湁
#6
鍔犱簡}杩樻槸鏈夐敊鍟?.
#7
鍟婂摝锛屾墜鍐檍sp寰堝ソ锛屽彲灏辨€曞啓閿欏崟璇嶃€佸皯鍔犲ぇ鎷彿....... 鎵€浠ヨ繕鏄敤IDE鐨勫ソ
#8
鏄墜鍔ㄧ殑
#9
5妤煎お鍚婁簡...宸茬粡濂戒簡,
鎴戝埌搴曞摢閿欎簡 ..鍟?
鎴戝埌搴曞摢閿欎簡 ..鍟?
#10
2妤煎厛鎵惧埌閿欑殑
#11
涓嶆槸璺熶綘璇撮敊璇簡涔?
#12
杈撳叆浜嗕笁杈瑰緱涓嶅埌闈㈢Н鍟? .甯垜鐪嬬湅鍟?
#13
绠椾簡,鎴戞潵瑙e喅..
#14
涓嬮潰杩欒浠g爜閿欎簡锛?
catch(NumberFormatExceptionexc){
娌℃湁鍙傛暟鍟?nbsp;
杩樻湁灏辨槸鎯虫彁閱掍竴涓媗z鍦ㄥ啓html浠g爜鐨勬椂鍊欙紝鏈€濂借繕鏄敤鏍囧噯鐨勬牸寮?nbsp;
鍏ㄩ儴鐢ㄥ皬鍐欏惂 浣犱竴浼氱敤澶у啓鐨勬爣绛?nbsp;涓€浼氬張鐢ㄥ皬鍐欑殑
鐪嬪埌寰堟槸涓嶇埥鍝?
catch(NumberFormatExceptionexc){
娌℃湁鍙傛暟鍟?nbsp;
杩樻湁灏辨槸鎯虫彁閱掍竴涓媗z鍦ㄥ啓html浠g爜鐨勬椂鍊欙紝鏈€濂借繕鏄敤鏍囧噯鐨勬牸寮?nbsp;
鍏ㄩ儴鐢ㄥ皬鍐欏惂 浣犱竴浼氱敤澶у啓鐨勬爣绛?nbsp;涓€浼氬張鐢ㄥ皬鍐欑殑
鐪嬪埌寰堟槸涓嶇埥鍝?
#15
#16
浣犵殑浠g爜鐨剗鍐欑殑鏈夐棶棰?鍦╟atch璇彞閲岃〃绀哄嚭鐜板紓甯告墠浼氭墽琛岀殑浠g爜娈?鑰屼綘鎶婃暣涓绠楅潰绉殑浠g爜閮藉湀鍦ㄩ噷闈簡.
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>璁$畻涓夎褰㈤潰绉?nbsp;
</title>
</head>
<body>
<P>璇疯緭鍏ヤ笁涓竟鐨勯暱搴? <BR>
<FORM NAME="form" Method="get" action="triangle.jsp">
<p>
<InPut type="text" name="num1">
</p>
<p>
<input type="text" name="num2">
</p>
<p>
<input type="text" name="num3">
</p>
<p>
<input type="submit" value="璁$畻">
</p>
</FORM>
<%! double a,b,c;
String strA,strB,strC;
String answer;
double result;
%>
<%
if(request.getParameter("submit")!=null){
strA=request.getParameter("numl");
strB=request.getParameter("num2");
strC=request.getParameter("num3");
try{
a=Double.valueOf(strA);
b=Double.valueOf(strB);
c=Double.valueOf(strC);
}catch(NumberFormatException exc){
out.println(" <BR>"+"璇疯緭鍏ユ暟瀛楀瓧绗?);
}
if((a+b)>c&&(a+c)>b&&(b+c)>a){
double p=(a+b+c)/2;
result=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("闈㈢Н涓?"+result);
} else{
answer="鎮ㄨ緭鍏ョ殑涓夎竟涓嶈兘澶熸垚涓夎褰?;
out.print(" <BR>"+answer);
}
}
%>
</body>
</html>
#17
杩欓敊鎴戜篃鍙戠幇浜?浣嗚繕鏈変簺闂,
鎴戣緭鍏ヤ笁杈?,4,5 鐒跺悗灏辨槸闈㈢Н涓嶄細杈撳埌娴忚鍣ㄤ腑.鐪嬩笉鍒伴潰绉€?
鎴戣緭鍏ヤ笁杈?,4,5 鐒跺悗灏辨槸闈㈢Н涓嶄細杈撳埌娴忚鍣ㄤ腑.鐪嬩笉鍒伴潰绉€?