在我的jsp中有如下程序:
<%!public String sqlQuery(String num) {
Connection conn = null;
String connStr;
String content;
try {
connStr="jdbc:microsoft:sqlserver://10.1.72.15:1433;DatabaseName=test";
DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
conn = DriverManager.getConnection(connStr,"sa", "");
PreparedStatement st = conn.prepareStatement("select * from NEIKON_NEWS where id=?");
st.setString(1, num);
ResultSet rs=st.executeQuery();
Array ry=rs.getArray(6);
List ls=(List)ry.getArray();
content=(String)ls.get(0);
conn.close();
return content;
}catch(SQLException ex) {
System.out.println("Error in Connecting to the Database "+'\n'+ex.toString());
}
} %>
<%
String id=request.getParameter("id");
String context=sqlQuery(id);
FCKeditor oFCKeditor;
oFCKeditor = new FCKeditor(request,"content");
oFCKeditor.setBasePath("../../FCKeditor/");
oFCKeditor.setHeight("500");
//oFCKeditor.setWidth("500");
oFCKeditor.setValue("context");
out.print(oFCKeditor.create());
%>
应该导入的包已经导入了.但是运行时仍然出现 missing return statement错误.
是不是我的程序哪块有问题,希望再次得到高手们的指点.
<%!public String sqlQuery(String num) {
Connection conn = null;
String connStr;
String content;
try {
connStr="jdbc:microsoft:sqlserver://10.1.72.15:1433;DatabaseName=test";
DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
conn = DriverManager.getConnection(connStr,"sa", "");
PreparedStatement st = conn.prepareStatement("select * from NEIKON_NEWS where id=?");
st.setString(1, num);
ResultSet rs=st.executeQuery();
Array ry=rs.getArray(6);
List ls=(List)ry.getArray();
content=(String)ls.get(0);
conn.close();
return content;
}catch(SQLException ex) {
System.out.println("Error in Connecting to the Database "+'\n'+ex.toString());
}
} %>
<%
String id=request.getParameter("id");
String context=sqlQuery(id);
FCKeditor oFCKeditor;
oFCKeditor = new FCKeditor(request,"content");
oFCKeditor.setBasePath("../../FCKeditor/");
oFCKeditor.setHeight("500");
//oFCKeditor.setWidth("500");
oFCKeditor.setValue("context");
out.print(oFCKeditor.create());
%>
应该导入的包已经导入了.但是运行时仍然出现 missing return statement错误.
是不是我的程序哪块有问题,希望再次得到高手们的指点.
解决方案 »
- JS中window.onload=function()冲突的问题
- 求助JS正则表达式
- 关于struts的基本问题(No getter method for property)
- 项目部署时build-impl.xml的报错
- log4j在Web中的应用.
- 请教:如何把.class文件反编译成.java 经修改后再编译成.class?
- 插入数据库是乱码?
- java.sql.Date问题
- 请教clob问题
- 请问,如何在网页上生成组织结构图?给点建议。
- 关于HTML页面内容的提取,求高手指明!
- jsp文件中通过流的方式实现文件下载,直接通过tomcat的8080端口可以正常完成,但是如果tomcat和iis集成后,直接通过iis的80端口,下载的过程始终无法正常结束
Unsupported Method:ResultSet.getArray
http://www.java2000.net/download/sqljdbc.jar
ORhttp://www.microsoft.com/downloads/details.aspx?FamilyID=E22BC83B-32FF-4474-A44A-22B6AE2C4E17&displaylang=zh-cn
相关代码改成下面这样就ok了.
ResultSet rs=st.executeQuery();
if(rs.next())
content=rs.getString("content");
conn.close();
return content;