title: Spring MVC - Tiles, JSP Page include js/jquery file does not work
body: <p>I am trying to develop a Java App that is based on Spring MVC and Apache Tiles. Basically everything is working fine, until I am trying to add some javascript to the page. 
  Than the page is not displayed. Maybe you have any Idea, why it is not working? </p>
  
  <p>Since it is working fine without js I think it is ok, if I won<code>t copy the Java classes, but only the jsp</code>s and config files...</p>
  
  <p>So the Spring-servlet is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:context="http://www.springframework.org/schema/context" 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/tx
  http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  http://www.springframework.org/schema/mvc
  http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
  &gt;
  
  &lt;context:property-placeholder location="classpath:resources/database.properties" /&gt;
  &lt;context:component-scan base-package="com.kamirru" /&gt;
  &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager" /&gt;
  
  
  &lt;context:annotation-config /&gt;
  
  
  
  &lt;bean id="viewResolver"
      class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;property name="viewClass"
          value="org.springframework.web.servlet.view.tiles2.TilesView"&gt;
          &lt;!-- &lt;value&gt; &lt;/value&gt; --&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="tilesConfigurer"
      class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"&gt;
      &lt;property name="definitions"&gt;
          &lt;list&gt;
              &lt;value&gt;/WEB-INF/config/tiles.xml&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="${database.driver}" /&gt;
      &lt;property name="url" value="${database.url}" /&gt;
      &lt;property name="username" value="${database.user}" /&gt;
      &lt;property name="password" value="${database.password}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="annotatedClasses"&gt;
          &lt;list&gt;
              &lt;value&gt;com.kamirru.model.Rez&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="hibernateTransactionManager"
      class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
  &lt;/bean&gt;
  
  
  &lt;mvc:resources location="/resources/*" mapping="/resources/**"/&gt;
  &lt;mvc:annotation-driven /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Tiles config file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE tiles-definitions PUBLIC
     "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
     "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"&gt;
  
  &lt;tiles-definitions&gt;
  
  &lt;!-- Widok: Header, body, footer --&gt;
  
  &lt;definition name="nomenu" template="/WEB-INF/views/welcomeTemplate.jsp"&gt;
      &lt;put-attribute name="title" value=""&gt;&lt;/put-attribute&gt;
      &lt;put-attribute name="header" value="/WEB-INF/views/header.jsp"&gt;&lt;/put-attribute&gt;
      &lt;put-attribute name="body" value=""&gt;&lt;/put-attribute&gt;
      &lt;put-attribute name="footer" value="/WEB-INF/views/footer.jsp"&gt;&lt;/put-attribute&gt;
  &lt;/definition&gt;
  
  &lt;definition name="welcome" extends="nomenu"&gt;
      &lt;put-attribute name="body" value="/WEB-INF/views/welcome.jsp"&gt;&lt;/put-attribute&gt;
  &lt;/definition&gt;
  
  &lt;/tiles-definitions&gt;
  </code></pre>
  
  <p>The web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;sdnext&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/config/sdnext-servlet.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;sdnext&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.html&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;!--    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;statCont&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.js&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt; --&gt;
  
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And finally the welcome.jsp:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-2" ?&gt;
  &lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:c="http://java.sun.com/jsp/jstl/core"
  xmlns:spring="http://www.springframework.org/tags"
  xmlns:h="http://java.sun.com/jsf/html" version="2.0"&gt;
  &lt;jsp:directive.page language="java"
      contentType="text/html; charset=ISO-8859-2" pageEncoding="ISO-8859-2" /&gt;
  &lt;jsp:text&gt;
      &lt;![CDATA[ &lt;?xml version="1.0" encoding="ISO-8859-2" ?&gt; ]]&gt;
  &lt;/jsp:text&gt;
  &lt;jsp:text&gt;
      &lt;![CDATA[ &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; ]]&gt;
  &lt;/jsp:text&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  
  
  
  &lt;script type="text/javascript" src="${pageContext.request.contextPath}/resources/js_main/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"
  src="${pageContext.request.contextPath}/resources/js_slides/jquery.cycle2.js"&gt;&lt;/script&gt; 
  
  
  
  &lt;!-- 
   &lt;script type="text/javascript" src="&lt;c:url value="/resources/js_main/jquery.min.js" /&gt;"&gt;&lt;/script&gt;
   &lt;script type="text/javascript" src="&lt;c:url value="/resources/js_slides/jquery.cycle2.js" /&gt;"&gt;&lt;/script&gt;
   --&gt; 
  
  
  
   &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" /&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt;
  
     &lt;div class="cycle-slideshow"
      data-cycle-fx="scrollHorz"
    data-cycle-pause-on-hover="false"
    data-cycle-speed="2000"
  &gt;
  &lt;img src="${pageContext.request.contextPath}/resources/img/1.jpg"&gt;&lt;/img&gt;
  &lt;img src="${pageContext.request.contextPath}/resources/img/2.jpg"&gt;&lt;/img&gt;
  &lt;/div&gt;
  &lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;/jsp:root&gt;
  </code></pre>
  
  <p>As you can see the </p>
  
  <pre><code>&lt;script type="text/javascript" src="${pageContext.request.contextPath}/resources/js_main/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"
  src="${pageContext.request.contextPath}/resources/js_slides/jquery.cycle2.js"&gt; &lt;/script&gt; 
  </code></pre>
  
  <p>are not commented. If I comment it, the img`s will be displayed on the webpage, but when I am trying to include the javascripts it:
  - shows only the header of the page (in this case)</p>
  
  <p>Or: </p>
  
  <ul>
  <li>There is an error message "The value of attribute "src" associated with an element type "script" must not contain the '&lt;' character." (when Using {src="
  </ul>
  
  <p>Could you please help? 
  How could I include the js to that project?</p>