<%@page contentType="text/html;charset=GB2312" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isErrorPage="true"%>
<form name="form1" action="" method="post">
<br>
<br>
<input type="text" name="Vals">
<input type="text" name="Amount">
<input type="submit" name="submit" value="Enter">
</form>
<%
if(request.getParameter("Vals")!=null && request.getParameter("Amount")!=null)
{
int intLocal_Vals = Integer.parseInt(request.getParameter("Vals"));
int intLocal_Amount = Integer.parseInt(request.getParameter("Amount"));
string bt=(request.getparameter("submit"));
//下面进行位移操作
out.print("intLocal_Vals:="+intLocal_Vals);
out.print("intLocal_Vals:="+intLocal_Amount);
}else{
out.print("位移值或位移量不能为空!");
}
%>
为什么多加了 string bt=(request.getparameter("submit")); 这句话就报错了。
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 16 in the jsp file: /displace.jsp
string cannot be resolved to a type
13: {
14: int intLocal_Vals = Integer.parseInt(request.getParameter("Vals"));
15: int intLocal_Amount = Integer.parseInt(request.getParameter("Amount"));
16: string bt=(request.getparameter("submit"));
17: //下面进行位移操作
18: out.print("intLocal_Vals:="+intLocal_Vals);
19: out.print("intLocal_Vals:="+intLocal_Amount);
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isErrorPage="true"%>
<form name="form1" action="" method="post">
<br>
<br>
<input type="text" name="Vals">
<input type="text" name="Amount">
<input type="submit" name="submit" value="Enter">
</form>
<%
if(request.getParameter("Vals")!=null && request.getParameter("Amount")!=null)
{
int intLocal_Vals = Integer.parseInt(request.getParameter("Vals"));
int intLocal_Amount = Integer.parseInt(request.getParameter("Amount"));
string bt=(request.getparameter("submit"));
//下面进行位移操作
out.print("intLocal_Vals:="+intLocal_Vals);
out.print("intLocal_Vals:="+intLocal_Amount);
}else{
out.print("位移值或位移量不能为空!");
}
%>
为什么多加了 string bt=(request.getparameter("submit")); 这句话就报错了。
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 16 in the jsp file: /displace.jsp
string cannot be resolved to a type
13: {
14: int intLocal_Vals = Integer.parseInt(request.getParameter("Vals"));
15: int intLocal_Amount = Integer.parseInt(request.getParameter("Amount"));
16: string bt=(request.getparameter("submit"));
17: //下面进行位移操作
18: out.print("intLocal_Vals:="+intLocal_Vals);
19: out.print("intLocal_Vals:="+intLocal_Amount);
你这里的submit只是按钮,在提交的Form里面是不会有值的string bt=(request.getparameter("submit"))肯定是会报错
改成
getParameter大小写
为什么多加了 string bt=(request.getparameter("submit")); 这句话就报错了。
这里你req.getParameter("submit"); 注意大小写。
String
一句话2个错误,应该改成:
String bt=(request.getParameter("submit"));