struts2警告: The first TextProvider in the ValueStack could not locate the message resource with key

问题描述 : struts2 中,在jsp页面使用<s:text>标签会伴随产生这个警告

解决过程:查看官方API关于这个标签的描述。

  地址:http://struts.apache.org/2.0.14/docs/text.htm

Description

Render a I18n text message.

The message must be in a resource bundle with the same name as the action that it is associated with.

(这个消息必须与action同名资源文件捆绑使用)

In practice this means that you should create a properties file in the same package as your Java class with the same name as your class, but with .properties extension.(在使用过程中应该在java类同一个包下创建一个同名的属性文件,其扩展名为.properties )

If the named message is not found, then the body of the tag will be used as default message. If no body is used, then the name of the message will be used.

For more details on using resource bundles with Struts 2 read the localization guide.

Parameters

Name
Required
Default
Evaluated
Type
Description
idfalse falseStringDeprecated. Use 'var' instead
nametrue falseStringName of resource property to fetch
varfalse falseStringName used to reference the value pushed into the Value Stack

上面的意思是 name是必须的有的标签,id和var不必须有,其中id 标签已经废弃,已经使用var替代id。

解决办法:

在action文件下创建同名资源文件,并定义i18n属性,例如 “user = 用户”

 

原文链接:http://www.cnblogs.com/wangyp/archive/2011/09/18/struts2_s-text_warn.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值