Inconsistency in the mapping of resources in a Spring project -


in spring project, 1 of controllers have following views:

login -> /web-inf/jsp/acesso/login.jsp logout -> /web-inf/jsp/acesso/logout.jsp start -> /web-inf/jsp/acesso/start.jsp 

which working fine, except little problem the first view (login):

when call first time (aka, when start application), page displayed correctly. after call logout inside start, have link login. when click in link, view login displayed wrong, without reach none of css files included in html code.

the jsp files above are:

login.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <meta name="description" content="">     <meta name="author" content="">      <title>horariolivre - login</title>      <link href="<c:out value="bootstrap/css/bootstrap.min.css"/>" rel="stylesheet">      <link href="<c:out value="extras/css/signin.css"/>" rel="stylesheet">      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>     <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>   </head>    <body>      <div class="container">      <form class="form-signin" role="form" method="post" action="<c:out value="acesso/dologin.html"/>">     <h2 class="form-signin-heading">please sign in</h2>     <input type="text" class="form-control" name="username" placeholder="username" required autofocus>     <input type="password" class="form-control" name="password" placeholder="password" required>     <button class="btn btn-lg btn-primary btn-block" type="submit">sign in</button>     </form>      </div> <!-- /container -->       <!-- bootstrap core javascript     ================================================== -->     <!-- placed @ end of document pages load faster -->   </body> </html> 

start.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <meta name="description" content="">     <meta name="author" content="">      <title>horariolivre</title>      <!-- bootstrap core css -->     <link href="<c:out value="../bootstrap/css/bootstrap.min.css"/>" rel="stylesheet">      <!-- custom styles template -->     <link href="<c:out value="../extra/css/starter-template.css"/>" rel="stylesheet">      <script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>     <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>     <![endif]-->   </head>    <body>      <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">       <div class="container">         <div class="navbar-header">           <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">             <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="#">horariolivre</a>         </div>         <div class="collapse navbar-collapse">           <ul class="nav navbar-nav">             <li><a href="#">eventos</a></li>             <li><a href="#">listar hor&aacute;rios</a></li>             <li><a href="#">cadastrar hor&aacute;rios</a></li>             <li><a href="#">usu&aacute;rios</a></li>           </ul>           <ul class="nav navbar-nav navbar-right">               <li class="dropdown">           <a href="#" class="dropdown-toggle" data-toggle="dropdown">${usuario.primeironome} ${usuario.ultimonome}<b class="caret"></b></a>                   <ul class="dropdown-menu">                     <li><a href="#">perfil</a></li>                     <li><a href="#">configura&ccedil;&otilde;es</a></li>                     <li><a href="<c:out value="logout.html"/>">sair</a></li>                   </ul>               </li>           </ul>         </div><!--/.nav-collapse -->       </div>     </div>      <div class="container">        <div class="starter-template">       </div>      </div><!-- /.container -->       <!-- bootstrap core javascript     ================================================== -->     <!-- placed @ end of document pages load faster -->     <script src="<c:out value="../jquery/js/jquery-2.1.0.min.js"/>"></script>     <script src="<c:out value="../jquery/js/jquery-ui-1.10.4.custom.min.js"/>"></script>     <script src="<c:out value="../bootstrap/js/bootstrap.min.js"/>"></script>   </body> </html> 

logout.html

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <meta name="description" content="">     <meta name="author" content="">      <title>saida sistema</title>      <!-- bootstrap core css -->     <link href="<c:out value="../bootstrap/css/bootstrap.min.css"/>" rel="stylesheet">      <!-- custom styles template -->     <link href="<c:out value="../extra/css/jumbotron-narrow.css"/>" rel="stylesheet">      <script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->      <!-- html5 shim , respond.js ie8 support of html5 elements , media queries -->     <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>     <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>   </head>    <body>      <div class="container">       <div class="header">         <h3 class="text-muted">horariolivre</h3>       </div>        <div class="jumbotron">         <h1>você saiu sistema</h1>         <p class="lead"></p>         <p><a class="btn btn-lg btn-success" href="<c:out value="login.html"/>" role="button">entrar novamente</a></p>       </div>        <div class="footer">         <p>kleber mota de oliveira &copy; 2014</p>       </div>      </div> <!-- /container -->       <!-- bootstrap core javascript     ================================================== -->     <!-- placed @ end of document pages load faster -->   </body> </html> 

someone knows how correct set mapping files, work don't matter how it's called?

ps.: web.xml is:

<?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_3_0.xsd" id="webapp_id" version="3.0">   <display-name>horariolivre2</display-name>    <welcome-file-list>     <welcome-file>acesso/login.html</welcome-file>   </welcome-file-list>    <servlet>     <servlet-name>horariolivre2</servlet-name>     <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>     <load-on-startup>1</load-on-startup>   </servlet>    <servlet-mapping>     <servlet-name>horariolivre2</servlet-name>     <url-pattern>*.html</url-pattern>   </servlet-mapping> </web-app> 

my horariolivre2-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:p="http://www.springframework.org/schema/p"         xmlns:context="http://www.springframework.org/schema/context"         xmlns:mvc="http://www.springframework.org/schema/mvc"         xmlns:tx="http://www.springframework.org/schema/tx"         xsi:schemalocation="         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">          <context:component-scan base-package="com.horariolivre"/>             <bean id="viewresolver" 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>          <context:annotation-config>             <bean class="com.horariolivre.resources.hibernateconfig">             </bean>         </context:annotation-config>          <tx:annotation-driven transaction-manager="transactionmanager"/> </beans> 

in horariolivre2-servlet.xml seems have not mapped static resources. check out link see how done


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -