Results 1 to 3 of 3

Thread: Application doesn't work with mvc static resource

  1. #1
    Join Date
    Dec 2012
    Posts
    2

    Default Application doesn't work with mvc static resource

    Hi everybody,

    I'm new in Spring and this forum, I'm creating a project with version 3.2.0 of spring and I'm having a problem with the static resources, follow the case:

    My app wasn't show any images, css or js files, even using <c:url... Then I looking for any information about I found the tag:

    <mvc:resources location="/resources/" mapping="/resources/**" />

    I've created a directory called "resources" in my app "WebContent/resources/" and put all my images, css and js files there.

    The problem is, when i put the tag <mvc:resources... or any <mvc... tag my app doesn't work, show me just a error 404.

    This is my applicationContext.xml
    Code:
    <?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:context="http://www.springframework.org/schema/context"
    	xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xsi:schemaLocation="http://www.springframework.org/schema/mvc  
           http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd  
           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">
    
    	<mvc:resources location="/resources/" mapping="/resources/**" />
    
    	<bean id="persistence" class="br.com.tiforte.persistence.GenericPersistenceImpl" />
    	<bean class="br.com.tiforte.business.UsuarioBusiness">
    		<constructor-arg ref="persistence" />
    	</bean>
    	<bean class="br.com.tiforte.business.AcessoBusiness">
    		<constructor-arg ref="persistence" />
    	</bean>
    	<bean class="br.com.tiforte.business.LogBusiness">
    		<constructor-arg ref="persistence" />
    	</bean>
    
    </beans>
    My path has these libs:

    spring-aop-3.2.0.RELEASE.jar
    spring-aspects-3.2.0.RELEASE.jar
    spring-beans-3.2.0.RELEASE.jar
    spring-context-3.2.0.RELEASE.jar
    spring-core-3.2.0.RELEASE.jar
    spring-expression-3.2.0.RELEASE.jar
    spring-jms-3.2.0.RELEASE.jar
    spring-orm-3.2.0.RELEASE.jar
    spring-oxm-3.2.0.RELEASE.jar
    spring-tx-3.2.0.RELEASE.jar
    spring-web-3.2.0.RELEASE.jar
    spring-webmvc-3.2.0.RELEASE.jar

    Thank's since now.

  2. #2
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    Need your web.xml and application context and/or servlet context file contents. You may also want to take a look at StackOverflow before posting again here

  3. #3
    Join Date
    Dec 2012
    Posts
    2

    Default

    Quote Originally Posted by objectamit View Post
    Need your web.xml and application context and/or servlet context file contents. You may also want to take a look at StackOverflow before posting again here
    Well I resolve the problem, you said i post my web.xml and context file when i was copying to post here i saw that i was writing the tag <mvc:resources... in the wrong file, i was writing in applicationContext.xml when in true i should write in dispatcher-servlet.xml...

    But anyway, I'm thankful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •