JSP出现下载... :( 在线等待.. 运行JSP需要专门的服务器容器比如resion,tomcat,jrun 直接用IE是打不开的。就回出现下载对话框 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 晕,我肯定是用了专门的服务器撒.TOMCAT4.1+jdk1.4POST表单数据给目标页面时,居然提示下载.直接用IE打开,也可以看到运行的结果,不过有时候这个结果和期望的有差别.为什么啊... :( 先测试tomcat是好使的吗?你没有改端口的话先试一下:http://localhost:8080/如果有欢迎画面的话就证明问题不是出在tomcat上了,最基本的完了后,再看看是否可以查看它提供的examples,如果还没有问题那就是见鬼了:) 帮我看看就是这段代码:(就是它提示下载..)本来是处理页的,接受另一个页面的query变量.我这里直接给query赋值了.链接MYSQL的页面也写了一个,没有问题,可以正常显示.<%@ page contentType="text/html ;charset=gb2312" %><%@ page import="java.sql.*" %><html><head><title>查询结果</title></head><body><h2>查询结果</h2><%Connection con=null;try{ Class.forName("org.gjt.mm.mysql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/media","root","123"); Statement stmt=con.createStatement(); //stmt.setMaxRows(10); String query="select * from movie"; ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); int cols=rsmd.getColumnCount(); out.println("<table border=1><tr>"); for(int i=1;i<cols;i++) { out.println("<td>"); out.println(rsmd.getColumnLabel(i)); out.println("</td>"); } out.println("</tr>"); while(rs.next()) { out.println("<tr>"); for(int i=1;i<cols;i++) { out.println("<td>"); Object obj=rs.getObject(i); if(obj!=null) out.println(obj.toString()); else out.println(""); out.println("</td>"); } out.println("</tr>"); } out.println("</table>");}catch (ClassNotFoundException e){ out.println(e.getMessage());}catch (SQLException e){ out.println(e.getMessage());}finally{ try{ if(con!=null) con.close(); } catch(Exception e){}}%></body></html> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 喜欢上一个比我大3岁的女孩 求助:关于response.sendRedirect()参数问题 jsp中的include的问题 firefox下,文本框,下拉框获取输入的问题 请问网页中任何实现在客户端的ocx控件自动下载 使用连接池+DbUtils包总是找不到驱动? 求jsp的分页显示的现成代码(Jsp+oracle)!? 关于j2ee登录的一些问题。求解答。 如何在android平台上的谷歌浏览器里打开pdf文档 怎样才能从我的页面中完成另外一个页面的用户名和密码输入域的自动输入,并自动点击其登录按钮 如何在linux下安装jdk1.4的bin包! 100分问个文件读写的问题
TOMCAT4.1+jdk1.4
POST表单数据给目标页面时,居然提示下载.
直接用IE打开,也可以看到运行的结果,不过有时候这个结果和期望的有差别.
为什么啊... :(
你没有改端口的话先试一下:
http://localhost:8080/
如果有欢迎画面的话就证明问题不是出在tomcat上了,最基本的完了后,再看看是否可以查看它提供的examples,如果还没有问题那就是见鬼了:)
本来是处理页的,接受另一个页面的query变量.我这里直接给query赋值了.
链接MYSQL的页面也写了一个,没有问题,可以正常显示.<%@ page contentType="text/html ;charset=gb2312" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>查询结果</title>
</head>
<body>
<h2>查询结果</h2>
<%
Connection con=null;
try{
Class.forName("org.gjt.mm.mysql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/media","root","123"); Statement stmt=con.createStatement();
//stmt.setMaxRows(10);
String query="select * from movie";
ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData();
int cols=rsmd.getColumnCount();
out.println("<table border=1><tr>");
for(int i=1;i<cols;i++)
{
out.println("<td>");
out.println(rsmd.getColumnLabel(i));
out.println("</td>");
}
out.println("</tr>");
while(rs.next())
{
out.println("<tr>");
for(int i=1;i<cols;i++)
{
out.println("<td>");
Object obj=rs.getObject(i);
if(obj!=null)
out.println(obj.toString());
else out.println("");
out.println("</td>");
}
out.println("</tr>");
}
out.println("</table>");}
catch (ClassNotFoundException e){
out.println(e.getMessage());
}
catch (SQLException e){
out.println(e.getMessage());
}
finally{
try{
if(con!=null)
con.close();
}
catch(Exception e){}
}
%></body>
</html>