Internet Explorer希望下载GuessNumber示例应用程序的网页,而不是显示它 [英] Internet Explorer wants to download the webpage of GuessNumber example application instead of displaying it

查看:112
本文介绍了Internet Explorer希望下载GuessNumber示例应用程序的网页,而不是显示它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Netbeans 7.1与Glassfish 3.1.1和JDK 6一起使用.我从Java EE 5教程构建了一个示例项目. 示例项目下载,该项目是guessNumber项目.

I am using Netbeans 7.1 with Glassfish 3.1.1, and JDK 6. I built a sample project from a Java EE 5 tutorial. Sample Projects Download, The project is the guessNumber project.

我打开项目,为它分配glassfish服务器,部署并运行它.结果是这样的:

I open the project, assign the glassfish server to it, deploy it and run it. The result is this:

这是什么原因造成的? Internet Explorer为什么不希望将其呈现为HTML页面,而是提供下载文件的功能?我保存了文件.在这里是: guessNumber

What would cause this? Why doesn't Internet Explorer want to render this as an HTML page and offer to download the file instead? I saved the file. Here it is: guessNumber

我没有更改任何项目设置.我还卸载并重新安装了Netbeans,Glassfish和JDK 6,并重新安装了以确保这些设置没有改变.

I did not change any project settings. I also uninstalled and re-installed Netbeans, Glassfish, and JDK 6 and reinstalled just to be sure nothing got changed in those settings.

推荐答案

IE不支持内容类型为application/xhtml+xml的HTML文件.

IE does not support HTML files which are served with content type of application/xhtml+xml.

更改所有JSP顶部的以下行

Change the following line in top of all JSPs

<%@ page contentType="application/xhtml+xml" %>

<%@ page contentType="text/html" %>

这是本教程作者的一个错误(或者,可能是故意向IE用户显示他们使用了错误的网络浏览器;它可以在Chrome,Firefox等实际浏览器中使用).

This was a mistake of the tutorial's authors (or, maybe, a purposeful stab towards IE users that they're using the wrong browser for the web; it works in real browsers like Chrome, Firefox, etc).

无关与具体问题无关,请不要使用过时的JSF 1.x教程/书籍.而是使用JSF2.x.使用JSF 1.x和JSP,您基本上可以使用无效技术. Glassfish 3.x已经开箱即用地支持JSF2.x. JSF 2.x是Java EE 6的一部分.专注于查找/阅读JSF 2.x教程/书籍.

Unrelated to the concrete problem, don't use outdated JSF 1.x tutorials/books. Instead use JSF 2.x ones. With JSF 1.x and JSP you're basically working with dead technology. Glassfish 3.x supports JSF 2.x out the box already. JSF 2.x is part of Java EE 6. Concentrate on finding/reading JSF 2.x tutorials/books.

  • What are the main disadvantages of Java Server Faces 2.0?
  • Is it possible to use JSF+Facelets with HTML 4/5?

这篇关于Internet Explorer希望下载GuessNumber示例应用程序的网页,而不是显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆