struts 1.x 国际化

本文介绍如何在Struts框架中实现应用的国际化配置。主要内容包括:在struts-config.xml中添加国际化标签,创建MessageResources.properties文件并定义资源内容,在JSP页面中通过bean标签调用这些国际化资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.在struts-config.xml 中添加国际化标签 <message-resources parameter="MessageResources"></message-resources> 2.在src 中添加 MessageResources.properties 文件 文件内容格式 welcome.title=Struts Blank Application welcome.heading=Welcome! welcome.message=To get started on your own application, copy the struts-blank.war to a new WAR file using the name for your application. Place it in your container's "webapp" folder (or equivalent), and let your container auto-deploy the application. Edit the skeleton configuration files as needed, restart your container, and you are on your way! (You can find the MessageResources.properties file with this message in the /WEB-INF/src folder.) 3.jsp 中添加内容 step 1 添加 bean 标签 step 2 jsp 中使用国际化标签

<message key="welcome.heading"></message>

<message key="welcome.message"></message>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值