问题
I need to perform a language check on the browser and tell which language is used for it by using java and wicket. I tried checking the browser locale but it does not work
回答1:
This may be help you
Enumeration headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()) {
String headerName = (String)headerNames.nextElement();
out.println(headerName);
out.println(request.getHeader(headerName));
}
回答2:
You can use HttpServletRequest.getHeader("header name")
. The header "Accept-Language" gives the language set by the user in the browser.
来源:https://stackoverflow.com/questions/15471020/check-the-browser-language-in-java