帮我看看这是什么错?

golice 2004-10-29 11:16:48
出错信息:
java.lang.NumberFormatException: For input string: "add"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
at java.lang.Double.parseDouble(Double.java:482)
at _jsp._en._agent._cus_0credit_0modify__jsp._jspService(/en/agent/cus_credit_modify.jsp:25)
at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
at com.caucho.jsp.Page.pageservice(Page.java:557)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:141)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:207)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:249)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:327)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:450)
at com.caucho.util.ThreadPool.run(ThreadPool.java:394)
at java.lang.Thread.run(Thread.java:595)

源代码:
<%@page contentType="text/html; charset=utf-8"%>
<%@page import="cn.epic.epicRM.*,java.sql.*" %>
<%@page pageEncoding="UTF-8"%>
<%@ include file = "checkname.jsp"%>

<%
String username;
dbUsers user;
String type;
double creditcap = -1;
double increase, decrease;


user = new dbUsers();
java.sql.ResultSet rs = null;
user.getConn();
username = request.getParameter("username");
rs = user.filter(" where username ='"+username+"'");
while(rs.next()){
creditcap = rs.getDouble("creditcap");
}
user.endFilter();
out.println("creditcap");
type = request.getParameter("type");
double type1 = Double.parseDouble(type);
if(user.lookup(username) == true) {
if("add".equals(type)) {
if(type1 > creditcap){
out.println("<Script language=JavaScript>alert('error!');JavaScript:history.back();</Script>");
}
increase = Double.parseDouble(request.getParameter("increase"));
user.setCreditcap(user.getCreditcap() + increase);
}
else if("sub".equals(type)) {
decrease = Double.parseDouble(request.getParameter("decrease"));
user.setCreditcap(user.getCreditcap() - decrease);
}
user.update();
} else {
response.sendRedirect("/error.jsp");
}
%>

<html>
<head><title></title></head>
<body onload='opener.location.href("custom_info_in.jsp");window.close()'>

<%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>

</body>
</html>

...全文
56 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
0242891 2004-10-29
if("add".equals(type)) {
而且最好不要这样去比,是字符串比较的话为何不用 if(type.equalsIgnoreCase("aa"))
回复
playgb 2004-10-29
这两行一定有一行出错了。
double type1 = Double.parseDouble(type);
decrease = Double.parseDouble(request.getParameter("decrease"));
回复
hai3qing 2004-10-29
就是上面所说的,不过没找到在那
回复
umbrella1984 2004-10-29
类型转换的问题
java.lang.NumberFormatException: For input string: "add"
不能把add转成数字类型
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告