본문 바로가기
SpringBoot

jsp 스크립트 sec:authorize access

by Yeoseungwon 2023. 11. 2.
728x90

<script>

<!--
function fn_regForm_direct() {
		<sec:authorize access="hasAnyRole('ROLE_MANAGER', 'ROLE_THEAD')">
		if($("#searchManagerId").val() == ""){
			alert('강사를 선택해주세요');
			return;
		}else {
		     var selectedLessonTime = document.getElementById("searchLessonTime").value;
		     if (selectedLessonTime === "") {
		        alert("레슨시간을 선택해주세요");
		        return;
		  	 } 
		     
		 }
		</sec:authorize>
		document.frm.action = "<c:url value='/lesson/item/direct/regForm.do'/>";
		document.frm.submit();
	}
	
	function fn_regForm_min() {
		<sec:authorize access="hasAnyRole('ROLE_MANAGER', 'ROLE_THEAD')">
		if($("#searchManagerId").val() == ""){
			alert('강사를 선택해주세요');
			return;
		}else {
		     var selectedLessonTime = document.getElementById("searchLessonTime").value;
		     if (selectedLessonTime === "") {
		        alert("레슨시간을 선택해주세요");
		        return;
		  	 } 
		     
		 }
		</sec:authorize>
		document.frm.action = "<c:url value='/lesson/item/min/regForm.do'/>";
		document.frm.submit();
	}
	
	
	function fn_regForm() {
		<sec:authorize access="hasAnyRole('ROLE_MANAGER', 'ROLE_THEAD')">
		if($("#searchManagerId").val() == ""){
			alert('강사를 선택해주세요');
			return;
		}else {
		     var selectedLessonTime = document.getElementById("searchLessonTime").value;
		     if (selectedLessonTime === "") {
		        alert("레슨시간을 선택해주세요");
		        return;
		  	 } 
		     
		 }
		</sec:authorize>
		document.frm.action = "<c:url value='/lesson/item/regForm.do'/>";
		document.frm.submit();
	}

	function fn_set_pageList(pageNo) {
		document.frm.pageIndex.value = pageNo;
		document.frm.action = "<c:url value='/lesson/item/list.do'/>";
		document.frm.submit();
	}

	function fn_detail(id) {
		document.frm.lessonItemId.value = id;
		document.frm.action = "<c:url value='/lesson/item/updForm.do'/>";
		document.frm.submit();
	}
	//삭제
	function fn_delete(){
		console.log($("[name=lessonItemIdList]").val()); 
		if (confirm('<spring:message code="common.delete.msg" />')) {
			document.frm.action = "<c:url value='/lesson/item/selectList/delete.do'/>";
			document.frm.submit();
		}
	}
	
//-->

 

 

<html> 버튼 

<div class="head">
	 <h2>레슨 시간 목록 <span class="cnt"><fmt:formatNumber value="${resultCnt}" pattern="###,###,###,###.###"/></span></h2>
	 <div class="btns">
	     <a href="javascript:fn_regForm_direct();"><i class="xi-plus-square-o"></i>시간 지정 등록</a>
	          	    
	     <c:if test="${ searchVO.searchLessonTime ne 40}">
		 <a href="javascript:fn_regForm();"><i class="xi-plus-square-o"></i>연속 시간 등록 (시간마다 지정된 분으로)</a>
		 </c:if>
					
		 <a href="javascript:fn_regForm_min();"><i class="xi-plus-square-o"></i>연속 시간 등록 (레슨시간 만큼 연속)</a>
		 <a href="javascript:fn_delete();" class="del">삭제</a>
	   </div>
	 </div>

 

 

<html> select 

<div class="row search-bar">
				<div class="inputs">
				
					<sec:authorize access="hasAnyRole('ROLE_MANAGER')">
					<select name="searchLessonMasterId" id="searchLessonMasterId" title="수업구분" style="margin-right:2px" onchange="fn_search();">
						<c:forEach var="master" items="${lessonMasterList}" varStatus="status">
							<option value="${master.lesson_master_id }" <c:if test="${searchVO.searchLessonMasterId eq master.lesson_master_id }">selected</c:if>>${master.lesson_master_nm }</option>
						</c:forEach>
					</select>
					</sec:authorize>	
					
					<sec:authorize access="hasAnyRole('ROLE_MANAGER', 'ROLE_THEAD')">
					<select name="searchManagerId" id="searchManagerId" title="강사" style="margin-right:5px">
					<option value="" >=== 강사 전체 ===</option>
					<c:forEach var="manager" items="${managerList}" varStatus="status">
						<option value="${manager.uniqId }" <c:if test="${searchVO.searchManagerId eq manager.uniqId }">selected</c:if>>${manager.userName }</option>
					</c:forEach>
					</select>
					</sec:authorize>
					
					<select name="searchLessonTime" id="searchLessonTime" title="레슨시간" style="margin-right:5px" onchange="fn_search();">
						<option value="" <c:if test="${empty searchVO.searchLessonTime}">selected</c:if>>=== 레슨 시간 ===</option>
						<c:forEach var="time" items="${lessonInfo.lesson_time_list}" varStatus="status">
						<option value="${time }" <c:if test="${searchVO.searchLessonTime eq time}">selected</c:if>>${time }</option>
						</c:forEach>
					</select>
					
					<input type="button" onclick="fn_set_pageList(1);" value="검색" class="with-input">
				</div>
			</div>
728x90

'SpringBoot' 카테고리의 다른 글

[Spring Boot] DAO 검색  (0) 2023.11.06
[Spring Boot] jstl 로 스크립트 줄이기  (0) 2023.11.03
[Spring Boot] jsp - controller - service - dao  (0) 2023.11.01
어노테이션  (0) 2023.09.22
MVC  (0) 2023.09.22