/main.do 제거, 처분사전 소유자 행위자 조회 쿼리 오타 수정
parent
42041f94f0
commit
77171ce671
@ -1,10 +1,51 @@
|
||||
<%@ page import="go.kr.project.login.model.SessionVO" %>
|
||||
<%@ page import="go.kr.project.system.menu.model.MenuVO" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="egovframework.filter.XssUtil" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<%!
|
||||
/**
|
||||
* 메뉴 목록을 재귀적으로 탐색하여 첫 번째 유효한 URL을 찾습니다.
|
||||
* @param menus 메뉴 목록
|
||||
* @return 찾은 첫 번째 URL, 없으면 null
|
||||
*/
|
||||
public String findFirstUrl(List<MenuVO> menus) {
|
||||
if (menus == null) {
|
||||
return null;
|
||||
}
|
||||
for (MenuVO menu : menus) {
|
||||
// 현재 메뉴에 URL이 있으면 바로 반환
|
||||
String menuUrl = menu.getMenuUrl();
|
||||
if (menuUrl != null && !menuUrl.trim().isEmpty()) {
|
||||
return menuUrl;
|
||||
}
|
||||
// 자식 메뉴가 있으면 재귀적으로 탐색
|
||||
if (menu.getChildren() != null && !menu.getChildren().isEmpty()) {
|
||||
String childUrl = findFirstUrl(menu.getChildren());
|
||||
if (childUrl != null) {
|
||||
return childUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
%>
|
||||
<%
|
||||
if( session.getAttribute("sessionVO") == null || !((SessionVO) session.getAttribute("sessionVO")).isLogin()){
|
||||
response.sendRedirect("/login/login.do");
|
||||
}else{
|
||||
response.sendRedirect("/main.do");
|
||||
SessionVO svo = (SessionVO)session.getAttribute("sessionVO");
|
||||
List<MenuVO> menus = svo.getMenus();
|
||||
String firstUrl = "/main.do"; // fallback
|
||||
|
||||
if(menus != null && !menus.isEmpty()){
|
||||
String foundUrl = findFirstUrl(menus);
|
||||
if (foundUrl != null) {
|
||||
firstUrl = new XssUtil().unescape(foundUrl);
|
||||
}
|
||||
}
|
||||
response.sendRedirect(firstUrl);
|
||||
}
|
||||
%>
|
||||
Loading…
Reference in New Issue