简体   繁体   English

如何在GVnix / Spring Roo项目中添加Javascript

[英]How add Javascript in GVnix/Spring roo project

I'm developing a web application and I want add a js file in my project to use it. 我正在开发一个Web应用程序,我想在项目中添加一个js文件以使用它。 I tried to add in this way: 我试图以这种方式添加:

<spring:url value="/resources/scripts/gestion.js" var="gestion"/>
<script src="${gestion}" type="text/javascript"></script>  

The js loads correctly, but the problem is that the page is not showing anything, if I put this code in the end of the jsp file, before of tag <div> the jquery and another js file of the project not work although I can see the content of the jsp. js正确加载,但是问题是,如果我将此代码放在jsp文件的末尾,标记<div>之前的页面,则页面什么都不显示,但该项目的jquery和另一个js文件却无法正常工作看到j​​sp的内容。

Somebody can help me with this? 有人可以帮我吗?

You should include it into src/main/webapp/WEB-INF/tags/util/load-scripts.tagx file. 您应该将其包含在src / main / webapp / WEB-INF / tags / util / load-scripts.tagx文件中。

This tag is used by src/main/webapp/WEB-INF/layouts/default.jspx which is used by Apache Tiles configuration file src/main/webapp/WEB-INF/layouts/layouts.xml to generate the final html output. src / main / webapp / WEB-INF / layouts / default.jspx使用此标记, Apache Tiles配置文件src / main / webapp / WEB-INF / layouts / layouts.xml使用此标记来生成最终的html输出。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM