我运行的Java宠物商店例子,这是我的“的index.jsp”文件的顶部:为什么Firefox会将我的JSP网页文件作为原始源代码打开并且不显示实际页面?
<%-- Copyright 2006 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at: http://developer.sun.com/berkeley_license.html
$Id: index.jsp,v 1.20 2007-03-16 20:18:59 basler Exp $ --%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*, com.sun.javaee.blueprints.petstore.model.CatalogFacade, com.sun.javaee.blueprints.petstore.model.Tag"%>
<%
try {
CatalogFacade cf = (CatalogFacade)config.getServletContext().getAttribute("CatalogFacade");
List<Tag> tags=cf.getTagsInChunk(0, 12);
// since top 20 come from database or desending refCount order, need to reorder by tag name
Collections.sort(tags, new Comparator() {
public int compare(Object one, Object two) {
int cc=((Tag)two).getTag().compareTo(((Tag)one).getTag());
return (cc < 0 ? 1 : cc > 0 ? -1 : 0);
}
});
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Java Pet Store Reference Application</title>
<link type="text/css" rel="stylesheet" href="./tag.css"/>
</head>
<body>
....
你看到了哪些原始的源代码? – SLaks
我在这里发布的代码 - 当我点击index.jsp时,我得到了这个。我确实尝试将其重命名为“index.html”,但显示的页面不正确(看起来像一个没有图形/功能的框架)。 – Coffee
您使用的服务器是什么? – fvu