Using getText() for the getting property in Struts 2(在 Struts 2 中使用 getText() 获取属性)
问题描述
我正在使用 JSP 开发 Struts2 框架.
I am working on the Struts2 framework with JSP.
在我的 samplePrj.properties 文件中,在那个
In my samplePrj.properties file, in that
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.
推荐答案
使用 文本标签
<s:i18n name="samplePrj">
<s:text name="com.samplePrj.Successmessage" />
</s:i18n>
它将使用 i18n 标签加载包从 samplePrj.properties 并打印其中的键 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() 获取属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Struts 2 中使用 getText() 获取属性
基础教程推荐
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- JPA惰性列表上的流 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
- 将 double 转换为 Int,向下舍入 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
