【问题标题】:Spring Roo , jQuery, jQueryMobileSpring Roo,jQuery,jQueryMobile
【发布时间】:2012-02-29 23:19:49
【问题描述】:

我正在尝试在 Spring Roo 中使用 jQuery Mobile。

当我登录到我的应用程序时,应用程序会显示最后包含的 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>

【问题讨论】:

    标签: jquery-mobile spring-roo


    【解决方案1】:

    这对我来说是一个愚蠢的问题。

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

    把它们移到

    /src/main/resources/web-resources

    如下:

    <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>
    

    现在它可以按预期工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多