2012-02-29 116 views
2

我试图在Spring Roo中使用jQuery Mobile。Spring Roo,jQuery,jQueryMobile

当我登录到我的应用程序时,应用程序显示最后包含的JavaScript文件的源代码。

看看下面的mjquery-scripts.tagx文件。

请注意,无论是最后包含的文件,该文件的源代码都将显示在浏览器中。

地址会像https://testdomain.com:8080/scripts/jquerymobile/jquery.mobile-1.0.min.js

现在,当我键入URL https://testdomain.com:8080/我将显示正确的页面。

问题似乎是在登录时重定向到路径scripts/jquerymobile/jquery.mobile-1.0.min.js。

什么可能导致此问题?

即使我已经指出jquery.mobile这个问题也发生在jquery.min上。

默认的load-scripts.tagx工作得很好。

<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0"> 

<spring:url value="/scripts/jquery-1.7.min.js" var="jQuery_URL" /> 
<spring:url value="/scripts/jquerymobile/jquery.mobile-1.0.min.css" var="mobile_CSS" /> 
<spring:url value="/scripts/jquerymobile/jquery.mobile-1.0.min.js" var="mobile_js" /> 

<link rel="stylesheet" type="text/css" href="${mobile_CSS}"><!-- required for FF3 and Opera --></link> 
<script type="text/javascript" src="${jQuery_URL}"><!-- required for FF3 and Opera --></script> 
<script type="text/javascript" src="${mobile_js}"><!-- required for FF3 and Opera --></script> 

回答

4

事实证明,这是我的一个愚蠢的问题。

我将jquery js文件放在/ src/main/webapp/scripts文件夹中。

搬到他们到

/src目录/主/资源/网络资源

,如下:

<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0"> 

<spring:url value="/resources/jquery-1.7-min/jquery-1.7.min.js" var="jQuery_URL" /> 
<spring:url value="/resources/jquerymobile/jquery.mobile-1.0.min.css" var="mobile_CSS" /> 
<spring:url value="/resources/jquerymobile/jquery.mobile-1.0.min.js" var="mobile_js" /> 

<link rel="stylesheet" type="text/css" href="${mobile_CSS}"><!-- required for FF3 and Opera --></link> 
<script type="text/javascript" src="${jQuery_URL}"><!-- required for FF3 and Opera --></script> 
<script type="text/javascript" src="${mobile_js}"><!-- required for FF3 and Opera --></script> 

</jsp:root> 

现在按预期工作。