您的位置:首页 > 编程语言 > Java开发

struts第十三天--输出带占位符的资源信息

2012-10-21 18:26 357 查看
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>

<constant name="struts.custom.i18n.resources" value="isoftstone"/>

<package name="person" namespace="/person" extends="struts-default">

<action name="manage" class="com.isoftstone.study.PersonManagerAction">

<result name="message">/WEB-INF/page/message.jsp</result>

</action>

</package>

</struts>

welcome={0}\uFF0Cwelcome to isoftstone{1}

welcome={0}\uFF0C\u6B22\u8FCE\u6765\u5230\u8F6F\u901A\u52A8\u529B{1}

package com.isoftstone.study;

import com.opensymphony.xwork2.ActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class PersonManagerAction extends ActionSupport{

@Override

public String execute() throws Exception {

ActionContext.getContext().put("message", this.getText("welcome",new String[]{"wangjin","day day up!"}));

return "message";

}

}

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib uri="/struts-tags" prefix="s" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>国际化</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">

</head>

<body>

<s:text name="welcome">

<s:param>wangjin</s:param>

<s:param>study</s:param>

</s:text>

</body>

</html>

message.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib uri="/struts-tags" prefix="s" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>国际化</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">

</head>

<body>

<s:text name="welcome">

<s:param>wangjin</s:param>

<s:param>study</s:param>

</s:text>

</body>

</html><%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib uri="/struts-tags" prefix="s" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>国际化</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">

</head>

<body>

<s:text name="welcome">

<s:param>wangjin</s:param>

<s:param>study</s:param>

</s:text>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐