1

내 webapp에는 정적 컨텐츠가 표시되지 않습니다.부두 및 스프링이 포함 된 정적 컨텐츠

  • 스프링 MVC
  • 트위터 부트 스트랩
  • 부두 7

빌드 프로젝트 : 부두에 설치 MVN 새로 포함

의 Web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="WebApp_ID" version="2.5"> 
    <display-name>Some company</display-name> 
    <welcome-file-list> 
     <welcome-file>list.html</welcome-file> 
    </welcome-file-list> 
    <servlet> 
     <servlet-name>spring</servlet-name> 
     <servlet-class> 
      org.springframework.web.servlet.DispatcherServlet 
     </servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>spring</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 
</web-app> 

봄-servlet.xml 파일은

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" 
    xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:util="http://www.springframework.org/schema/util" 
    xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns="http://www.springframework.org/schema/beans" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd 
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd 
     http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd 
     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd 
     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> 

    <context:annotation-config /> 
    <!-- use this for Spring Jackson JSON support --> 
    <mvc:annotation-driven /> 
    <mvc:default-servlet-handler /> 
    <tx:annotation-driven transaction-manager="transactionManager" /> 
    <jdbc:embedded-database id="dataSource" type="H2" /> 

    <context:component-scan base-package="com.company.config" /> 
    <context:component-scan base-package="com.company.market.dao" /> 
    <context:component-scan base-package="com.company.service.app" /> 
    <context:component-scan base-package="com.company.controller" /> 

    <bean id="multipartResolver" 
     class="org.springframework.web.multipart.commons.CommonsMultipartResolver" /> 
    <bean 
     class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> 
     <property name="viewResolvers"> 
      <list> 
       <bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
        <property name="viewClass" 
         value="org.springframework.web.servlet.view.JstlView" /> 
        <property name="prefix" value="/WEB-INF/jsp/" /> 
        <property name="suffix" value=".jsp" /> 
       </bean> 
      </list> 
     </property> 
    </bean> 
</beans> 

는 hero.jsp 추가 .jsp를 libary 그렇지 않으면 부트 스트랩 예를 트위터하지만

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@ page session="false" %> 
<!DOCTYPE html> 
<html lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    <title>Bootstrap, from Twitter</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta name="description" content=""> 
    <meta name="author" content=""> 

    <!-- Le styles --> 
    <link href="../resources/assets/bootstrap/css/bootstrap.css" rel="stylesheet"> 
    <style type="text/css"> 
     body { 
     padding-top: 60px; 
     padding-bottom: 40px; 
     } 
    </style> 
    <link href="../resources/assets/bootstrap/css/bootstrap-responsive.css" rel="stylesheet"> 

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> 
    <!--[if lt IE 9]> 
     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
    <![endif]--> 

    <!-- Le fav and touch icons --> 
    <link rel="shortcut icon" href="../resources/assets/bootstrap/ico/favicon.ico"> 
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../resources/assets/bootstrap/ico/apple-touch-icon-144-precomposed.png"> 
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../resources/assets/bootstrap/ico/apple-touch-icon-114-precomposed.png"> 
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../resources/assets/bootstrap/ico/apple-touch-icon-72-precomposed.png"> 
    <link rel="apple-touch-icon-precomposed" href="../resources/assets/bootstrap/ico/apple-touch-icon-57-precomposed.png"> 
    </head> 

    <body> 

    <div class="navbar navbar-fixed-top"> 
     <div class="navbar-inner"> 
     <div class="container"> 
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> 
      <span class="icon-bar"></span> 
      <span class="icon-bar"></span> 
      <span class="icon-bar"></span> 
      </a> 
      <a class="brand" href="#">Project name</a> 
      <div class="nav-collapse"> 
      <ul class="nav"> 
       <li class="active"><a href="#">Home</a></li> 
       <li><a href="#about">About</a></li> 
       <li><a href="#contact">Contact</a></li> 
      </ul> 
      </div><!--/.nav-collapse --> 
     </div> 
     </div> 
    </div> 

    <div class="container"> 

     <!-- Main hero unit for a primary marketing message or call to action --> 
     <div class="hero-unit"> 
     <h1>Hello, world!</h1> 
     <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p> 
     <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p> 
     </div> 


    </body> 
</html> 

폴더 구조가 같은 받는다는 일부 내용을 삭제. 내가 hero.html로하여 hero.jsp을 열고 내가 트위터 부트 스트랩이 작동하고 있음을 볼 수 브라우저에서 볼하지만 배포가 아무것도 작동하지 않습니다

src 
- main 
    - webapp 
     - WEB-INF 
      -jsp 
      -resources 
       - assets 
        -bootstrap 
         - css 
         - ico 
         - img 
         - js 
     - spring-servlet.xml 
     - web.xml 

... 나는

와 함께 놀았 이 링크의 예를 배포 할 때 나는 html 파일의 소스에 보였다 경우
<mvc:resources mapping="/resources/**" location="/public-resources/"/> 

하지만 일을하지 않았다 ...

.CSS 포인트

http://localhost:8080/resources/assets/bootstrap/css/bootstrap.css 
+2

리소스를 webapp 디렉토리로 이동하십시오. 덕분에 – prashanth

+0

THX !! ../resources ...에서 ../../resources로 위치를 변경해야했습니다. – Philippxp

답변

0

에 웹 애플리케이션 디렉토리에 대한 권리 팁을 자원했다 옮겨보십시오.

관련 문제