[JSTL] ftm ํƒœ๊ทธ๋กœ ๊ธˆ์•ก ์‰ผํ‘œ ํ‘œ์‹œ
๐Ÿ“˜ Retrospect/Personal Projects 2021. 9. 27. 17:54

ํ• ์ธ๊ธˆ์•ก์ด ์ ์šฉ๋œ ๊ฐ€๊ฒฉ์„ JSP์—์„œ ์‰ผํ‘œํ‘œ์‹œํ•˜์—ฌ ๋‚˜ํƒ€๋‚ด๊ณ  ์‹ถ์—ˆ๋‹ค. ๊ฒ€์ƒ‰ ์ค‘ JSTL์˜ fmt ํƒœ๊ทธ๋ฅผ ํ†ตํ•ด ์ˆซ์žํƒ€์ž…์— ๋Œ€ํ•œ ์กฐ์ •์ด ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค. fmt:formatNumber ์ด ํƒœ๊ทธ๋Š” ์ˆซ์ž๊ฐ’์„ ์ˆซ์ž, ํ†ตํ™”, ํผ์„ผํŠธ๋กœ ๋ฐ”๊พผ๋‹ค. ์ ์šฉ ์ฝ”๋“œ ${l.lec_price - (l.lec_price* l.lec_sale)}์› ๐Ÿ“ƒ ์ฐธ๊ณ  https://treasurebear.tistory.com/43 JSTL ๊ธˆ์•ก ํ‘œ์‹œ(์„ธ์ž๋ฆฌ๋งˆ๋‹ค ์‰ผํ‘œ) jsp๋กœ ํ™”๋ฉด์„ ๊ทธ๋ฆฌ๊ณ  ์žˆ๋Š”๋ฐ, ๊ธˆ์•ก์„ ํ‘œ์‹œํ•ด์•ผ ๋˜์„œ ์„ธ์ž๋ฆฌ๋งˆ๋‹ค ์‰ผํ‘œ(, comma)๋ฅผ ๋„ฃ์–ด์ฃผ๊ณ  ์‹ถ์—ˆ๋‹ค. 1,000,000์› ์ด๋ ‡๊ฒŒ! ๊ทธ๋ž˜์„œ tld๋กœ ๋งŒ๋“ค๊นŒ.. script๋กœ ๋งŒ๋“ค๊นŒ.. ๊ณ ๋ฏผํ•˜๋‹ค๊ฐ€, ์ฐพ์•„๋ณด๋‹ˆ jstl์—์„œ ๊ธฐ๋Šฅ์„ ์ œ treasurebear.tistory.com

[JS] ์นด์นด์˜ค ์ขŒํ‘œ>์ฃผ์†Œ๋ณ€ํ™˜ API ์‚ฌ์šฉ
๐Ÿ“˜ Retrospect/Personal Projects 2021. 9. 27. 17:30

HTML5์—์„œ ์ œ๊ณตํ•˜๋Š” geolocation API๋ฅผ ํ†ตํ•ด ์œ„์น˜ ๊ฒ€์ƒ‰์„ ํ—ˆ์šฉํ•˜๋ฉด ํ˜„์žฌ ์ขŒํ‘œ๋ฅผ ์–ป์–ด๋‚ธ๋‹ค. function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { let lon = position.coords.latitude; //์œ„๋„ let lat = position.coords.longitude; //๊ฒฝ๋„ toAddress(lon,lat); }, function(error) { console.error(error); }, { enableHighAccuracy: false, maximumAge: 0, timeout: Infinity }); } } ์—ฌ๊ธฐ์„œ ์–ป..

[JS] URL ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌํ•˜๊ธฐ
๐Ÿ“˜ Retrospect/Personal Projects 2021. 9. 15. 17:29

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ฒ„ํŠผ ํด๋ฆญ์‹œ ํ˜„์žฌ ํŽ˜์ด์ง€์˜ URL์„ ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ์‹ถ์—ˆ๋‹ค. function clipBoard(){ let dummy = document.createElement("input"); const url = location.href; document.body.appendChild(dummy); dummy.value = url; dummy.select(); document.execCommand("copy"); alert("URL์„ ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค."); document.body.removeChild(dummy); } ํ•จ์ˆ˜ ์‹คํ–‰์‹œ ์ž„์‹œ๋กœ URL์„ ๋‹ด๋Š” input์„ ์ƒ์„ฑํ•˜๊ณ  ๋ณต์‚ฌ ํ›„ ์‚ญ์ œํ•œ๋‹ค. document.execCommand("copy"); ํด๋ฆฝ๋ณด๋“œ ๋ณต์‚ฌ์˜ ํ•ต..

[JS] ํ˜„์žฌ ํŽ˜์ด์ง€ ํŒจ์Šค ์•Œ์•„๋‚ด๊ธฐ
๐Ÿ“˜ Retrospect/Personal Projects 2021. 9. 8. 15:39

์ปจํŠธ๋กค๋Ÿฌ์˜ url, ์ฆ‰ ์›น์‚ฌ์ดํŠธ์—์„œ ํ˜„์žฌ ํŽ˜์ด์ง€์˜ ํŒจ์Šค๋ฅผ ์•Œ์•„๋‚ด๊ณ  ์‹ถ์—ˆ๋‹ค. let currentPathName = window.location.pathname; window.location.pathname ์„ ํ†ตํ•ด ์Šฌ๋Ÿฌ์‹œ๋ฅผ ํฌํ•จํ•œ ๋’ท๋ถ€๋ถ„ url์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. ์•„๋ž˜๋Š” ํ˜„์žฌ ์ž‘์„ฑ์ค‘์ธ ํฌ์ŠคํŠธ์˜ ํŒจ์Šค.

[JS] localStorage ๋กœ ํžˆ์Šคํ† ๋ฆฌ ๋‚จ๊ธฐ๊ธฐ
๐Ÿ“˜ Retrospect/Personal Projects 2021. 9. 8. 15:38

localStorage ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ๋ธŒ๋ผ์šฐ์ € ๋‚ด์— ํ‚ค-๊ฐ’์„ ์Œ์œผ๋กœ ํ•˜์—ฌ ๊ฐ’์„ ์ €์žฅํ•œ๋‹ค. ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋‹ค์‹œ ๋‹ซํžŒ ๋’ค ๋‹ค์‹œ ์‹คํ–‰๋˜์–ด๋„ ๊ฐ’์ด ์œ ์ง€๋œ๋‹ค. ํ‚ค-๊ฐ’์€ ํ•ญ์ƒ ๋ฌธ์ž์—ด์ด์–ด์•ผ ํ•œ๋‹ค. ๋˜ ๋„๋ฉ”์ธ์ด๋‚˜ ํฌํŠธ, ํ”„๋กœํ† ์ฝœ์ด ๊ฐ™๋‹ค๋ฉด ๋™์ผํ•œ ๋ชจ๋“  ์ฐฝ์—์„œ ๊ณต์œ ๋œ๋‹ค. ๋กœ์ปฌ์Šคํ† ๋ฆฌ์ง€์˜ ๊ธธ์ด ํ˜„์žฌ ์ €์žฅ๋˜์–ด์žˆ๋Š” ๋ฐ์ดํ„ฐ์˜ ๊ฐœ์ˆ˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค. const localLength = localStorage.length; localStorage.setItem ๋กœ์ปฌ์Šคํ† ๋ฆฌ์ง€์— ๊ฐ’์„ ์ถ”๊ฐ€ํ•œ๋‹ค. localStorage.setItem(keyword); ํ‚ค ๊ฐ’ ์ „์ฒด ์•Œ๊ธฐ for๋ฌธ์„ ํ†ตํ•ด ๋กœ์ปฌ์Šคํ† ๋ฆฌ์ง€์˜ ์ธ๋ฑ์Šค์— ํ•ด๋‹นํ•˜๋Š” ํ‚ค์— ์ ‘๊ทผํ•˜์—ฌ localStorage.getItem(key) ๋ฅผ ํ†ตํ•ด ํ‚ค์˜ ๊ฐ’์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. for (let i = 0; i