可以动态传递动作名称吗?
我正在使用struts2,我需要做多语言选项,我已将语言选项放入所有页面的标题中。我可以知道,可以在struts.xml文件中动态传递动作名称。动作名称是动态的还是静态的?有人可以帮助我吗,先谢谢了。
例如:在struts.xml文件中
$(curActionName)
am using struts2, i need to do multi language option, language option i have put in header of the all pages.May i know, to pass action name at dynamically it is possible in struts.xml file.action name is dynamic or static? can anybody help me please, advance in thanks.
for example:In the struts.xml file
$(curActionName)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先可以使用通配符方法动态选择动作。本教程将帮助您了解通配符映射。
http://struts.apache.org/2.0.6/docs/wildcard -mappings.html
但是,由于您正在谈论多种语言支持,如果您想要的只是用不同语言呈现同一页面,那么您将不需要动态操作,因为 struts 已经具有优雅的国际化功能,您只需维护属性文件对于每种语言。这使得维护您的网站变得更加容易。您可以在此处了解更多内容。
http://struts.apache.org/2.0.14/docs/localization.html
firstly action can be selected dynamically by using the wild card method. this tutorial will help you understand wild card mappings.
http://struts.apache.org/2.0.6/docs/wildcard-mappings.html
However since you are talking about many language support if all you want is rendering same page in different languages you will not need dynamic action as struts already has an elegant internationalization feature where you just have to maintain properties file for each language. this makes it easier to maintain your website.you can study more of this here.
http://struts.apache.org/2.0.14/docs/localization.html