Check the browser language in java [closed]

一个人想着一个人 提交于 2020-01-25 07:15:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!