0

I want to create own header.jsp file instead of the one included in the JBoss Portal 2.6 but have to support the locale set by the user.

The original header.jsp does not contain any i18n and I don't know how to do it, especially how to get the actual locale.

4

2 回答 2

1

在 header.jsp 中,使用 scriptlet:

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%
   locale = request.getLocale()  // get the user's locale from the HttpServletRequest

%>

然后设置属性包:

<fmt:setLocale value="<%= locale %>" />

<fmt:setBundle basename="header" />

然后你可以创建

   header_en.properties
   header_de.properties

用于定制消息。

于 2009-02-20T13:06:00.823 回答
0

您可以查看 Thread.currenThread 方法来查看用户的语言。

之后你必须有一个框架来实现 i18n,例如:struts 或 jsf。

于 2008-11-05T12:02:39.827 回答