jsp中cannot be resolved 什么意思

An error occurred at line: 10 in the jsp file: /printTable.jsp
col cannot be resolved
7: %>
8: <tr>
9: <%
10: for(int j=0;j<col;j++){
11: %>
12: <td><%=i*j%></td>
13: <%
具体程序是这样的
<%
int row=Integer.parseInt(request.getParameter("row"));
int clo=Integer.parseInt(request.getParameter("col"));
%>
<%
for(int i=0;i<row;i++){
%>
<tr>
<%
for(int j=0;j<col;j++){
%>
<td><%=i*j%></td>
<%
}
%>
</tr>
<%
}
%>

意思就是编译器无法识别变量,解决思路:
1、可以先查找是从哪里来的,是方法的参数,还是成员变量局部变量或者Jsp中的页面内置对象。
2、之后看看是否有那块的命名不规范,或者还有错误信息,这个只能是根据实际情况来进行问题分析。
比如:
<form method="POST" action="login.jsp">
<%
//是否登陆
String usr=(String)session.getValue("user_name");
if(usr!=null && !usr.equals(""))
{
String name=(String)session.getAttribute("user_name");
String sql="select * from member where user_name='"+name+"'";
//ResultSet rs=null;
rs=stmt.executeQuery(sql);
if(rs.next()){
%>
温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2018-03-08
col 未在上下文中定义,你页面上没有col 的定义吧?例如int col =***
int clo=Integer.parseInt(request.getParameter("col"));
for(int j=0;j<col;j++)
clo和col本回答被提问者和网友采纳
第2个回答  2018-06-28
应该是这个标签无法识别,有可能是字母拼写错误了,仔细检查一下。
相似回答