java - Running script files and use of Css files with Spring MVC? -


i'm developing spring mvc application , have login page (login.jsp) should call scripts , link css files . problem applications doesn't run scripts .

here files ;

web.xml

  <servlet-mapping>   <servlet-name>default</servlet-name>   <url-pattern>*.css</url-pattern>  </servlet-mapping>   <servlet-mapping>     <servlet-name>default</servlet-name>     <url-pattern>/ressources/js/*</url-pattern>  </servlet-mapping> 

my mvc dispatcher spring file :

    <mvc:resources mapping="/resources/**" location="/ressources/" />      <mvc:resources mapping="/scripts/**" location="/ressources/js/" />      <bean      class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter" />      <bean     class="org.springframework.web.servlet.mvc.annotation.defaultannotationhandlermapping">      </bean>         <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> 

login.jsp calling script files , css files

<% string init="<c:url value='/resources/js/init.js'>";%> <% string grid="<c:url value='/resources/css/5grid/init.js?use=mobile,desktop,1000px&mobileui=1&mobileui.theme=none&mobileui.titlebaroverlaid=1&viewport_is1000px=1060'>";%> <% string query="<c:url value='/resources/js/jquery-1.8.3.min.js'>";%> <% string drop="<c:url value='/resources/js/jquery.dropotron-1.2.js'>";%>  <link href="http://fonts.googleapis.com/css?family=source+sans+pro:300,400,700,900,300italic" rel="stylesheet" /> <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="<%=grid%>"></script> <script src="<%=drop%>"></script> <script src="<%=init%>"></script> <noscript>     <link rel="stylesheet" href="<c:url value='/resources/css/5grid/core.css' />"/>     <link rel="stylesheet" href="<c:url value='/resources/css/5grid/core-desktop.css' />"/>     <link rel="stylesheet" href="<c:url value='/resources/css/5grid/core-1200px.css' />"/>     <link rel="stylesheet" href="<c:url value='/resources/css/5grid/core-noscript.css' />"/>     <link rel="stylesheet" href="<c:url value='/resources/css/style.css' />"/>     <link rel="stylesheet" href="<c:url value='/resources/css/style-desktop.css' />"/> </noscript> 

when displaying page there no styles used components displayed there no scripts , no css file .

any 1 please have solution problem ?? thank

in resource mappings have misspelled resources. not have contain 2 s characters.

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

as opposed to:

  <mvc:resources mapping="/resources/**" location="/ressources/" />    <mvc:resources mapping="/scripts/**" location="/ressources/js/" /> 

notice when load css , scripts under resource directory opposed ressources

<link rel="stylesheet" href="<c:url value='/resources/css/style-desktop.css' />"/>   <% string drop="<c:url value='/resources/js/jquery.dropotron-1.2.js'>";%> 

the dispatcher servlet attempt handle request instead of letting them pass through.

also change dispatcher servlet mapping in web.xml file.

  <servlet-mapping>     <servlet-name>mvc-dispatcher</servlet-name>     <url-pattern>/*</url-pattern>   </servlet-mapping> 

mapping / cause dispatcher handle requests, while mapping /* cause dispatcher handle requests not mapped resource.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -