主题:向高手们求救!!一个合并后程序的问题
本人遍了一个计算器程序,如下:
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.io.*"%>
<html>
<body >
<form action="23.jsp" method=post name=form>
<input type="text" name="rt">
<select name ="boy">
<option value=1>+
<option value=2>-
<option value=3>*
<option value=4>/
</select>
<INPUT type="text" name="ne">
<input type="submit" value="送出" name="submit">
</form>
</body>
</html>
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.io.*"%>
<html>
<body ><font>
<%
long sum=0;
String y=request.getParameter("boy");
String i=request.getParameter("rt");
String j=request.getParameter("ne");
int n=Integer.parseInt(i);
int m=Integer.parseInt(j);
int t=Integer.parseInt(y);
if(t==1)
{
sum=n+m;
}
else if(t==2)
{
sum=n-m;
}
else if(t==3)
{
sum=n*m;
}
else
{
sum=n/m;
}
%>
<p>结果是: <%=sum%>
</font>
</body>
</html>
调试后可以运行,我把它们合并后,如下:
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<body>
<form action="22.jsp" method="post" name="form">
<input type="text" name="rt">
<select name ="boy">
<option value=1>+
<option value=2>-
<option value=3>*
<option value=4>/
</select>
<INPUT type="text" name="ne">
<INPUT type="submit" value="送出" name="submit">
</form>
<%
long sum=0;
String y=request.getParameter("boy");
String i=request.getParameter("rt");
String j=request.getParameter("ne");
int n=Integer.parseInt(i);
int m=Integer.parseInt(j);
int t=Integer.parseInt(y);
if(t==1)
{
sum=n+m;
}
else if(t==2)
{
sum=n-m;
}
else if(t==3)
{
sum=n*m;
}
else
{
sum=n/m;
}
%>
<%=sum%>
</body>
</html>
却显示出错,请教高手们,这个程序怎么错了?错在那?
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.io.*"%>
<html>
<body >
<form action="23.jsp" method=post name=form>
<input type="text" name="rt">
<select name ="boy">
<option value=1>+
<option value=2>-
<option value=3>*
<option value=4>/
</select>
<INPUT type="text" name="ne">
<input type="submit" value="送出" name="submit">
</form>
</body>
</html>
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.io.*"%>
<html>
<body ><font>
<%
long sum=0;
String y=request.getParameter("boy");
String i=request.getParameter("rt");
String j=request.getParameter("ne");
int n=Integer.parseInt(i);
int m=Integer.parseInt(j);
int t=Integer.parseInt(y);
if(t==1)
{
sum=n+m;
}
else if(t==2)
{
sum=n-m;
}
else if(t==3)
{
sum=n*m;
}
else
{
sum=n/m;
}
%>
<p>结果是: <%=sum%>
</font>
</body>
</html>
调试后可以运行,我把它们合并后,如下:
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<body>
<form action="22.jsp" method="post" name="form">
<input type="text" name="rt">
<select name ="boy">
<option value=1>+
<option value=2>-
<option value=3>*
<option value=4>/
</select>
<INPUT type="text" name="ne">
<INPUT type="submit" value="送出" name="submit">
</form>
<%
long sum=0;
String y=request.getParameter("boy");
String i=request.getParameter("rt");
String j=request.getParameter("ne");
int n=Integer.parseInt(i);
int m=Integer.parseInt(j);
int t=Integer.parseInt(y);
if(t==1)
{
sum=n+m;
}
else if(t==2)
{
sum=n-m;
}
else if(t==3)
{
sum=n*m;
}
else
{
sum=n/m;
}
%>
<%=sum%>
</body>
</html>
却显示出错,请教高手们,这个程序怎么错了?错在那?