开发者

XML as structure + JSF as representation: is it a nice idea?

I haven't met XML and JSF working together. I mean having structure and dictionaries defined in XML and representation in JSF. It will be nice to hear your opinion about this idea.

Consider creating a kind of project-info.xml. It could contain something like this:

<project-info>
    <project-name>My project</project-name>
    <menu-pages>
        <menu-page name="home" view-id="/home.xhtml" title="Home" />
        <menu-page name="compose-letter" view-id="/compose-letter.xhtml" title="Composing a letter" />
        <menu-page name="company" view-id="/company.xhtml" title="Our Company">
            <menu-pages>
                <menu-page name="colleagues" view-id="/colleagues.xhtml" title="Our Colleauges">
                <!-- etc. -->   
            </menu-pages>
        </menu-page>
        <!-- etc. -->
  开发者_运维技巧  </menu-pages>
</project-info>

Using this file it could be easy to separate the structure of the web-site and its jsf-components representation.

It is also easy to support internationalization using XML.

Do you think this concept is not so comfortable in some way? Or are there any other methods to achieve the same separation result?


Simply use Facelets !

Facelets is a library for JSF that introduces the concept of templating. That's exactly what you are doing here. Note that JSF 2.0 includes natively this library.

Concerning the internationalization, Java and JSF already provide some functionalities for that (I am thinking about messageBundles <f:loadBundle/>).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜