jsp代码问题(急!)
以下是我jsp网站中一个网页copy.jsp的代码:<hrcolor="#FEA5FE"width="778"size="1"><divalign="center"><c...
以下是我jsp网站中一个网页copy.jsp的代码:
<hr color="#FEA5FE" width="778" size="1">
<div align="center">
<center>
<table hwidth=778 border=0 width="778" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr bgcolor=#ff0000>
<td colspan=2 bgcolor="#FEA5FE">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table style="BORDER-COLLAPSE: collapse" cellspacing=0
cellpadding=0 width=778 border=0>
<tr>
<script src="#"></script>
<%
sql="select * from system";
rs=mdb.executeQuery(sql);
if(rs.next())
{
%>
<td width=758 height=25 bgcolor="#FFE1FF" > <p align=center><font face="宋体">©</font>Copyright2003
<%=rs.getString("web")%> All Rights Reserved <br>
客户服务中心信箱:<%=rs.getString("mail")%> 热线直拨:<%=rs.getString("tel")%>
公司地址:<%=rs.getString("ymaddr")%> 邮编:<%=rs.getString("code")%><br><%=rs.getString("support")%></td></tr>
</table>
</center>
</div>
<%
}
rs.close();
mdb.Close();
%>
网站的主页index.jsp调用copy.jsp,但调用后在主页中出现乱码的情况。单独运行copy.jsp出现报错:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:66: cannot resolve symbol
symbol : variable sql
location: class org.apache.jsp.copy_jsp
sql="select * from system";
^
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:67: cannot resolve symbol
symbol : variable rs
location: class org.apache.jsp.copy_jsp
rs=mdb.executeQuery(sql);
^
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:67: cannot resolve symbol
symbol : variable sql
location: class org.apache.jsp.copy_jsp
rs=mdb.executeQuery(sql);
^
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:67: cannot resolve symbol
symbol : variable mdb
location: class org.apache.jsp.copy_jsp
rs=mdb.executeQuery(sql);
^
还有几个报错不一一显示,都是类似的错误。
随后我对copy.jsp中rs和sql进行了定义ResultSet rs,String sql相应的报错没了,但主页反而运行出现了报错。
本人调试了好久都不知道怎么解决,请大家帮帮忙,很急啊! 展开
<hr color="#FEA5FE" width="778" size="1">
<div align="center">
<center>
<table hwidth=778 border=0 width="778" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr bgcolor=#ff0000>
<td colspan=2 bgcolor="#FEA5FE">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table style="BORDER-COLLAPSE: collapse" cellspacing=0
cellpadding=0 width=778 border=0>
<tr>
<script src="#"></script>
<%
sql="select * from system";
rs=mdb.executeQuery(sql);
if(rs.next())
{
%>
<td width=758 height=25 bgcolor="#FFE1FF" > <p align=center><font face="宋体">©</font>Copyright2003
<%=rs.getString("web")%> All Rights Reserved <br>
客户服务中心信箱:<%=rs.getString("mail")%> 热线直拨:<%=rs.getString("tel")%>
公司地址:<%=rs.getString("ymaddr")%> 邮编:<%=rs.getString("code")%><br><%=rs.getString("support")%></td></tr>
</table>
</center>
</div>
<%
}
rs.close();
mdb.Close();
%>
网站的主页index.jsp调用copy.jsp,但调用后在主页中出现乱码的情况。单独运行copy.jsp出现报错:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:66: cannot resolve symbol
symbol : variable sql
location: class org.apache.jsp.copy_jsp
sql="select * from system";
^
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:67: cannot resolve symbol
symbol : variable rs
location: class org.apache.jsp.copy_jsp
rs=mdb.executeQuery(sql);
^
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:67: cannot resolve symbol
symbol : variable sql
location: class org.apache.jsp.copy_jsp
rs=mdb.executeQuery(sql);
^
An error occurred at line: 24 in the jsp file: /copy.jsp
Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\site\org\apache\jsp\copy_jsp.java:67: cannot resolve symbol
symbol : variable mdb
location: class org.apache.jsp.copy_jsp
rs=mdb.executeQuery(sql);
^
还有几个报错不一一显示,都是类似的错误。
随后我对copy.jsp中rs和sql进行了定义ResultSet rs,String sql相应的报错没了,但主页反而运行出现了报错。
本人调试了好久都不知道怎么解决,请大家帮帮忙,很急啊! 展开
4个回答
展开全部
<%
String sql="select * from system";
Resultset rs=mdb.executeQuery(sql);
if(rs.next())
{
%>
<td width=758 height=25 bgcolor="#FFE1FF" > <p align=center><font face="宋体">©</font>Copyright2003
<%=rs.getString("web")%> All Rights Reserved <br>
客户服务中心信箱:<%=rs.getString("mail")%> 热线直拨:<%=rs.getString("tel")%>
公司地址:<%=rs.getString("ymaddr")%> 邮编:<%=rs.getString("code")%><br><%=rs.getString("support")%></td></tr>
</table>
</center>
</div>
<%
}
rs.close();
mdb.Close();
%>
??:你的连接数据库类没问题吧!
String sql="select * from system";
Resultset rs=mdb.executeQuery(sql);
if(rs.next())
{
%>
<td width=758 height=25 bgcolor="#FFE1FF" > <p align=center><font face="宋体">©</font>Copyright2003
<%=rs.getString("web")%> All Rights Reserved <br>
客户服务中心信箱:<%=rs.getString("mail")%> 热线直拨:<%=rs.getString("tel")%>
公司地址:<%=rs.getString("ymaddr")%> 邮编:<%=rs.getString("code")%><br><%=rs.getString("support")%></td></tr>
</table>
</center>
</div>
<%
}
rs.close();
mdb.Close();
%>
??:你的连接数据库类没问题吧!
展开全部
sql="select * from system";
system是数据库里的保留字吧? sql="select * from [system]";
rs=mdb.executeQuery(sql);
rs定义了没? RecordSet rs = null;
system是数据库里的保留字吧? sql="select * from [system]";
rs=mdb.executeQuery(sql);
rs定义了没? RecordSet rs = null;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
String sql="select * from system";
ResultSet rs=mdb.executeQuery(sql);
ResultSet rs=mdb.executeQuery(sql);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
变量都没有定义怎么能直接拿来用呢。
你先在jsp中定义一个
String sql="";
再定义:
ResultSet rs=null;
你先在jsp中定义一个
String sql="";
再定义:
ResultSet rs=null;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询