Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/08/2013, 04:07
oskrok
 
Fecha de Ingreso: febrero-2006
Mensajes: 43
Antigüedad: 18 años, 2 meses
Puntos: 1
Integrar bootstrap en spring

Soy bastante nuevo en esto de spring y me gustaría integrar bootstrap en spring, quien dice bootstrap importar cualquier archivo css o js.

El caso es que me sale un error 404, a continuación pongo el código de mis archivos:

web.xml

Código:
<web-app id="WebApp_ID" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://java.sun.com/xml/ns/j2ee 
		http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

	<display-name>Spring Web MVC Application</display-name>

	<servlet>
		<servlet-name>bets-dispatcher</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>bets-dispatcher</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/bets-dispatcher-servlet.xml</param-value>
	</context-param>

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
</web-app>
bets-dispatcher-servlet.xml

Código:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://www.springframework.org/schema/mvc 
      	http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.1.xsd">
        
	<context:component-scan base-package="com.omb.bets.controller" />
	
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		
		<property name="prefix">
			<value>/WEB-INF/pages/</value>
		</property>
		
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>
	
	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
	<mvc:resources mapping="/resources/**" location="/resources/" />
	<mvc:annotation-driven />
</beans>
Y en mi main-layout.jsp
Código:
<link href="<c:url value="/resources/css/bootstrap.css" />" rel="stylesheet"  type="text/css" />    
<link href="<c:url value="/resources/css/bootstrap-responsive.css" />" rel="stylesheet"  type="text/css" />
La estructura de directorios es la siguiente:
Código:
- src
  - main
    - java
    - resources
      - css
      - img
      - js
    - webapp
      - WEB-INF
        - pages
          - main-layout.jsp
        - bets-dispatcher-servlet.xml
        - web.xml
También quería guardar el contenido de la carpeta resources (css, img, js) que actualmente sólo es bootstrap en una carpeta con ese nombre pero como ya me falla así ni lo intenté.

En firebug me sale esta ubicación con error 404:
http://localhost:8080/bets/resources/css/bootstrap.css
http://localhost:8080/bets/resources/css/bootstrap-responsive.css

Como ya he dicho acabo de empezar, alguien me puede ayudar?.
Un saludo y gracias.