I have see dozens of that problem here but no solution solved mine. I'm testing Kendo UI in a VERY simple basic java ee dynamic web project. I only have 1 servelet and one JSP. I have used <%@ include file="path" %>
just for taking advantage of that tag. Also I have only use doGet
from the servlet to return the view. But I still get that error saying :
For my CSS Files
Resource interpreted as Stylesheet but transferred with MIME type text/html
For my javascript files
Uncaught SyntaxError: Unexpected token <
I am using Pivotal Server WITH NO SECURITY CONFIGURATION. My IDE is using the default encoding for ALL types of files (ISO Latin 1) and (UTF -8 for XML)
**Important symptom : ** when I go in the browser with http://localhost:8080/testKendoUI/resources/css/styles/kendo.default.min.css
or any other CSS or JS file, I'm redirected to the index.jsp
but not to the code of the file.
I have tried <mime-mapping>
in web.xml but it did not solve the issue.
Below is my code and some screen shots
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>com.kendoUI.controllers.dispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
dispatcher servlet
package com.kendoUI.controllers;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/dispatcher")
public class dispatcher extends HttpServlet {
private static final long serialVersionUID = 1L;
public dispatcher() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.getServletContext().getRequestDispatcher("/WEB-INF/views/index.jsp").forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
headerHTML.jsp
<!DOCTYPE html>
<html>
<head>
<title>My KendoUI Test App</title>
<!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -->
<link type="text/css" rel="stylesheet" href="resources/css/styles/kendo.common.min.css"/>
<link type="text/css" rel="stylesheet" href="resources/css/styles/kendo.default.min.css"/>
<link type="text/css" rel="stylesheet" href="resources/css/bootstrap/css/bootstrap.min.css"/>
<script type="text/javascript" src="resources/js/jquery.min.js"></script>
<script type="text/javascript" src="resources/js/kendo.all.min.js"></script>
</head>
<body>
taglibs.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="kendo" uri="http://www.kendoui.com/jsp/tags" %>
index.jsp
<%@ include file="/WEB-INF/tags/taglibs.jsp" %>
<%@ include file="/WEB-INF/tags/headerHTML.jsp" %>
<div class="container">
<div class="row">
<h1>THIS IS MY TEST</h1>
<kendo:calendar name="calendar"></kendo:calendar>
</div>
</div>
<%@ include file="/WEB-INF/tags/footerHTML.jsp" %>
footerHTMl.jsp
</body>
</html>
Screenshot of error