在为roo添加i18n的中文支持时出现 GPG Passphrase
mvn install后加上参数 -Dgpg.skip ,例如:mvn install -Dgpg.skip
Hibernate中随机抽取实体
q.createQuery("FROM picture ORDER BY rand()").setMaxResults(1);
即可,但要注意:
However this query would require MySQL, so we would sacrifice the benefit of Hibernate acting as an abstraction layer to the underlying database.
roo 中发起用dojo异步请求
dojo.addOnLoad(function() {
dojo.xhrGet({
url: "ajaxUrlhere",
handleAs: "json",
preventCache: true, //IE下要加上这一句防止因缓存导致访问结果得不到更新
load: function() {
// this is where you call whatever Dojo APIs you
// need to on your widget
},
error: function(e) {
console.log("Ajax call failed", e);
}
});
注意除了 xhrGet 还有 xhrPut、 xhrPost 等。xhr 是 XMLHTTPRequest 的简称
FileZilla无法显示中文目录
要改编码,在设置中改成 gb2312 等。
css定位
绝对 和 相对 定位都是“相对的”,表示该元素相对于父元素的位置是绝对的 还是 相对的 。
eclipse中tomcat端口被占用
打开 “程序控制” 一类的系统工具程序,把占用几百M内存的名称是java的程序kill掉。
eclipse 中 svn 同步的问题
- 在
Project->Properties->Java Build Path
路径中,为各项添加**/.svn/**
- > 1. Click on Window -> Preferences > 2. Select Team -> Ignored Resources > 3. Click on Add Pattern and enter “bin” > 4. Click on Add Pattern and enter “target” > 5. Click on Add Pattern and enter “m2-target” > 6. Click on Apply and then OK
生成30min前的·Date·
Date afterDate = new Date(new Date().getTime() - 1000*60*30);
注意Date是毫秒。
Collection 2 Json
new JSONSerializer().exclude("*.class").serialize(List);
或者
new JSONSerializer().exclude("*.class").deepSerialize(Map);
OneToOne persist时出错
确保双方对对方的引用都可以为 null
Roo 定时任务
关键词: TimerTask
应用javascript文件时,js文件文件放在哪个目录可以访问得到
放在 /webapp/js/***下,其中 *js 为新建文件夹。也就是说,网站的资源访问根目录从 webapp 目录开始。
自建view,用field:tag时出现找不到id的错误
在 allication.properties
, *messages_**.propertites*, *messages.propertites*文件中添加tag的id属性值。
${}符号的用途
${} 为jsp解析符号,jsp页面编译时会对其中的expression进行运算,运算结果原地替换。
自建view,但是输入路径找不到资源
记得在相应文件夹中的views.xml文件中添加