posts - 431,  comments - 344,  trackbacks - 0
公告
 Don't Repeat Yourself
座右铭:you can lose your money, you can spent all of it, and if you work hard you get it all back. But if you waste your time, you're never gonna get it back.
公告本博客在此声明部分文章为转摘,只做资料收集使用。


微信: szhourui
QQ:109450684
Email
lsi.zhourui@gmail.com
<2008年7月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

留言簿(15)

随笔分类(1019)

文章分类(3)

文章档案(21)

收藏夹

Link

好友博客

最新随笔

搜索

  •  

积分与排名

  • 积分 - 855802
  • 排名 - 47

最新评论

阅读排行榜

Grails的web.xml是自动生成的。如果需要修改web.xml该怎么办?

先说一下grails的web.xml的产生过程

Grails的web.xml是在Package.groovy的generateWebXml target中生成的。可以在%Grails_Home%/scripts下找到它。其实在运行grails war时也是先走的这一步。

在generateWebXml里

1.先判断有没有config.grails.config.base.webXml属性,如果有,则使用指定的config.grails.config.base.webXml值作为最终的web.xml

2.如果没有config.grails.config.base.webXml属性。再判断是否存在%Project_Home%/src/templates/war/web.xml,如果存在就使用这个作为最终的web.xml

3.如果上面两个都没有,就使用%Grails_Home%/src/war/WEB-INF/web${servletVersion}.template.xml作为最终的web.xml

根据上面的顺序,我们有3个方法来指定web.xml

第一,可以修改 %Project_Home%/grails-app/conf/Config.groovy 文件,在文件中添加
grails.config.base.webXml = "file:${basedir}/web.xml"
其中${basedir}代表%Project_Home%,就是说会将%Project_Home%/web.xml作为最终的web.xml。

第二,使用 grails install-templates 命令,它会创建%Project_Home%/src/templates/war/web.xml 文件。这样只要修改这个web.xml就行了。

第三,修改%Grails_Home%/src/war/WEB-INF/web${servletVersion}.template.xml文件,但是最好不要这样做。

这里使用Grails 1.0.1

posted on 2008-07-16 22:17 周锐 阅读(893) 评论(0)  编辑  收藏 所属分类: Groovy&Grails

只有注册用户登录后才能发表评论。


网站导航: