各位高手,为什么以下程序总是出现这个错误:(在第11行)
The operator < is undefined for the argument type(s) boolean, boolean
是需要引入什么包,还是有什么错误啊?请大侠们帮忙,谢谢!!
<!--outtable.jsp-->
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.Date" errorPage="" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动态生成表格</title>
</head><body>
<h2>动态生成表格</h2>
<%
String s1=request.getParameter("rows");
String s2=request.getParameter("cols");
out.print("01");
int rows,cols;
if(s1 != null && s2 != null){
out.print(s1);
out.flush();
if(s1.equals("")‖s2.equals("")){
out.println("请输入行数和列数<br>");
}
else {
rows=Integer.parseInt(s1);
cols=Integer.parseInt(s2);
out.println("<table border='1'>");
out.println("<tr>");
for(int th=1;th<=cols;th++){
out.print("<th>");
out.print("标题"+th);
out.print("</th>");
}
out.println("</tr>");
for(int row=1;row<=rows;row++){
out.print("<tr>");
for(int col=1;col<=cols;col++){
out.print("<td>");
out.print(row+" "+col);
out.println("</td>");
}
out.println("</tr>");
}
out.println("</table>");
out.print(rows);
}
}
%>
<form name="form1" method="post" action="outtable.jsp">
<p>行数
<input name="rows" type="text" id="rows" >
列数
<input name="cols" type="text" id="rcols" >
<input name="Submit" type="submit" value="确定">
</p>
</form>
</body>
</html>
The operator < is undefined for the argument type(s) boolean, boolean
是需要引入什么包,还是有什么错误啊?请大侠们帮忙,谢谢!!
<!--outtable.jsp-->
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.Date" errorPage="" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动态生成表格</title>
</head><body>
<h2>动态生成表格</h2>
<%
String s1=request.getParameter("rows");
String s2=request.getParameter("cols");
out.print("01");
int rows,cols;
if(s1 != null && s2 != null){
out.print(s1);
out.flush();
if(s1.equals("")‖s2.equals("")){
out.println("请输入行数和列数<br>");
}
else {
rows=Integer.parseInt(s1);
cols=Integer.parseInt(s2);
out.println("<table border='1'>");
out.println("<tr>");
for(int th=1;th<=cols;th++){
out.print("<th>");
out.print("标题"+th);
out.print("</th>");
}
out.println("</tr>");
for(int row=1;row<=rows;row++){
out.print("<tr>");
for(int col=1;col<=cols;col++){
out.print("<td>");
out.print(row+" "+col);
out.println("</td>");
}
out.println("</tr>");
}
out.println("</table>");
out.print(rows);
}
}
%>
<form name="form1" method="post" action="outtable.jsp">
<p>行数
<input name="rows" type="text" id="rows" >
列数
<input name="cols" type="text" id="rcols" >
<input name="Submit" type="submit" value="确定">
</p>
</form>
</body>
</html>
if(s1.equals("")‖s2.equals("")){
应该是中间的||写错了。细心噢!- -!