달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

JQuery checkbox 컨트롤


1. checkbox checked 여부:
id인 경우:  $('input:checkbox[id="checkbox_id"]').is(":checked") == true
name인 경우: $('input:checkbox[name="checkbox_name"]').is(":checked") == true



2. checkbox 전체 갯수(이 경우는 name인 경우만 가능)
$('input:checkbox[name="checkbox_name"]').length;



3. checkbox 선택된 갯수(이 경우는 name인 경우만 가능)
$('input:checkbox[name="checkbox_name"]:checked').length;



4. checkbox 전체 순회하며 처리(동일한 name으로  여러 개인 경우)
$('input:checkbox[name="checkbox_name"]').each(function(){
      this.checked = true; //checked 처리
      if(this.checked){
         alert(this.value);
      }
});



5.checkbox 전체 값을 순회하며, 비교하여 checked 처리
$('input:checkbox[name="checkbox_name"]').each(function(){
     if(this.value == "비교값"){
        this.checked = true;
     }
});



6.checkbox value값 가져오기(단일건)
$('input:checkbox[id="checkbox_id"]').val();



7. checkbox checked 처리하기(단일건)
$('input:checkbox[id="checkbox_id"]').attr("checked", true);



8. checkbox checked 여부 확인(단일건)
$("#checkbox_id").is(":checked");


Posted by 한설림
|

web.xml 설정

경로 : \프로젝트이름\src\main\webapp\WEB-INF\web.xml

<filter>
     <filter-name>sitemesh</filter-name>
     <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
   </filter>

   <filter-mapping>
     <filter-name>sitemesh</filter-name>
     <url-pattern>/*</url-pattern>
   </filter-mapping>

</filter>

 

sitemesh3.xml 설정

경로 : \프로젝트이름\src\main\webapp\WEB-INF\sitemesh3.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<sitemesh>
  <mapping path="/JSP/KPI/*" decorator="/WEB-INF/jsp/common/decorator/layout.jsp"/>
  <mapping path="/SAMPLE/*" decorator="/WEB-INF/jsp/common/decorator/layout.jsp"/>
  <mapping path="/SERVICE/*" decorator="/WEB-INF/jsp/common/decorator/layout.jsp"/>
  <mapping path="/popup/*" decorator="/WEB-INF/jsp/common/decorator/layout2.jsp"/>

  <mapping path="*/index.jsp" exclude="true"/>    <!-- sitemesh 예외 url  -->

  <mapping path="*/index.do" exclude="true"/>     <!-- sitemesh 예외 url  -->

  <mapping path="*/login_form.html" exclude="true"/>   <!-- sitemesh 예외 url  -->

</sitemesh>

 

pom.xml  설정

경로 : \프로젝트이름\pom.xml

<dependencies>

 <dependency>
   <groupId>org.sitemesh</groupId>
   <artifactId>sitemesh</artifactId>
   <version>3.0.1</version>
  </dependency>

</dependencies>

 

layout.jsp 설정

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE>
<html>
  <head>
   <title>타이틀<sitemesh:write property='title'/></title>
 <meta charset="UTF-8">
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">

 <script type="text/javascript" src="/resource/js/jquery-1.12.4.js"></script>
 <script type="text/javascript" src="/resource/js/jquery-ui-1.10.0.js"></script>
 <script type="text/javascript" src="/resource/js/jquery-blockUI.js"/></script>
 <script type="text/javascript" src="/resource/js/jquery.qtip.min.js"/></script>

 <link rel="stylesheet" type="text/css" href="/resource/css/ui_library.css" />
 <link rel="stylesheet" type="text/css" href="/resource/css/ui_library_new.css" />
 <link rel="stylesheet" type="text/css" href="/resource/css/ui_library_ie7.css" />
 <link rel="stylesheet" type="text/css" href="/resource/css/ui_jquery.css" />
     <sitemesh:write property='head'/>
  </head>
  <body>
  <jsp:include page="/decorator/header.do"></jsp:include>
  <jsp:include page="/decorator/left.do"></jsp:include>
     <div class='mainBody'>
      <sitemesh:write property='body'/>
        </div>
    </div>

    <!-- //contents -->
  </div>
 <div>
  <!-- footer-->
 <%@include file="footer.jsp"%>
 <sitemesh:write property='footer'/>
 <!-- //footer-->
 </div>
  </body>
</html>

Posted by 한설림
|