楼上没明白我意思。比如说DIM 用INT ,RESPONSE 用<%=%>,其它SET ,CONN都用什么代替。
解决方案 »
- 关于操作日志记录的问题
- 小女子有一事相求,关于struts2配置问题,我看书弄得,可以使运行不出来,包也弄好了,
- 这个java正则表达式\bint\b\\s*[i|j|k]\\s*[=]\\s*[0]\\s*[;]匹配int i = 0;有问题吗?
- jsp页面上识别汉字形式传参和下载中文名文件不能同时实现吗?
- 关于国际化的问题,急~~
- 提供JSP基于jsp+javabean的中型论坛网站下载
- 请教关于查询的问题!很急!
- 一个非常奇怪的的问题
- 关于stmt.close(); 后stmt = null;的问题???(心情不好--送分)
- 国内是否有支持jsp的主机(免费主页空间or 收费均可),请告知
- 求助<jsp:plugin />的问题
- 如何让一个东西在整个会话期间存在????????
PreparedStatement prpst=null;
ResultSet rs=null;
Class.forName("adodb.connection");
conn=DriverManager.getConnection("这里的url你参考一下SQLOLEDB文档的格式","sa","123456");
String sql="select sum(姓数字) as 姓数字,sum(名数字) as 名数字 from (select '姓数字'=数字, '名数字 '=0 from name.dbo.table1 WHERE 汉字 = '"+textXing+"' UNION select '姓数字'=0, '名数字'= 数字 from name.dbo.table1 WHERE 汉字='"+textMing+"' )aa";
prpst=conn.prepareStatement(sql);
rs=prpst.executeQuery();
if(rs.next()){
Dim d=new Dim();
d.setNumberOfXing(rs.getString(1));
d.setNumberOfMing(rs.getString(2));
response.getWriter().writer(d);
}
conn.close();
prpst.close();
rs.close();
ssage Unable to compile class for JSP:description The server encountered an internal error that prevented it from fulfilling this request.exceptionorg.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 16 in the jsp file: /csdnhelp.jsp
Connection cannot be resolved to a type
13: String textXing="张";
14: String textMing="秋";
15:
16: Connection conn=null;
17: PreparedStatement prpst=null;
18: ResultSet rs=null;
19: Class.forName("adodb.connection");
An error occurred at line: 17 in the jsp file: /csdnhelp.jsp
PreparedStatement cannot be resolved to a type
14: String textMing="秋";
15:
16: Connection conn=null;
17: PreparedStatement prpst=null;
18: ResultSet rs=null;
19: Class.forName("adodb.connection");
20: conn=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;","sa","105936");
An error occurred at line: 18 in the jsp file: /csdnhelp.jsp
ResultSet cannot be resolved to a type
15:
16: Connection conn=null;
17: PreparedStatement prpst=null;
18: ResultSet rs=null;
19: Class.forName("adodb.connection");
20: conn=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;","sa","105936");
21: String sql="select sum(姓数字) as 姓数字,sum(名数字) as 名数字 from (select '姓数字'=数字, '名数字 '=0 from name.dbo.table1 WHERE 汉字 = '"+textXing+"' UNION select '姓数字'=0, '名数字'= 数字 from name.dbo.table1 WHERE 汉字='"+textMing+"' )aa";
An error occurred at line: 20 in the jsp file: /csdnhelp.jsp
DriverManager cannot be resolved
17: PreparedStatement prpst=null;
18: ResultSet rs=null;
19: Class.forName("adodb.connection");
20: conn=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;","sa","105936");
21: String sql="select sum(姓数字) as 姓数字,sum(名数字) as 名数字 from (select '姓数字'=数字, '名数字 '=0 from name.dbo.table1 WHERE 汉字 = '"+textXing+"' UNION select '姓数字'=0, '名数字'= 数字 from name.dbo.table1 WHERE 汉字='"+textMing+"' )aa";
22: prpst=conn.prepareStatement(sql);
23: rs=prpst.executeQuery();
An error occurred at line: 25 in the jsp file: /csdnhelp.jsp
Dim cannot be resolved to a type
22: prpst=conn.prepareStatement(sql);
23: rs=prpst.executeQuery();
24: if(rs.next()){
25: Dim d=new Dim();
26: d.setNumberOfXing(rs.getString(1));
27: d.setNumberOfMing(rs.getString(2));
28: response.getWriter().writer(d);
An error occurred at line: 25 in the jsp file: /csdnhelp.jsp
Dim cannot be resolved to a type
22: prpst=conn.prepareStatement(sql);
23: rs=prpst.executeQuery();
24: if(rs.next()){
25: Dim d=new Dim();
26: d.setNumberOfXing(rs.getString(1));
27: d.setNumberOfMing(rs.getString(2));
28: response.getWriter().writer(d);
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.5 logs.
escription The server encountered an internal error that prevented it from fulfilling this request.exceptionorg.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 33 in the jsp file: /buffer.jsp
The method parseInt(String, int) is undefined for the type buffer_jsp
30: ResultSet rs=stmt.executeQuery(sql);
31:
32:
33: out.print(parseInt(rs.getString("数字"),10));
34:
35:
36:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.5 logs.Apache Tomcat/8.0.5
1.你在JSP页面没有导包。在页面最上面加上<%@page import="java.sql.*"%>
2.Dim是你自己的对象啊,你也要把那个类import到你的jsp页面。
包导入了啊。就是取不了rs中的整型值。不知道怎么回事
rs.getInt rs.getString
要么你就按索引去,不过还是要清楚类型,不然你接收类型不对还是会报错。