java - SpringMvc tiles how to add css files -


in project using springmvc tiles..

here, have

src--      |--main      |--resource----|--css--style.css      |--webapp--|--web-inf----|jsp--here have jsp files                 |--index.jsp 

i want add style.css jsp file in /webapp/web-inf/jsp/layout.jsp file..

i have tried below:--

    <?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: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:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p"         xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"         xsi:schemalocation="http://www.springframework.org/schema/beans                             http://www.springframework.org/schema/beans/spring-beans-4.1.xsd                             http://www.springframework.org/schema/aop                             http://www.springframework.org/schema/aop/spring-aop-4.1.xsd                             http://www.springframework.org/schema/context                             http://www.springframework.org/schema/context/spring-context-4.1.xsd                             http://www.springframework.org/schema/jee                             http://www.springframework.org/schema/jee/spring-jee-4.1.xsd                             http://www.springframework.org/schema/lang                             http://www.springframework.org/schema/lang/spring-lang-4.1.xsd                             http://www.springframework.org/schema/mvc                             http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd                             http://www.springframework.org/schema/tx                             http://www.springframework.org/schema/tx/spring-tx-4.1.xsd                             http://www.springframework.org/schema/util                             http://www.springframework.org/schema/util/spring-util-4.1.xsd">          <context:annotation-config />         <mvc:annotation-driven />         <mvc:default-servlet-handler />          <context:component-scan base-package="com.my.news" />         <mvc:resources mapping="/resources/**"  location="/resources/" />           <bean id="viewresolver"             class="org.springframework.web.servlet.view.urlbasedviewresolver">             <property name="viewclass">                 <value>                     org.springframework.web.servlet.view.tiles2.tilesview                 </value>             </property>         </bean>         <bean id="tilesconfigurer"             class="org.springframework.web.servlet.view.tiles2.tilesconfigurer">             <property name="definitions">                 <list>                     <value>/web-inf/tiles.xml</value>                 </list>             </property>          in **layout.jsp**    edited       <link rel="stylesheet" href="<c:url value="web-inf/css/style.css" />" /> --%>  <!-- <link rel="stylesheet" type="text/css" href="resources/css/style.css">          </bean> </beans> 

in layout.jsp ..i include file as:--

<link rel="stylesheet" type="text/css" href="resources/css/style.css"> 

but not getting style.css styles..why?????please suggest me..i have tried lot google..but nothing executed.. enter image description here

i getting layout.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>  <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">   <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8">   <spring:url value="/resources/css/style.css" var="stylecss"/>     <link rel="stylesheet" type="text/css" href="${stylecss}">       <title><tiles:insertattribute name="title" ignore="true" /></title> </head> <body> <table border="1" cellpadding="2" cellspacing="2" align="center">     <tr>         <td height="30" colspan="2"><tiles:insertattribute name="header" />         </td>     </tr>     <tr>         <td height="250"><tiles:insertattribute name="menu" /></td>         <td width="350"><tiles:insertattribute name="body" /></td>     </tr>     <tr>         <td height="30" colspan="2"><tiles:insertattribute name="footer" />         </td>     </tr> </table> </body> </html> 

this view..but style.css not working here... style.css

 body {         background:#f9ebae;         font-family: verdana, sans-serif;         font-size:11px;         line-height:14px;         color:#5e5e5e;     } 

what want :- enter image description here

what enter image description heream getting;--


Comments