java - Page losing resources in Spring MVC when changing URL -
i've made webview using spring mvc (i'm quite new spring), , of ok, when change page url mydomain.com/admin/
mydomain.com/admin
resource mapping crashes. expected spring understand both forms of url, wrong it.
here's dispatcher servlet resource mapping experimental parts
<mvc:resources mapping="/admin/**" location="/resources/theme/"/> <mvc:resources mapping="/admin**" location="/resources/theme/"/> <mvc:resources mapping="**/dist/**" location="/resources/theme/dist/"/> <mvc:resources mapping="**/bootstrap/**" location="/resources/theme/bootstrap/"/> <mvc:resources mapping="**/plugins/**" location="/resources/theme/plugins/"/> <mvc:annotation-driven />
the view itself
<%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html> <jsp:include page="partials/head.jsp"/> <body class="skin-blue sidebar-mini"> <div class="wrapper"> <jsp:include page="partials/header.jsp"/> <jsp:include page="partials/leftmenu.jsp"/> <!-- content wrapper. contains page content --> <div class="content-wrapper"> <!-- content goes here --> </div><!-- /.content-wrapper --> <jsp:include page="partials/footer.jsp"/> <jsp:include page="partials/csidebar.jsp"/> </div><!-- ./wrapper --> <jsp:include page="partials/scripts.jsp"/> </body> </html>
partial
<%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <head> <meta charset="utf-8"> <title>adminlte 2 | dashboard</title> <!-- tell browser responsive screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- bootstrap 3.3.4 --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- fontawesome 4.3.0 --> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <!-- ionicons 2.0.0 --> <link href="dist /css/ionicons.min.css" rel="stylesheet" type="text/css" /> <!-- theme style --> <link href="dist/css/adminlte.min.css" rel="stylesheet" type="text/css" /> <!-- adminlte skins. choose skin css/skins folder instead of downloading of them reduce load. --> <link href="dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" /> <!-- icheck --> <link href="plugins/icheck/flat/blue.css" rel="stylesheet" type="text/css" /> <!-- morris chart --> <link href="plugins/morris/morris.css" rel="stylesheet" type="text/css" /> <!-- jvectormap --> <link href="plugins/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" /> <!-- date picker --> <link href="plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" /> <!-- daterange picker --> <link href="plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" /> <!-- bootstrap wysihtml5 - text editor --> <link href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" /> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via file:// --> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head>
what doing wrong?
just solved trouble. used
<mvc:resources mapping="/dist/**" location="/resources/theme/dist/"/> <mvc:resources mapping="/bootstrap/**" location="/resources/theme/bootstrap/"/> <mvc:resources mapping="/plugins/**" location="/resources/theme/plugins/"/> <mvc:annotation-driven />
instead of
<mvc:resources mapping="/admin/**" location="/resources/theme/"/> <mvc:resources mapping="/admin**" location="/resources/theme/"/> <mvc:resources mapping="**/dist/**" location="/resources/theme/dist/"/> <mvc:resources mapping="**/bootstrap/**" location="/resources/theme/bootstrap/"/> <mvc:resources mapping="**/plugins/**" location="/resources/theme/plugins/"/> <mvc:annotation-driven />
the mistake operating page related urls. tried catch requests resource folder wherever works nice
Comments
Post a Comment