任何人都可以帮我找到这个难题的解决方案,我已经尝试了三天,但仍然服务器以505响应。我甚至有一个类似的项目在这方面起作用,而且我'我复制了所有关键代码,但有问题的代码仍未获得批准。
我发布的照片可能会让某人发现我在某种程度上无法察觉的错误。提前谢谢!
1.) This is my refresh response:
2.) This is the landing response:
4.) This is my dispacher-servlet.xml config file:
5.) This is my header.jsp file with the spring:url necessary for css inclusion:
以下是嵌入式代码片段:
dispacher-servlet.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:flow="http://www.springframework.org/schema/webflow-config"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd">
<context:component-scan base-package="controllers" />
<mvc:annotation-driven/>
<mvc:default-servlet-handler/>
<mvc:resources mapping="/resources/**" location="/resources/"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>/WEB-INF/data/dragon</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
<mvc:interceptors>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language"/>
</bean>
</mvc:interceptors>
<aop:aspectj-autoproxy/>
<bean id="dragonDao" class="controllers.DragonDaoImp"/>
<bean id="logAspect" class="controllers.LoggingAspect"/>
<!-- <import resource="flow-definition.xml"/> -->
</beans>
header.jsp中:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" http-equiv="Content-Type" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Testing 3-5-5</title>
<!--<link href="webjars/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<spring:url value="/resources/version1/css/footer.css" var="footerCSS"/>
<link href="${footerCSS}" rel="stylesheet"/>
<spring:url value="/resources/version1/css/header.css" var="headerCSS"/>
<link href="${headerCSS}" rel="stylesheet"/>
</head>
<body style="background-color: #C5D1EB;">
<nav class="navbar navbar-inverse" id="navbar" style="border-radius: 0px; padding-top:1px; border-color: #222222;">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">ServiceName</a>
<!-- style="margin-right: 200px;" -->
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">
<a href="#" style="border-radius: 0px;" class="btn btn-outline-success">
<span class="glyphicon glyphicon-home"></span> Home
</a>
</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">DZs <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="dragon">DZ03</a>
</li>
<li><a href="#">DZ04</a>
</li>
<li><a href="#">DZ05</a>
</li>
<li><a href="#">DZ06</a>
</li>
<li><a href="#">DZ07</a>
</li>
</ul>
</li>
<li><a href="#">Menu 1</a>
</li>
<li><a href="#">Menu 2</a>
</li>
</ul>
<form class="navbar-form navbar-right">
<div class="form-group">
<input type="text" placeholder="Email" class="form-control">
</div>
<div class="form-group">
<input type="password" placeholder="Password" class="form-control">
</div>
<button type="submit" style="background-color: #32936F; border-color: #32936F;" class="btn btn-success">Sign in</button>
</form>
</div>
</div>
</div>
</nav>
答案 0 :(得分:0)
看起来你已经为CSS提供了绝对路径的相对路径。 你可以通过添加contextPath来尝试如下。 $ {pageContext.request.contextPath} /resources/version1/css/footer.css
答案 1 :(得分:0)
请尝试<mvc:resources mapping="/resources/**" location="/resources/version1/" />
和<link href="<c:url value="/resources/css/header.css" />" rel="stylesheet">
答案 2 :(得分:0)
解决方案只是摆弄整个代码代表。无法真正解释治愈错误的原因。我为一个糟糕的解决方案答案道歉,这个项目(家庭作业)不再维护。