jsp中关于字符类型转换计算的问题请教
俺是个新手,想学习学习JSP编程,在学习过程中遇到问题,请各位大侠帮帮俺,看看以下的语句问题出在哪里?<%
String s=(String)session.getAttribute("txtRmbxx");假设txtRmbxx=1230.80
String k=(String)session.getAttribute("hw_zsl");假设hw_zsl=0.3
Float w=Float.parseFloat(k);
out.println(Double.parseDouble(s)/(1+Float.parseFloat(k)));
out.println(Float.parseFloat(s)/(1+Float.parseFloat(k)));
out.println(Float.parseFloat(s)/(1+Float.parseFloat(k))*Float.parseFloat(k));
%>
运行后出现以下提示:
Full compiler error(s):
d:\bea\user_projects\domains\dkfp\.\myserver\.wlnotdelete\extract\myserver_DefaultWebApp_DefaultWebApp\jsp_servlet\__cs.java:133: incompatible types
found : float
required: java.lang.Float
Float w=Float.parseFloat(k); //[ /cs.jsp; Line: 9]
^
1 error