在Struts 2中将getText()用于geting属性 [英] Using getText() for the getting property in Struts 2

查看:58
本文介绍了在Struts 2中将getText()用于geting属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSP开发Struts2框架.

I am working on the Struts2 framework with JSP.

在我的samplePrj.properties文件中,

com.samplePrj.Successmessage = Saved Successful

是一个属性.我需要在我的JSP页面中使用Struts2使用此值.

is an attribute. I need to use this value in my JSP page, using Struts2.

所以如何在我的JSP页面中获取"com.samplePrj.Successmessage"的值.

so how can I get the value of "com.samplePrj.Successmessage" in my JSP page.

推荐答案

使用 text 标签

<s:i18n name="samplePrj">
    <s:text name="com.samplePrj.Successmessage" />
</s:i18n>

它将使用samplePrj.properties中的 i18n 标记加载捆绑软件,然后从键com.samplePrj.Successmessage中打印值.

it will load the bundle using i18n tag from samplePrj.properties and print the value from key com.samplePrj.Successmessage in it.

,或者您可以将其与getText()一起使用,但是您的操作类应该扩展ActionSupport.

or you can use it with getText() but your action class should extend ActionSupport.

<s:property value="getText('com.samplePrj.Successmessage')"/>

这篇关于在Struts 2中将getText()用于geting属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆