This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/webapp/WEB-INF/views/error/404.jsp
zhangwei ae191e4a41 错误信息页面国际化修正
Signed-off-by: zhangwei <zhangwei2@iie.ac.cn>
2018-11-02 10:40:53 +08:00

49 lines
1.7 KiB
Plaintext

<%
response.setStatus(404);
//获取国际化信息
Properties msgProp = new Properties();
try {
String language = LocaleContextHolder.getLocale().getLanguage();
if (language.equals("zh_cn") || language.equals("zh")) {
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
} else if (language.equals("ru")) {
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
} else {
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
}
} catch (Exception e) {
msgProp = null;
}
// 如果是异步请求或是手机端,则直接返回信息
if (Servlets.isAjaxRequest(request)) {
out.print(msgProp!=null?msgProp.getProperty("notfound_page"):"Page does not exist");
}
//输出异常信息页面
else {
%>
<%@page import="com.nis.web.security.Servlets"%>
<%@page import="java.util.Properties"%>
<%@page import="org.springframework.context.i18n.LocaleContextHolder"%>
<%@page import="com.nis.util.Configurations"%>
<%@page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
<%@include file="/WEB-INF/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>404 - <spring:message code="notfound_page"/></title>
<%@include file="/WEB-INF/include/header.jsp" %>
</head>
<body>
<div class="container-fluid">
<div class="page-header"><h1>404-<spring:message code="notfound_page"/>.</h1></div>
<div><a href="javascript:" onclick="history.go(-1);" class="btn"><spring:message code="return_lastpage"/></a></div>
<script>try{top.$.jBox.closeTip();}catch(e){}</script>
</div>
</body>
</html>
<%
out.print("<!--"+request.getAttribute("javax.servlet.forward.request_uri")+"-->");
} out = pageContext.pushBody();
%>