I'm using bootstrap to add design to my project but when using the libraries it doesn't bring me any design, I don't know if I'm explaining myself.
Home.jsp
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"> -->
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css"> -->
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> -->
<!-- <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet" media="screen"> -->
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script> -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> -->
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
<!-- <script src="https://code.jquery.com/jquery-3.1.1.js"></script> -->
<link rel="stylesheet" href="/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
<link href="/bootstrap/css/bootstrap-glyphicons.css" rel="stylesheet" media="screen">
<script src="/bootstrap/js/bootstrap.min.js" ></script>
<script src="/bootstrap/jquery.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
<script src="/bootstrap/jquery-3.1.1.js"></script>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<html>
<head>
<body>
<c:url value="/j_spring_security_logout" var="logoutUrl" />
</body>
</head>
</html>
<html>
<div class="container" style="margin-left:30%">
<nav class="navbar navbar-inverse" style="margin-right:59%" >
<div class="container-fluid" >
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="inicio">Inicio</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="dropdown mega-dropdown">
<a href="#" class="dropdown-toggle" aria-haspopup="true" aria-expanded="false">Crear Proyecto </a>
</li>
<ul class="nav navbar-nav ">
<li class="dropdown1">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Mantenimientos </a>
<ul class="dropdown-menu">
<li><a href="listUsuario">Usuarios</a></li>
<li><a href="listActividad">Actividades</a></li>
<li><a href="listRecurso">Recursos</a></li>
<sec:authorize ifAllGranted ="Administrador">
<li><a href="listBitacora">Bitacora</a></li>
</sec:authorize>
<li role="separator" class="divider"></li>
</ul>
</li>
<c:url value="/j_spring_security_logout" var="logoutUrl" />
</ul>
<li class="nav navbar-nav navbar-right">
<a style="text-align: right" href="${logoutUrl}" class="dropdown-toggle" aria-haspopup="true" aria-expanded="false">Cerrar Sesion</a>
</li>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
<head>
<body>
</body>
</head>
</html>
servlets
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Specifying base package of the Components like Controller, Service,
DAO -->
<context:component-scan base-package="com.csye.SpringMvcSecurity.Controller" />
<!-- Getting Database properties -->
<context:property-placeholder location="classpath:application.properties" />
<mvc:annotation-driven />
<!-- Specifying the Resource location to load JS, CSS, Images etc -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<!-- View Resolver -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="RecursoDaoImpl" class="com.csye.SpringMvcSecurity.dao.RecursoDaoImpl" />
<bean id="RecursoServiceImpl" class="com.csye.SpringMvcSecurity.service.RecursoServiceImpl" />
<bean id="ActividadDaoImpl" class="com.csye.SpringMvcSecurity.dao.ActividadDaoImpl" />
<bean id="ActividadServiceImpl" class="com.csye.SpringMvcSecurity.service.ActividadServiceImpl" />
<bean id="BitacoraDaoImpl" class="com.csye.SpringMvcSecurity.dao.BitacoraDaoImpl" />
<bean id="BitacoraServiceImpl" class="com.csye.SpringMvcSecurity.service.BitacoraServiceImpl" />
<bean id="UsuarioDaoImpl" class="com.csye.SpringMvcSecurity.dao.UsuarioDaoImpl" />
<bean id="UsuarioServiceImpl" class="com.csye.SpringMvcSecurity.service.UsuarioServiceImpl" />
<!-- DataSource -->
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource"
id="dataSource">
<property name="driverClassName" value="${database.driver}"></property>
<property name="url" value="${database.url}"></property>
<property name="username" value="${database.user}"></property>
<property name="password" value="${database.password}"></property>
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
<property name="packagesToScan" value="com.csye.SpringMvcSecurity.model"></property>
</bean>
<!-- Transaction -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
</beans>
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Sample Spring Maven Project</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/mvc-dispatcher-servlet.xml,
/WEB-INF/security-config.xml,
/WEB-INF/spring-servlet.xml
</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Normally to serve static files they have to be organized in some way that the framework (Spring in this case) recognizes. Generally Spring looks for your static files in:
/META-INF/resources
/resources
/public
/static
In the configuration of your servlet you have put
so you should use the directory
resources
for static files. If you do not have it, you must create it within yourself,src/main
although personally I recommend that you create itsrc/main/resources/public
and put it there.