| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 691 人关注过本帖
标题:[求助]求三角形面积报错
只看楼主 加入收藏
月无影
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2007-7-20
收藏
 问题点数:0 回复次数:0 
[求助]求三角形面积报错

报错为
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.NullPointerException
sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
java.lang.Double.parseDouble(Unknown Source)
org.apache.jsp.triangle_jsp._jspService(triangle_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.

源代码为

<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import ="java.math.*" %>
<%@ page import="javax.servlet.http.*"%>
<%@ page import="javax.servlet.*"%>
<HTML>
<BODY>
<body bgcolor=fadded text=6f7a83 >
<P> <center><font size=5><b>在下面的表格输入三角形三边:</font></center>
<FORM action="triangle.jsp" method=post name=form>
<Table align="CENTER" >
<font size=3>
<TR>
<TH width=60> 第一边</TH>
<TH width=60> 第二边</TH>
<TH width=60> 第三边</TH>
</TR></font>
<%
out.print("<TR>");
out.print("<TD>");
out.print("<INPUT type=text name=first value=0>");
out.print("</TD>");
out.print("<TD>");
out.print("<INPUT type=text name=second value=0>");
out.print("</TD>");
out.print("<TD>");
out.print("<INPUT type=text name=third value=0>");
out.print("</TD>");
out.print("</TR>");

%>
</Table>
<INPUT type=submit name="g" value="提交" >
</FORM>
<%
String fi=request.getParameter("first");
String se=request.getParameter("second");
String th=request.getParameter("third");
Double a=Double.parseDouble(fi);
Double b=Double.parseDouble(se);
Double c=Double.parseDouble(th);
Double p;
p=(a+b+c)/2;
double s,len;
len=a+b+c;
s=Math.sqrt(p*(p-a)*(p-b)*(p-c));
%>
<Font size=4 color=Purple>
<center>
<b>
<P><BR>查看周长:
<%=len%><br>
<P><BR>查看面积:
<%=s%>
</b>
</center>
</Font>
</BODY>
</HTML>
搜索更多相关主题的帖子: 三角形 面积 
2007-07-22 07:08
快速回复:[求助]求三角形面积报错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015637 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved