• <tfoot id='SKGL2'></tfoot><legend id='SKGL2'><style id='SKGL2'><dir id='SKGL2'><q id='SKGL2'></q></dir></style></legend>
    <i id='SKGL2'><tr id='SKGL2'><dt id='SKGL2'><q id='SKGL2'><span id='SKGL2'><b id='SKGL2'><form id='SKGL2'><ins id='SKGL2'></ins><ul id='SKGL2'></ul><sub id='SKGL2'></sub></form><legend id='SKGL2'></legend><bdo id='SKGL2'><pre id='SKGL2'><center id='SKGL2'></center></pre></bdo></b><th id='SKGL2'></th></span></q></dt></tr></i><div id='SKGL2'><tfoot id='SKGL2'></tfoot><dl id='SKGL2'><fieldset id='SKGL2'></fieldset></dl></div>

      1. <small id='SKGL2'></small><noframes id='SKGL2'>

        • <bdo id='SKGL2'></bdo><ul id='SKGL2'></ul>
      2. Struts2 国际化使用数据库

        Struts2 internationalization using a database(Struts2 国际化使用数据库)

        <legend id='Cv0YU'><style id='Cv0YU'><dir id='Cv0YU'><q id='Cv0YU'></q></dir></style></legend>
          <i id='Cv0YU'><tr id='Cv0YU'><dt id='Cv0YU'><q id='Cv0YU'><span id='Cv0YU'><b id='Cv0YU'><form id='Cv0YU'><ins id='Cv0YU'></ins><ul id='Cv0YU'></ul><sub id='Cv0YU'></sub></form><legend id='Cv0YU'></legend><bdo id='Cv0YU'><pre id='Cv0YU'><center id='Cv0YU'></center></pre></bdo></b><th id='Cv0YU'></th></span></q></dt></tr></i><div id='Cv0YU'><tfoot id='Cv0YU'></tfoot><dl id='Cv0YU'><fieldset id='Cv0YU'></fieldset></dl></div>

            <small id='Cv0YU'></small><noframes id='Cv0YU'>

                <tbody id='Cv0YU'></tbody>
                <bdo id='Cv0YU'></bdo><ul id='Cv0YU'></ul>
                <tfoot id='Cv0YU'></tfoot>
                  本文介绍了Struts2 国际化使用数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我们有一个相当大的应用程序,其中包含大量动态内容.是否有强制 struts 使用数据库进行 i18n 查找,而不是属性文件?

                  We have a rather large application, with a great deal of dynamic content. Is there anyway to force struts to use a database for the i18n lookups, instead of properties files?

                  如果有人用动态内容做过 i18n,我也愿意用其他方法来解决这个问题.

                  I'd be open for other ways to solve this as well, if anyone has ever done i18n with dynamic content.

                  推荐答案

                  我不知道一个简单的即插即用解决方案,所以你可能必须自己实现它——计划花费相当多的花一点时间来了解如何实现 struts 2(和 XWork)的本地化功能.关键可能是提供您自己的 com.opensymphony 实现.xwork2.TextProvider(并通过在 struts.xml 中提供一个 <bean> 标签来告诉 struts 使用它).我至少可以想到两种将其融入整体架构的方法:

                  I don't know of an easy plug-and-play solution for this, so you will probably have to implement it yourself -- plan on spending quite a bit of time just coming to grips with how the localization features of struts 2 (and XWork) are implemented. The key will probably be to provide your own implementation of com.opensymphony.xwork2.TextProvider (and tell struts to use it by providing a <bean> tag in struts.xml). I can think of at least two ways of fitting this into the overall architecture:

                  • 让您的 TextProvider 实现直接访问数据库.本着 YAGNI 的精神,这可能是最好的开始方式(如果需要,您可以随时重构).

                  • Have your TextProvider implementation access the database directly. In the spirit of YAGNI, this is probably the best way to start (you can always refactor later, if necessary).

                  或者,您可以将数据库代码放入 Java 的 ResourceBundle 接口,这是 XWork 内部使用的接口.对我来说,这听起来像是一种更注重设计的方法,但从好的方面来说,还有一些 文章 围绕 描述如何执行此操作.

                  Alternatively, you could place the database code into an implementation of Java's ResourceBundle interface, which is what XWork uses internally. To me this sounds like an even more design-heavy approach, but on the plus side there are some articles around describing how to do this.

                  这篇关于Struts2 国际化使用数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Java Bytecode Manipulation Library Suggestions(Java 字节码操作库建议)
                  Java CLI UI-design: frameworks or libraries?(Java CLI UI 设计:框架还是库?)
                  About the use of Beans.xml configuration file in Spring Framework application(关于Spring Framework应用中Beans.xml配置文件的使用)
                  What is the difference between Spring, Struts, Hibernate, JavaServer Faces, Tapestry?(Spring、Struts、Hibernate、JavaServer Faces、Tapestry 有什么区别?)
                  Are there any android application framework like spring?(有没有像spring这样的android应用程序框架?)
                  Java Swing based game framework. Any advice?(基于 Java Swing 的游戏框架.有什么建议吗?)
                    <legend id='Y9NuT'><style id='Y9NuT'><dir id='Y9NuT'><q id='Y9NuT'></q></dir></style></legend>
                  1. <tfoot id='Y9NuT'></tfoot>

                      • <i id='Y9NuT'><tr id='Y9NuT'><dt id='Y9NuT'><q id='Y9NuT'><span id='Y9NuT'><b id='Y9NuT'><form id='Y9NuT'><ins id='Y9NuT'></ins><ul id='Y9NuT'></ul><sub id='Y9NuT'></sub></form><legend id='Y9NuT'></legend><bdo id='Y9NuT'><pre id='Y9NuT'><center id='Y9NuT'></center></pre></bdo></b><th id='Y9NuT'></th></span></q></dt></tr></i><div id='Y9NuT'><tfoot id='Y9NuT'></tfoot><dl id='Y9NuT'><fieldset id='Y9NuT'></fieldset></dl></div>
                          <tbody id='Y9NuT'></tbody>

                          <bdo id='Y9NuT'></bdo><ul id='Y9NuT'></ul>

                          <small id='Y9NuT'></small><noframes id='Y9NuT'>