2015/05/13
[php] 기본 페이징 코드
// 전체 게시물수
$totalCnt = $row['cnt'];
// 한 페이지 게시글 수
$onePagePer = 15;
// 전체 페이지 수
$totalPageCnt = ceil($totalCnt / $onePagePer);
if ($page < 1 && $page > $totalPageCnt) {
?>
<script type="text/javascript">
alert('존재하지 않는 페이지 입니다.');
history.back();
</script>
<?php
exit;
}
// 한번에 보여줄 총 페이지 개수
$oneSectionPer = 10;
// 현재 섹션
$currentSection = ceil($page / $oneSectionPer);
// 전체 섹션의 수
$totalSectionCnt = ceil($totalPageCnt / $oneSectionPer);
// 현재 섹션의 처음 페이지
$firstPage = ($currentSection * $oneSectionPer) - ($oneSectionPer - 1);
if ($currentSection == $totalSectionCnt) {
// 현재 섹션이 마지막 섹션이라면 $totalPageCnt가 마지막 페이지가 된다
$lastPage = $totalPageCnt;
} else {
$lastPage = $currentSection * $oneSectionPer;
}
// 이전페이지
$prevPage = (($currentSection - 1) * $oneSectionPer);
// 다음 페이지
$nextPage = (($currentSection + 1) * $oneSectionPer) - ($oneSectionPer - 1);
// 페이징을 저장할 변수
$paging = '<ul>';
// 첫페이지가 아니라면 처음 버튼을 생성
if ($page != 1) {
$paging .= '<li class="page page_start"><a href="./index.php?page=1">처음</a></li>';
}
// 첫 섹션이 아니라면 이전 버튼을 생성
if ($currentSection != 1) {
$paging .= '<li class="page page_prev"><a href="./index.php?page=' .$prevPage. '">이전</a></li>';
}
for ($i = $firstPage; $i <= $lastPage; $i++) {
if ($i == $page) {
$paging .= '<li class="page current">' .$i. '</li>';
} else {
$paging .= '<li class="page"><a href="./index.php?page=' .$i. '">' .$i. '</a></li>';
}
}
//마지막 섹션이 아니라면 다음 버튼을 생성
if ($currentSection != $totalSectionCnt) {
$paging .= '<li class="page page_next"><a href="./index.php?page=' .$nextPage. '">다음</a></li>';
}
// 마지막 페이지가 아니라면 끝 버튼을 생성
if ($page != $totalPageCnt) {
$paging .= '<li class="page page_end"><a href="./index.php?page='.$totalPageCnt.'">끝</a></li>';
}
$paging .= '</ul>';
/* 페이징 끝 */
$currentLimit = ($onePagePer * $page) - $onePagePer;
$sqlLimit = ' LIMIT ' .$currentLimit. ', '.$onePagePer;
$sql = 'SELECT * FROM board_free ORDER BY b_no DESC' .$sqlLimit;
$result = $db->query($sql);
2014/12/16
[MyBatis] parametertype string test (There is no getter for property named 'xxxx' in 'class java.lang.String')
Mybatis에서 parametertype이 String이나 int 같은 기본형인 경우
=============================
<if test="abc == null ">
...
</if>
=============================
위와 같이 사용시
There is no getter for property named 'abc' in 'class java.lang.String'
라는 에러 발생
...
이럴때는
=============================
<if test="_parameter == null ">
...
</if>
=============================
위와 같이 테스트할 파라미터 이름을 '_parameter' 로 바꿔주면
정상적으로 동작한다.
참고 :
http://devwa.com/47
2014/11/26
[JavaScript] 팝업창 열기, 닫기 (popup window open and close)
function fnPopup() {
var popupOption = 'directories=no, toolbar=no, location=no, menubar=no, status=no, scrollbars=no, resizable=no, left=400, top=200, width=440, height=550';
window.open(URL, name, popupOption);
}
function fnClose() {
window.opener.location.href = URL;
window.close();
}
참고 :
http://www.w3schools.com/jsref/met_win_open.asp
2014/11/19
[RegExp] Non-breaking space (char code 160) replace
- Non-breaking space
- ASCII character 160
- char code 160
-  
- \u00A0
- %A0
-
볼때는 일반적인 공백으로 보이지만 따로 처리해줘야 할 경우가 생겼다.
RegExp = /\u00A0/ or / /
value = value.replace(/\u00A0/g, ' ');
or
value = value.replace(/ /g, ' ');
출처 :
http://stackoverflow.com/questions/3794919/replace-all-spaces-in-a-string-with
http://www.adamkoch.com/2009/07/25/white-space-and-character-160/
- ASCII character 160
- char code 160
-  
- \u00A0
- %A0
-
볼때는 일반적인 공백으로 보이지만 따로 처리해줘야 할 경우가 생겼다.
RegExp = /\u00A0/ or / /
value = value.replace(/\u00A0/g, ' ');
or
value = value.replace(/ /g, ' ');
출처 :
http://stackoverflow.com/questions/3794919/replace-all-spaces-in-a-string-with
http://www.adamkoch.com/2009/07/25/white-space-and-character-160/
2014/11/17
[SQL] VARCHAR 필드 숫자로 정렬 (SORT A VARCHAR2 FIELD AS A NUMERIC FIELD)
- 해당 필드에 숫자만 있는 경우
ORDER BY TO_NUMBER(FIELD);
- 해당 필드에 숫자 이외의 값도 있는 경우
ORDER BY LPAD(FIELD, 10);
// 10 == FIELD.length
출처 :
http://www.techonthenet.com/oracle/questions/sort1.php
[RegExp] 8자리 이상 16자리 이하 영문, 숫자, 특수문자 조합
암호규칙 정규식
var pwReg = /^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{8,16}$/;
if (pwReg.test(pw)) {
return true;
} else {
return false;
}
var pwReg = /^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{8,16}$/;
if (pwReg.test(pw)) {
return true;
} else {
return false;
}
2014/11/12
[Spring] Spring @responsebody 한글 깨짐
======================================
스프링 3.1 이하
======================================
- 리턴을 ResponseEntity 타입으로 함
- 헤더에 캐릭터셋을 설정해서 보냄
@RequestMapping("/ajax")
@ResponseBody
public ResponseEntity handleAJAX() {
....로직....
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "text/html; charset=utf-8");
return new ResponseEntity("한글", responseHeaders, HttpStatus.CREATED);
}
======================================
스프링 3.2 이상
======================================
- @RequestMapping의 produces 옵션이 생겨 좀 더 쉽게 적용 가능함
@RequestMapping(value = "/ajax", produces = "application/json; charset=utf8")
public String handleAJAX() {
....로직....
return "한글"
}
출처 :
http://softline21c.blogspot.kr/2012/06/springmvc-responsebody.html
http://novafactory.net/archives/3126
스프링 3.1 이하
======================================
- 리턴을 ResponseEntity 타입으로 함
- 헤더에 캐릭터셋을 설정해서 보냄
@RequestMapping("/ajax")
@ResponseBody
public ResponseEntity handleAJAX() {
....로직....
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "text/html; charset=utf-8");
return new ResponseEntity("한글", responseHeaders, HttpStatus.CREATED);
}
======================================
스프링 3.2 이상
======================================
- @RequestMapping의 produces 옵션이 생겨 좀 더 쉽게 적용 가능함
@RequestMapping(value = "/ajax", produces = "application/json; charset=utf8")
public String handleAJAX() {
....로직....
return "한글"
}
출처 :
http://softline21c.blogspot.kr/2012/06/springmvc-responsebody.html
http://novafactory.net/archives/3126
2014/11/05
[JavaScript] 영문, 숫자, 특수문자, 자릿수 제한 (정규식 이용)
var check = /^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{8,16}$/;
if (!check.test(pw)) {
// fail
} else {
// success
}
if (!check.test(pw)) {
// fail
} else {
// success
}
2014/11/04
[Spring] @ModelAttribute를 배열(ArrayList)로 받아서 사용하기
public class TestVo {
//자기 자신을 참조하여 리스트를 리턴하도록 한다.
private List<TestVo> testList;
private String key;
private String name;
private String phone;
private Date birth;
private int age;
private boolean married;
public List<TestVo> getTestList() {
return testList;
}
public void setTestList(List<TestVo> testList) {
this.testList = testList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isMarried() {
return married;
}
public void setMarried(boolean married) {
this.married = married;
}
}
JSP :
<input name="testList[0].name" />
...
<input name="testList[1].name" />
...
참고 :
http://reikop.tistory.com/16
http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/
//자기 자신을 참조하여 리스트를 리턴하도록 한다.
private List<TestVo> testList;
private String key;
private String name;
private String phone;
private Date birth;
private int age;
private boolean married;
public List<TestVo> getTestList() {
return testList;
}
public void setTestList(List<TestVo> testList) {
this.testList = testList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isMarried() {
return married;
}
public void setMarried(boolean married) {
this.married = married;
}
}
JSP :
<input name="testList[0].name" />
...
<input name="testList[1].name" />
...
참고 :
http://reikop.tistory.com/16
http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/
[SQL] 테이블 컬럼 카멜 표기법 변환기 (HTML)
<html>
<head>
<title>테이블 컬럼 카멜 표기법 변환기</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
// default data
var sample = ['USER_ID\n'];
sample.push('ADDR_HOME_STREET\n');
sample.push('YOU_LOVE_ME_SO_MUCH\n');
$('#monkeyinput').text(sample.join(''));
$('#code_basic').click();
});
function convert() {
var input = $('#monkeyinput').val();
var count = 0;
var output1 = '';
var output2 = '';
var lines = input.split(/\n/);
for(var i = 0, maxi = lines.length; i < maxi; i++) {
var before = lines[i];
before = $.trim(before.toLowerCase());
// skip empty lines
if(before == '') {
continue;
}
// conversion
var after = before.replace(/_(\w)/g, function(word) {
return word.toUpperCase();
});
after = after.replace(/_/g, "");
// console.log('\t' + before + ' ->> ' + after);
// make result for each
if($('#code_basic:checked').val()) {
output1 += (after + '\n');
}
// Value Object
else if($('#code_vo:checked').val()) {
var modifier = $('#modifier option:selected').val();
var datatype = $('#datatype option:selected').val();
// hibernate annatation
if(document.conf.hibernate.checked) {
output1 += ('@Column(name = "' + before + '")\n' + modifier + ' ' + datatype + ' ' + after + ';\n\n');
}
else {
output1 += (modifier + ' ' + datatype + ' ' + after + ';\n');
}
}
// ResultMap
else if($('#code_resultmap:checked').val()) {
output1 += ('\t<result property="' + after + '" column="' + before + '" />\n');
}
// Select
else if($('#code_select:checked').val()) {
before=before.toUpperCase();
if(count == 0) {
output1 += (before + ' AS ' + after);
}
else {
output1 += (',\n\t' + before + ' AS ' + after);
}
if(count == 0) {
output2 += (before + ' = #{' + after + '}\n');
}
else {
output2 += ('AND\t' + before + ' = #{' + after + '}\n');
}
}
// Insert
else if($('#code_insert:checked').val()) {
if(count == 0) {
output1 += (before);
}
else {
output1 += (', ' + before);
}
if(count == 0) {
output2 += ('#{' + after + '}');
}
else {
output2 += (', #{' + after + '}');
}
}
// Update
else if($('#code_update:checked').val()) {
if(count == 0) {
output1 += (before + ' = #{' + after + '}#');
}
else {
output1 += (',\n\t' + before + ' = #{' + after + '}');
}
if(count == 0) {
output2 += (before + ' = #{' + after + '}\n');
}
else {
output2 += ('AND\t' + before + ' = #{' + after + '}\n');
}
}
// Delete
else if($('#code_delete:checked').val()) {
if(count == 0) {
output1 += (before + ' = #{' + after + '}\n');
}
else {
output1 += ('AND\t' + before + ' = #{' + after + '}\n');
}
}
else {
output1 += (after + '\n');
}
count++;
}
var output = '';
if($('#code_basic:checked').val()) {
output = output1;
}
else if($('#code_vo:checked').val()) {
output = output1;
}
else if($('#code_resultmap:checked').val()) {
output = '<resultMap id="' + document.conf._id.value + '" class="' + document.conf._class.value + '">\n';
output += output1;
output += '</resultMap>';
}
else if($('#code_select:checked').val()) {
output = 'SELECT\t';
output += output1 + '\n';
output += 'FROM\t' + getTableName() + ' \n';
output += 'WHERE\t';
output += output2;
}
else if($('#code_insert:checked').val()) {
output = 'INSERT INTO ' + getTableName() + '(' + output1 + ') \n';
output += 'VALUES(' + output2 + ')';
}
else if($('#code_update:checked').val()) {
output = 'UPDATE\t' + getTableName() + ' \n';
output += 'SET\t' + output1 + '\n';
output += 'WHERE\t';
output += output2;
}
else if($('#code_delete:checked').val()) {
output = 'DELETE FROM ' + getTableName() + ' \n';
output += 'WHERE\t';
output += output1;
}
$('#monkeyoutput').text(output);
}
function getTableName() {
var tableName = $('input[name=table]').val();
if(tableName != '') {
return tableName;
}
return '[table_name]';
}
function fillOptionBox() {
var html = [];
html.push('<p>');
html.push('Table: <input id="table" type="text" name="table" onkeyup="convert();" />');
html.push('</p>');
$('#options').html(html.join(''));
$('#table').focus();
convert();
}
</script>
</head>
<body>
<h1>테이블 컬럼 카멜 표기법 변환기</h1>
<p>이 프로그램을 통해 Underscore Notation으로 표기된 테이블 컬럼명을 Camel Notation으로
변환된 자바 필드명으로 변경할 수 있다.</p>
<h2>사용법</h2>
<ol>
<li>테이블정의서에서 복사한 컬럼명을 왼쪽 Textarea에 붙여넣는다.</li>
<li>자동으로 Camel Notation으로 변경된 결과가 우측 Textarea에 표시된다.</li>
<li>필요한 경우 여러가지 Conversion Style을 선택할 수 있다.
<ul>
<li>Basic: 기본적인 Camel Notation 변환만 수행</li>
<li>VO: 자바의 필드 선언문으로 변환 (Hibernate Annotation도 추가로 지정 가능)</li>
<li>ResultMap: iBatis에서 사용하는</li>
<li>Select: iBatis에서 사용하는 select 쿼리문으로 변환</li>
<li>Insert: iBatis에서 사용하는 insert 쿼리문으로 변환</li>
<li>Update: iBatis에서 사용하는 update 쿼리문으로 변환</li>
<li>Delete: iBatis에서 사용하는 delete 쿼리문으로 변환</li>
</ul>
</li>
<li>우측 Textarea의 결과를 복사하여 필요한 곳에서 사용한다.</li>
</ol>
<form name="conf">
<fieldset>
<legend> Configurations </legend>
<p>
<strong>Conversion Style</strong> <br>
<input id="code_basic" type="radio" name="code" checked />
<label for="code_basic">Basic</label>
<input id="code_vo" type="radio" name="code" />
<label for="code_vo">VO</label> <input id="code_resultmap" type="radio" name="code" />
<label for="code_resultmap">ResultMap</label>
<input id="code_select" type="radio" name="code" />
<label for="code_select">Select</label>
<input id="code_insert" type="radio" name="code" />
<label for="code_insert">Insert</label>
<input id="code_update" type="radio" name="code" />
<labelfor="code_update">Update</label>
<input id="code_delete" type="radio" name="code" />
<label for="code_delete">Delete</label>
<script type="text/javascript">
$('#code_basic').click(function() {
$('#options').html('');
convert();
});
$('#code_vo').click(function() {
var html = [];
html.push('<p>');
html.push('<strong>Modifier Datatype</strong><br>');
html.push('<select id="modifier" onchange="convert();">');
html.push(' <option>public</option>');
html.push(' <option>protected</option>');
html.push(' <option selected>private</option>');
html.push('</select>');
html.push('<select id="datatype" onchange="convert();">');
html.push(' <option>int</option>');
html.push(' <option>long</option>');
html.push(' <option>float</option>');
html.push(' <option>double</option>');
html.push(' <option>byte[]</option>');
html.push(' <option>boolean</option>');
html.push(' <option>char</option>');
html.push(' <option selected>String</option>');
html.push('</select>');
html.push('</p>');
html.push('<p>');
html.push('<strong>Hibernate</strong><br>');
html.push('<input type="checkbox" name="hibernate" value="hibernate" id="hibernate" onclick="convert();" /><label for="hibernate">Use hibernate annotation</label>');
html.push('</p>');
$('#options').html(html.join(''));
convert();
});
$('#code_resultmap').click(function() {
var html = [];
html.push('<p>');
html.push('id: <input id="_id" type="text" name="id" onkeyup="convert();" /> ');
html.push('class: <input id="_class" type="text" name="class" onkeyup="convert();" />');
html.push('</p>');
$('#options').html(html.join(''));
$('#_id').focus();
convert();
});
$('#code_select').click(fillOptionBox);
$('#code_insert').click(fillOptionBox);
$('#code_update').click(fillOptionBox);
$('#code_delete').click(fillOptionBox);
</script>
</p>
<div id="options"></div>
</fieldset>
</form>
<br>
<p>
<textarea id="monkeyinput" class="camel" style="width: 48.5%; height: 50%;" onkeyup="convert();"></textarea>
<textarea id="monkeyoutput" class="camel" style="width: 48.5%; height: 50%;" readonly></textarea>
</p>
</body>
</html>
<head>
<title>테이블 컬럼 카멜 표기법 변환기</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
// default data
var sample = ['USER_ID\n'];
sample.push('ADDR_HOME_STREET\n');
sample.push('YOU_LOVE_ME_SO_MUCH\n');
$('#monkeyinput').text(sample.join(''));
$('#code_basic').click();
});
function convert() {
var input = $('#monkeyinput').val();
var count = 0;
var output1 = '';
var output2 = '';
var lines = input.split(/\n/);
for(var i = 0, maxi = lines.length; i < maxi; i++) {
var before = lines[i];
before = $.trim(before.toLowerCase());
// skip empty lines
if(before == '') {
continue;
}
// conversion
var after = before.replace(/_(\w)/g, function(word) {
return word.toUpperCase();
});
after = after.replace(/_/g, "");
// console.log('\t' + before + ' ->> ' + after);
// make result for each
if($('#code_basic:checked').val()) {
output1 += (after + '\n');
}
// Value Object
else if($('#code_vo:checked').val()) {
var modifier = $('#modifier option:selected').val();
var datatype = $('#datatype option:selected').val();
// hibernate annatation
if(document.conf.hibernate.checked) {
output1 += ('@Column(name = "' + before + '")\n' + modifier + ' ' + datatype + ' ' + after + ';\n\n');
}
else {
output1 += (modifier + ' ' + datatype + ' ' + after + ';\n');
}
}
// ResultMap
else if($('#code_resultmap:checked').val()) {
output1 += ('\t<result property="' + after + '" column="' + before + '" />\n');
}
// Select
else if($('#code_select:checked').val()) {
before=before.toUpperCase();
if(count == 0) {
output1 += (before + ' AS ' + after);
}
else {
output1 += (',\n\t' + before + ' AS ' + after);
}
if(count == 0) {
output2 += (before + ' = #{' + after + '}\n');
}
else {
output2 += ('AND\t' + before + ' = #{' + after + '}\n');
}
}
// Insert
else if($('#code_insert:checked').val()) {
if(count == 0) {
output1 += (before);
}
else {
output1 += (', ' + before);
}
if(count == 0) {
output2 += ('#{' + after + '}');
}
else {
output2 += (', #{' + after + '}');
}
}
// Update
else if($('#code_update:checked').val()) {
if(count == 0) {
output1 += (before + ' = #{' + after + '}#');
}
else {
output1 += (',\n\t' + before + ' = #{' + after + '}');
}
if(count == 0) {
output2 += (before + ' = #{' + after + '}\n');
}
else {
output2 += ('AND\t' + before + ' = #{' + after + '}\n');
}
}
// Delete
else if($('#code_delete:checked').val()) {
if(count == 0) {
output1 += (before + ' = #{' + after + '}\n');
}
else {
output1 += ('AND\t' + before + ' = #{' + after + '}\n');
}
}
else {
output1 += (after + '\n');
}
count++;
}
var output = '';
if($('#code_basic:checked').val()) {
output = output1;
}
else if($('#code_vo:checked').val()) {
output = output1;
}
else if($('#code_resultmap:checked').val()) {
output = '<resultMap id="' + document.conf._id.value + '" class="' + document.conf._class.value + '">\n';
output += output1;
output += '</resultMap>';
}
else if($('#code_select:checked').val()) {
output = 'SELECT\t';
output += output1 + '\n';
output += 'FROM\t' + getTableName() + ' \n';
output += 'WHERE\t';
output += output2;
}
else if($('#code_insert:checked').val()) {
output = 'INSERT INTO ' + getTableName() + '(' + output1 + ') \n';
output += 'VALUES(' + output2 + ')';
}
else if($('#code_update:checked').val()) {
output = 'UPDATE\t' + getTableName() + ' \n';
output += 'SET\t' + output1 + '\n';
output += 'WHERE\t';
output += output2;
}
else if($('#code_delete:checked').val()) {
output = 'DELETE FROM ' + getTableName() + ' \n';
output += 'WHERE\t';
output += output1;
}
$('#monkeyoutput').text(output);
}
function getTableName() {
var tableName = $('input[name=table]').val();
if(tableName != '') {
return tableName;
}
return '[table_name]';
}
function fillOptionBox() {
var html = [];
html.push('<p>');
html.push('Table: <input id="table" type="text" name="table" onkeyup="convert();" />');
html.push('</p>');
$('#options').html(html.join(''));
$('#table').focus();
convert();
}
</script>
</head>
<body>
<h1>테이블 컬럼 카멜 표기법 변환기</h1>
<p>이 프로그램을 통해 Underscore Notation으로 표기된 테이블 컬럼명을 Camel Notation으로
변환된 자바 필드명으로 변경할 수 있다.</p>
<h2>사용법</h2>
<ol>
<li>테이블정의서에서 복사한 컬럼명을 왼쪽 Textarea에 붙여넣는다.</li>
<li>자동으로 Camel Notation으로 변경된 결과가 우측 Textarea에 표시된다.</li>
<li>필요한 경우 여러가지 Conversion Style을 선택할 수 있다.
<ul>
<li>Basic: 기본적인 Camel Notation 변환만 수행</li>
<li>VO: 자바의 필드 선언문으로 변환 (Hibernate Annotation도 추가로 지정 가능)</li>
<li>ResultMap: iBatis에서 사용하는</li>
<li>Select: iBatis에서 사용하는 select 쿼리문으로 변환</li>
<li>Insert: iBatis에서 사용하는 insert 쿼리문으로 변환</li>
<li>Update: iBatis에서 사용하는 update 쿼리문으로 변환</li>
<li>Delete: iBatis에서 사용하는 delete 쿼리문으로 변환</li>
</ul>
</li>
<li>우측 Textarea의 결과를 복사하여 필요한 곳에서 사용한다.</li>
</ol>
<form name="conf">
<fieldset>
<legend> Configurations </legend>
<p>
<strong>Conversion Style</strong> <br>
<input id="code_basic" type="radio" name="code" checked />
<label for="code_basic">Basic</label>
<input id="code_vo" type="radio" name="code" />
<label for="code_vo">VO</label> <input id="code_resultmap" type="radio" name="code" />
<label for="code_resultmap">ResultMap</label>
<input id="code_select" type="radio" name="code" />
<label for="code_select">Select</label>
<input id="code_insert" type="radio" name="code" />
<label for="code_insert">Insert</label>
<input id="code_update" type="radio" name="code" />
<labelfor="code_update">Update</label>
<input id="code_delete" type="radio" name="code" />
<label for="code_delete">Delete</label>
<script type="text/javascript">
$('#code_basic').click(function() {
$('#options').html('');
convert();
});
$('#code_vo').click(function() {
var html = [];
html.push('<p>');
html.push('<strong>Modifier Datatype</strong><br>');
html.push('<select id="modifier" onchange="convert();">');
html.push(' <option>public</option>');
html.push(' <option>protected</option>');
html.push(' <option selected>private</option>');
html.push('</select>');
html.push('<select id="datatype" onchange="convert();">');
html.push(' <option>int</option>');
html.push(' <option>long</option>');
html.push(' <option>float</option>');
html.push(' <option>double</option>');
html.push(' <option>byte[]</option>');
html.push(' <option>boolean</option>');
html.push(' <option>char</option>');
html.push(' <option selected>String</option>');
html.push('</select>');
html.push('</p>');
html.push('<p>');
html.push('<strong>Hibernate</strong><br>');
html.push('<input type="checkbox" name="hibernate" value="hibernate" id="hibernate" onclick="convert();" /><label for="hibernate">Use hibernate annotation</label>');
html.push('</p>');
$('#options').html(html.join(''));
convert();
});
$('#code_resultmap').click(function() {
var html = [];
html.push('<p>');
html.push('id: <input id="_id" type="text" name="id" onkeyup="convert();" /> ');
html.push('class: <input id="_class" type="text" name="class" onkeyup="convert();" />');
html.push('</p>');
$('#options').html(html.join(''));
$('#_id').focus();
convert();
});
$('#code_select').click(fillOptionBox);
$('#code_insert').click(fillOptionBox);
$('#code_update').click(fillOptionBox);
$('#code_delete').click(fillOptionBox);
</script>
</p>
<div id="options"></div>
</fieldset>
</form>
<br>
<p>
<textarea id="monkeyinput" class="camel" style="width: 48.5%; height: 50%;" onkeyup="convert();"></textarea>
<textarea id="monkeyoutput" class="camel" style="width: 48.5%; height: 50%;" readonly></textarea>
</p>
</body>
</html>
피드 구독하기:
글 (Atom)