laszlot
laszlot

Reputation: 91

How to create own header.jsp in JBoss Portal with language support?

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.

Upvotes: 0

Views: 1381

Answers (2)

johnbr
johnbr

Reputation: 589

In header.jsp, use a scriptlet:

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

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

%>

and then set the property bundle:

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

<fmt:setBundle basename="header" />

And then you can create

   header_en.properties
   header_de.properties

for customized messages.

Upvotes: 1

Lurtz
Lurtz

Reputation: 427

You can look to Thread.currenThread method to see the user's lang.

After that you have to a framework to implement i18n, ex : struts or jsf.

Upvotes: 0

Related Questions