javascript에서 JSON형태의 값을 alert을 찍을때

alert(변수명); 

[object object]로 나올경우 

alert(JSON.stringify(변수명)); 

으로 찍을경우 해당 값을 확인 할 수 있다.


Two controllers with same name under different packages in Spring

컨트롤러에 두게의 파일 이름을 같을때 @Controller("controller1"),@Controller("controller2") 이런식으로 분기를 해줘야 함


'Back-End > Spring' 카테고리의 다른 글

Spring]Injection of resource dependencies failed 에러  (0) 2019.03.10
Spring 어노테이션 @Resource  (0) 2017.12.13
HashMap  (0) 2017.12.12
Spring 어노테이션 @PathVariable  (0) 2017.06.05

onkeypress 속성은 키보드 이벤트 입니다. 

사용자가 키를 누르고 실행할때(키를 클릭한 시점)에 스크립트를 실행합니다.


1
2
3
4
5
6
7
8
9
10
11
<script type="text/javascript">
<!--
  function eventonkeypress() {
    alert("사용자가 키를 누르고 키를 실행하였습니다.");
  }
-->
</script>
</head>
<body>
  <input name="test" onkeypress="eventonkeypress()">
</body>
cs
와 같이 만듭니다.


위의 소스를 응용해서 사용자가 엔터키를 눌렀을때 발생하도록 하겠습니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="text/javascript">
<!--
  function eventonkeypress() {
    if (event.keyCode==13) {
            alert("사용자가 키를 누르고 키를 실행하였습니다.");
        }   
  }
-->
</script>
</head>
<body>
  <input name="test" onkeypress="eventonkeypress()">
</body>
cs


+ Recent posts