Hello, I'm new with Spring and I'm trying to use my javascript files in my jsp.
Now.. my dispatcher-servlet is:
my web is:Code:..... <context:component-scan base-package="bosmaci.org.controller"/> <!-- Configures the @Controller programming model --> <mvc:annotation-driven/> <!-- the mvc resources tag does the magic --> <mvc:resources mapping="/resources/**" location="/resources/" /> <!-- Un modo comodo per mappare le URL direttamente sulle JSP, senza dover creare un controller --> <mvc:view-controller path="/about.html" view-name="about" /> <!-- View Resolver for JSPs --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="requestContextAttribute" value="rc"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> </bean> ...
In my jsp :Code:<display-name>Spring project</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath*:/applicationContext.xml </param-value> </context-param> <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list>
It is able to find the image but is not able to find javascript file...Code:.... <body> <p>query requested</p> <c:out value="${query}" default="sucamilla" /> <img src='<c:url value="/resources/images/git-cheat-sheet-large.png" />' /> <script type="text/javascript" src='<c:url value="/resources/js/commons.js" />'> getAlert(); </script> </body> ....
why?
Any help will be appreciate..


Reply With Quote
