Java EE目录结构 [英] Java EE Directory Structure
问题描述
我对以下教程有疑问:
http://www.mkyong.com/jsf2/jsf- 2-internationalization-example/
在faces上下文文件中,必须声明所有语言属性文件的位置(<base-name>HERE</base-name>
).但是在该示例中,它们显然使用了maven2,因此它们具有一个资源文件夹.
In faces-context file you have to declare the place where all the language properties-files are (<base-name>HERE</base-name>
). But in that example they use apparently maven2 and so they have a resource folder.
我正在使用Eclipse和动态Web项目,这就是为什么没有资源文件夹的原因.我尝试了一些可能性,例如将新文件夹添加到构建路径,但是我无法正常工作.
I am using eclipse and dynamic web project, that's why there is no resource folder. I tried a few possibilities like adding a new folder to the build path but I don't get it work.
能告诉我请在哪里放置这些文件,以便我的应用找到它.非常感谢
Can you tell me please where to place those files to let my app find it. thank you so much
此外,我还添加了目录结构的图片:
In addition I add a picture of my directory-structure:
推荐答案
它们需要以运行时类路径结尾. WebContent 不是运行时类路径的一部分.
They need to end up in the runtime classpath. The WebContent isn't part of the runtime classpath.
对于您而言,只需将它们放在 Java Resources 文件夹中即可.想象一下,将它们放置在软件包com.example.i18n
中,然后您可以将其指定为基本名称com.example.i18n.locale
(尽管我更喜欢text
或messages
而不是locale
,因为它们实际上不是语言环境文件).
In your case, just drop them in the Java Resources folder. Imagine that they are placed in a package com.example.i18n
, then you can specify as basename com.example.i18n.locale
(although I would prefer text
or messages
over locale
since they are actually no locale files).
这篇关于Java EE目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!