feat: 상세 에러 메시지를 보여줄 수 있는 JSP 페이지 추가

main
thkim 2025-10-21 09:59:30 +09:00
parent 34e9421ba2
commit cd026187c1
2 changed files with 49 additions and 7 deletions

View File

@ -31,7 +31,7 @@ public class DrillingCommonController {
DrillingInquiryService drillingInquiryService;
@RequestMapping(value = "/drilling/common/includeTopMenu.do")
public String memberRegi(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
public String memberRegi(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletRequest request, HttpServletResponse response) {
if(request.getSession().getAttribute("USERNAME") == null){
return "isError";
@ -44,14 +44,22 @@ public class DrillingCommonController {
Map<String, Object> map = new HashMap<String, Object>();
map.put("userid", String.valueOf(request.getSession().getAttribute("USERID")));
Map<String, Object> result = loginService.selectWebMemberIn(map);
try {
Map<String, Object> result = loginService.selectWebMemberIn(map);
model.put("masterCompanyCode", result.get("master_company_code"));
} catch (Exception e) {
model.put("errorMessage", "계정이 존재하지 않습니다");
return "/error";
}
model.put("masterCompanyCode", result.get("master_company_code"));
HashMap<String, Object> spGetProjectMbrParams = drillingInquiryService.spGetProjectMbr( request, params, String.valueOf(request.getSession().getAttribute("USERID")) );
model.addAttribute("mbr", spGetProjectMbrParams);
try {
HashMap<String, Object> spGetProjectMbrParams = drillingInquiryService.spGetProjectMbr( request, params, String.valueOf(request.getSession().getAttribute("USERID")) );
model.addAttribute("mbr", spGetProjectMbrParams);
} catch (Exception e) {
model.put("errorMessage", e.getMessage());
return "/error";
}
return "/drilling/common/includeTopMenu";
}

View File

@ -0,0 +1,34 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%-- 1. 인코딩 UTF-8로 변경 --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%-- 2. JSTL 태그 라이브러리 추가 --%>
<html>
<head>
<title>지반정보 포털시스템 - 오류</title>
</head>
<body>
<div style="text-align: center; width: 100%; padding-top: 20px;">
<div class="errorContentView">
<div style="position: relative; top: 12px; left: 10px;">
<h3>페이지를 찾을 수 없습니다.</h3>
<div class="errorContentBody">
<pre>
올바른 웹페이지 주소가 아니거나, 시스템 오류가 발생했습니다. 에러페이지.
<%-- 3. 컨트롤러에서 전달받은 에러 메시지 표시 --%>
<c:if test="${not empty errorMessage}">
<br/>
<strong>[오류 상세 내용]</strong>
<br/>
<c:out value="${errorMessage}" />
</c:if>
</pre>
<br/>
<div style="text-align: center; width: 100%;">
<a href="/" >홈으로</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>