the below is my configuration
project directory
the below image is my project structure. Spring Maven project
Servlet-context.xml
i have done resource mapping
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
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.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.manjunath.controller" />
</beans:beans>
home.jsp
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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">
<title>Insert title here</title>
<link href="/resources/css/test.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>Home page:${pageContext.request.contextPath}</h1>
<h2 id="kaka">Hi this is manjunath</h2>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
and there is no error in project and successfully executed
but resource files are not mapping
I guess there is only 1 mistake in your code
In the page you need to give css link like below
<link href="resources/css/test.css" rel="stylesheet" type="text/css"/>
Just remove the / from href.
Related
I have read most of the related posts I have found on this problem but I could not find any working solution for my situation.
Basicly my jsp file can't seem to find the css file.
Here are my files:
The jsp page:
<%# taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Search for flight</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="${pageContext.request.contextPath}/WEB-INF/pages/theme.css" rel="stylesheet" type="text/css" >
</head>
the css page:
#title
{
font-family: "Times New Roman";
color: aqua;
}
mvc-dispatcher-servlet.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<context:component-scan base-package="com.mkyong.common.controller" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
web.xml:
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring Web MVC Application</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>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
And the controller works fine so I wouldn't find any real use in posting it.
The jsp file is visible from the browser but the styling is totally absent.
Thank you in advance!
you need to declare your resources in dispatcher-servlet file
<mvc:resources mapping="/resources/**" location="/resources/css/" />
Any request with url mapping /resources/** will directly look for /resources/css/
Now in jsp file you need to include your css file like this :
<link href="<c:url value="/resources/css/your file.css" />" rel="stylesheet">
complete example https://github.com/abdotalaat/SpringMVCCSS
I would suggest to add below lines in your spring configuration file(mvc-dispatcher-servlet.xml).
<mvc:resources mapping="/pages/*.css" location="/pages/"/>
<mvc:default-servlet-handler />
So I have resolved my problem.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
After adding this dependency the rest was pretty much flawless.
Thank you for your explanations! I have a much better understanding of how stuff works now.
I have the same problem:
- Check you add JSTL in pom.xml and declare in the jsp file
- Check with resources folders inside the webapp folder
- Check the href for your link css correct
The css and javascript is not work on my page.
My home.jsp
<%#page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ru">
<jsp:include page="/WEB-INF/views/fragments/headTag.jsp"/>
<body>
<h2>Welcome!</h2>
</body></html>
The headTag.jsp
<%# taglib prefix="s" uri="http://www.springframework.org/tags" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<s:url value="/resources/css/test.css" var="testCss"/>
<link href="${testCss}" rel="stylesheet"/>
</head>
The web.xml
<web-app version="2.5" 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">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<!-- <context-param>
<param-name>spring.profiles.active</param-name>
<param-value>jdbc</param-value>
</context-param> -->
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>hibernate</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/business-config.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
and my app servlet-comntext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- <Enable #Controller> -->
<mvc:annotation-driven />
<context:component-scan base-package="com.a72.coursapp.controller" />
<!-- resources mapping -->
<mvc:resources location="/resources/**" mapping="/resources/"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
The test.css
h2 {
color:red;
}
css location: src/main/webapp/resources/css/test.css
folder structure
-src
--main
---webapp
----resources
-----css
------test.css
-----js
-----fonts
----WEB-INF
-----views
------fragments
-------headTag.jsp
------home.jsp
What's wrong? Thanks in advance!
If look to source code page in firefox, page has test.ccs style, but it has this log:
Pivotal tc Runtime 3.0.0.RELEASE/8.0.9.B.RELEASE - Error report
HTTP Status 400 - description
The request sent by the client was syntactically incorrect.
Pivotal tc Runtime 3.0.0.RELEASE/8.0.9.B.RELEASE
I would have thought that your problem is the line:
<jsp:include page="/WEB-INF/views/fragments/headTag.jsp"/>
Don't think you can include anything behind WEB-INF with jsp:include.
It would anyway be rather unorthodox to call a view directly, they should be called by controllers.
Presumably if you are using spring you have a controller which calls that view? If so, then call the uri provided by the controller.
Otherwise I guess you need to move the jsp to a position that is not hiding behind WEB-INF.
Try this move your CSS and JS folder under WEB-INF
eg. if you are keeping your files like..
WEB-INF/resources/css/test.css
then change path in servlet-comntext.xml
<!-- resources mapping -->
<mvc:resources location="/WEB-INF/resources/" mapping="/resources/"/>
change in headTag.jsp page
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/test.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/test.js"></script>
Probably, you problem is base path. Try out:
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<link rel="stylesheet" href="<c:url value="/resources/css/test.css" />" />
hi i'm trying to change my default home page for another one but i couldn't do it, so i try to redirect the page from the default home page to the one i want, but i get this error
No mapping found for HTTP request with URI:
[/myapp/WEB-INF/views/index.html] in DispatcherServlet with name
'appServlet'
this is my setup i left everything by default when i create the project with spring tools suite
this is my servlet-contex.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC #Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value="" />
</beans:bean>
<context:component-scan base-package="com.proj.myapp" />
this is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
this is my deafult home file
home.jsp
enter code here
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
Hello world!
<c:redirect url="/indice.html"/>
</h1>
</body>
</html>
and this is the page i want to be redirected
enter code here
<html>
<body>
<h1>
INDICE
</h1>
</body>
</html>
and my contoller
#Controller
public class HomeController {
#RequestMapping(value = "/")
public String home() {
return "home.jsp";
}
#RequestMapping(value = "/indice.html")
public String indice() {
return "indice.html";
}
}
and i get this error
No mapping found for HTTP request with URI:
[/myapp/WEB-INF/views/indice.html] in DispatcherServlet with name
'appServlet'
As from your code suffix property value is blank so you need to pass the type of suffix to this property in in servlet-context.xml.
You have to change it
<beans:property name="suffix" value=".jsp" />
and your indices.html to indices.jsp then it will work.
But if you want to work it with html file but .html files are static and do not require processing by a servlet then it is more efficient, and simpler, to use an mapping. This requires Spring 3.0.4+.
For example:
<mvc:resources mapping="/static/**" location="/static/" />
which would pass through all requests starting with /static/ to the webapp/static/ directory.
So by putting indices.html in webapp/static/ and using return "indices.html"; from your method, Spring should find the view.
I am working on a spring MVC project in which I am trying to use css style sheets by referencing it to design my JSP page. But somehow my css files are not being picked up once I hit my method in the controller..
Below is my JSP file -
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
<body>
<h1>All header 1 elements will be red</h1>
<h2>All header 2 elements will be blue</h2>
<p>All text in paragraphs will be green.</p>
</body>
</html>
And below is my test.css file -
h1 {color:red;}
h2 {color:blue;}
p {color:green;}
And below is my method in controller class -
#RequestMapping(value = "testing", method = RequestMethod.GET)
public Map<String, String> testing() {
final Map<String, String> model = new LinkedHashMap<String, String>();
return model;
}
Directory structure is like this -
webapp/
|-- resources/
| +-- css/
| test.css
+- WEB-INF/
+-- views/
testing.jsp
But somehow it's not working for me.. Is there anything wrong I am doing here?
UPDATE:-
Here is my web.xml file-
<?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_3_0.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>testweb</display-name>
<listener>
<listener-class>com.host.webres.resource.env.EbayResourceRuntimeListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>index</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/testweb/*</url-pattern>
</servlet-mapping>
</web-app>
And below is my context.xml file -
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Allow proxys -->
<aop:aspectj-autoproxy />
<!-- Enables the Spring MVC #Controller programming model -->
<mvc:annotation-driven>
<mvc:message-converters>
<!-- Support AJAX processing with progressive rendering. Overrides HttpOutputMessage with RaptorResponseWriter -->
<beans:bean class="com.host.terr.kernel.filter.RaptorJacksonHttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<context:component-scan base-package="com.host.terr.config" />
<context:component-scan base-package="com.host.personalization.bullseye.zookeeper.p13nzook.controller" />
<!-- Handles HTTP GET requests by efficiently serving up static resources
in the corresponding directory -->
<resources mapping="/js/**" location="/js/" />
<resources mapping="/css/**" location="/css/" />
<!-- Resolves views selected for rendering by #Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
</beans:beans>
This is exception I am getting on my console but browser shows the data without any css -
404 /testweb/test.css Not Found /testweb/test.css Not Found }, Correlations : {} }
In your servlet-context.xml file,you have setting about your directory of resources.In your case,with changing
<resources mapping="/resources/**" location="/resources/"/>
and in your jsp page like below,
<link rel="stylesheet" type="text/css" href="
<c:url value="/resources/css/test.css"/> "/>
I hope it will work
You need to provide the context path.
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/test.css" />
What does this expression language ${pageContext.request.contextPath} exactly do in JSP EL?
You need to set <base/> as following...
<c:set var="req" value="${pageContext.request}" />
<c:set var="url"> ${req.requestURL} </c:set>
<c:set var="uri" value="${req.requestURI}" />
<head>
<title></title>
<base href="${fn:substring(url, 0, fn:length(url) - fn:length(uri))}${req.contextPath}/" />
Then You can Import any JS or CSS like below..
<script src="assets/js/angular/angular.js"></script>
Maybe by adding your .css file in a specific folder inside the WEB-Content then, you could use the attribute href = "yourFolder/yourFile.css
Indeed all "web" ressources like the view should be there (i.e. jsp, css.).
You can also precise that your link (in the .jsp file) is a stylesheet one by adding: rel="stylesheet"
you will have a link looking like this :
this css resource issue
please try below
<link rel="stylesheet" type="text/css" href="css/test.css" />
and you can see this resource if be load by bowaser.
Hello I have an application with Spring MVC with Hibernate, but the problem is that I have not configured quite right because for routing, for the import of libraries .js and .css, I have to use pageContext.request.contextPath, I show my settings:
• web.xml
<?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_2_5.xsd"
version="2.5">
<display-name>extjs_commerceapp-solution</display-name>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/commerceapp-servlet.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>commerceapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>commerceapp</servlet-name>
<url-pattern>/mvc/*</url-pattern>
</servlet-mapping>
</web-app>
• commerceapp-servlet.xml
<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/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
">
<mvc:annotation-driven />
<context:component-scan base-package="com.limati.commerceapp" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/com/limati/commerceapp/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- Configures Hibernate - Database Config -->
<import resource="commerceapp-dao-hibernate.xml" />
<import resource="commerceapp-service.xml" />
</beans>
Through commerceapp-servlet.xml, I import the other two of my settings Hibernate XML.
The problem is that my main page which loads my RIA interface, I have to put this routing (pageContext.request.contextPath):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CommerceApp</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/ext4/resources/css/ext-all.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/ext4/ext-all-debug.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/css/app.css"/>
</head>
<body style="background-color: #95B0CD" >
<script type="text/javascript">
Ext.Loader.setConfig({
enabled: true,
paths:{
"app": "${pageContext.request.contextPath}/app"
}
});
var CONTEXT_PATH = "${pageContext.request.contextPath}";
var USER = "${sessionScope.user.userName}";
app=Ext.create('Ext.app.Application',{
name:'LTI',
appFolder: 'app/base/user',
//controllers:['UserController'], //si se quiere inicializar un controlador en la creación
launch: function(){
Ext.create("app.principal.view.Desktop",{
});
}
});
</script>
</body>
</html>
Someone can help me with this problem.
i think you have to add this tag
<mvc:resources mapping="/resources/**" location="/resources/" />
to handle the static resource.means put your all static resource in resource folder or you can change the location according to your requirement.