admin管理员组文章数量:1356436
I am working on the Struts2 framework with JSP.
In my samplePrj.properties
file, in that
.samplePrj.Successmessage = Saved Successful
is an attribute. I need to use this value in my JSP page, using Struts2.
so how can I get the value of ".samplePrj.Successmessage"
in my JSP page.
I am working on the Struts2 framework with JSP.
In my samplePrj.properties
file, in that
.samplePrj.Successmessage = Saved Successful
is an attribute. I need to use this value in my JSP page, using Struts2.
so how can I get the value of ".samplePrj.Successmessage"
in my JSP page.
2 Answers
Reset to default 4Use the text
tag
<s:i18n name="samplePrj">
<s:text name=".samplePrj.Successmessage" />
</s:i18n>
it will load the bundle using i18n
tag from samplePrj.properties
and print the value from key .samplePrj.Successmessage
in it.
or you can use it with getText()
but your action class should extend ActionSupport
.
<s:property value="getText('.samplePrj.Successmessage')"/>
You can use getText() method to read from properties files.
<s:set var="variable" value="getText('.samplePrj.Successmessage')"/>
<s:if test="myVariable == #variable">
//do what u want
</s:if>
本文标签: javaUsing getText() for the getting property in Struts 2Stack Overflow
版权声明:本文标题:java - Using getText() for the getting property in Struts 2 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743985712a2571267.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论