jsp url ์ด๋ฏธ์ง€ ๋‹ค์šด๋กœ๋“œ

  • 0

jsp url ์ด๋ฏธ์ง€ ๋‹ค์šด๋กœ๋“œ

Print Friendly, PDF & Email

์ด ์˜ˆ์ œ์—์„œ๋Š” c:ํ…Œ์ŠคํŠธ ๋””๋ ‰ํ„ฐ๋ฆฌ ๋‚ด์— java.jpg ์ด๋ฏธ์ง€๊ฐ€ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ์— ๋”ฐ๋ผ ์œ„์น˜๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ์ผ์„ ์—…๋กœ๋“œ ํ•œ ํ›„ ๋‚ด ์„œ์  ํŽ˜์ด์ง€ UploadDownloadFileServlet์€ ํŒŒ์ผ์ด ์—…๋กœ๋“œ ๋œ ๋Œ€๋กœ ์•„๋ฌด ๊ฒƒ๋„ ์ธ์‡„ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค… ๊ทธ๊ฒƒ์€ ๋น„์–ด ์žˆ์Šต๋‹ˆ๋‹ค ……. ์„œ๋ณผ๋ › ์—…๋กœ๋“œ ํŒŒ์ผ ๋ฐ ๋‹ค์šด๋กœ๋“œ ํŒŒ์ผ์€ ์ž๋ฐ” ์›น ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์—์„œ ์ผ๋ฐ˜์ ์ธ ์ž‘์—…์ž…๋‹ˆ๋‹ค. ๋‚˜๋Š” ์ตœ๊ทผ์— ์ž๋ฐ” ์„œ๋ธ”๋กœ์— ๋Œ€ํ•ด ๋งŽ์ด ์ž‘์„ฑํ–ˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋‚˜๋Š” ์„œ๋ฒ„์— ์„œ๋“ค ํŒŒ์ผ ์—…๋กœ๋“œ์˜ ์ƒ˜ํ”Œ ์˜ˆ๋ฅผ ์ œ๊ณตํ•˜๊ณ  ์„œ๋ฒ„์—์„œ ํด๋ผ์ด์–ธํŠธ๋กœ ๋‹ค์šด๋กœ๋“œ ํ•  ์ƒ๊ฐํ–ˆ๋‹ค. ์„œ๋ฒ„์—์„œ ์ ˆ๋Œ€ ๊ฒฝ๋กœ =C:์‚ฌ์šฉ์ž์‚ฌ์šฉ์ž PC๋‹ค์šด๋กœ๋“œ์•„ํŒŒ์น˜-tomcat-7.0.34tmpfilesC:์‚ฌ์šฉ์ž์‚ฌ์šฉ์ž pc์‚ฌ์ง„์Šคํฌ๋ฆฐ์ƒท์Šคํฌ๋ฆฐ์ƒท (5).png ์šฐ๋ฆฌ๋Š” “์—ฌ๊ธฐ ๋‹ค์šด๋กœ๋“œ”๋กœ ํ•˜์ดํผ ๋งํฌ๋ฅผ ์–ป์„ ๊ฒƒ์ด๋‹ค downloading_1.jsp๋ฅผ ํด๋ฆญํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ด ํ•˜์ดํผ ๋งํฌ ํŒŒ์ผ์„ ํด๋ฆญ ํ•˜๋ฉด, ๊ทธ๊ฒƒ์€ ์‹œ์Šคํ…œ์— ๋‹ค์šด๋กœ๋“œ ๋ฉ๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ์˜ ์ƒ˜ํ”Œ ์‹คํ–‰์€ ์•„๋ž˜ ์ด๋ฏธ์ง€์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. C:Users๋กœ๋„๋“œ์ž‘์—… ๊ณต๊ฐ„์„œ๋ณผ๋ฆฟ์—…๋กœ๋“œsrccom์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ๋ถ€๋ถ„์ด ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜๋Š” ๋™์•ˆ ํ•ญ์ƒ ํŒŒ์ผ์„ ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก ํ™•์žฅ์ž๋ฅผ ๊ฐ€์ง„ UploadDownloadFileServlet์œผ๋กœ ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. ์–ด๋–ค ์ œ์•ˆ ….

? ๋‚˜๋Š”์ด ์ž‘ํ’ˆ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ๋ช‡ ๊ฐ€์ง€๋ฅผ ๋ณ€๊ฒฝํ–ˆ๋‹ค. ๊ฐ€์žฅ ํฐ ๋ฌธ์ œ๋Š” fileItem.getName()์ด ํŒŒ์ผ ์ด๋ฆ„์ด ์•„๋‹ˆ๋ผ ์ด๋ฏธ์ง€์— ๋Œ€ํ•œ ์ „์ฒด ๊ฒฝ๋กœ๋ผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ด ๋ผ์ธ์„ ์ถ”๊ฐ€ / ๋ณ€๊ฒฝ ํ•œ ํ›„์—๋Š” ๋งค๋ ฅ์ฒ˜๋Ÿผ ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค : `ํ”„๋กœ์ ํŠธ์˜ ๊ทธ๋ฃน๊ณผ ์•„ํ‹ฐํŒฉํŠธ ID๋ฅผ ์ž…๋ ฅํ•˜์‹ญ์‹œ์˜ค.`๋ผ๊ณ  ๋ฌป์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ์ด๋ฏธ์ง€์™€ ๊ฐ™์ด ์„ธ๋ถ€ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„์ „ ๋ฒˆํ˜ธ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ 0.0.1-SNAPSHOT์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๋Š” ๋‹ค์šด๋กœ๋“œ ๋งํฌ๋ฅผ ํด๋ฆญํ•˜์—ฌ ํ•„์š”ํ•œ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๋ธŒ๋ผ์šฐ์ €๋Š” ์•„๋ž˜ ์ด๋ฏธ์ง€์™€ ๊ฐ™์ด ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜๋„๋ก ์‚ฌ์šฉ์ž์—๊ฒŒ ์š”์ฒญํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ผ ์—…๋กœ๋“œ์— ๋Œ€ ํ•œ, ์šฐ๋ฆฌ๋Š” ์•„ํŒŒ์น˜ ๊ณต์šฉ ํŒŒ์ผ ์—…๋กœ๋“œ ์œ ํ‹ธ๋ฆฌํ‹ฐ๋ฅผ ์‚ฌ์šฉ ํ•ฉ๋‹ˆ๋‹ค., ์šฐ๋ฆฌ์˜ ํ”„๋กœ์ ํŠธ์— ๋Œ€ ํ•œ ์šฐ๋ฆฌ๊ฐ€ ๋ฒ„์ „์„ ์‚ฌ์šฉ ํ•˜๋Š” 1.3, FileUpload ์•„ํŒŒ์น˜ ๊ณต์šฉ IO ํ•ญ์•„๋ฆฌ์— ๋”ฐ๋ผ ๋‹ฌ๋ผ ์ง‘๋‹ˆ๋‹ค., ๊ทธ๋ž˜์„œ ์šฐ๋ฆฌ๋Š” ํ”„๋กœ์ ํŠธ์˜ lib ๋””๋ ‰ํ† ๋ฆฌ์— ๋‘˜ ๋‹ค ๋ฐฐ์น˜ ํ•ด์•ผ, ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ์— ๋Œ€ ํ•œ ์œ„์˜ ์ด๋ฏธ์ง€์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋“ฏ์ด. out.write(“์—…๋กœ๋“œ๋‹ค์šด๋กœ๋“œํŒŒ์ผ์„œ๋ฒŒ๋ ›?ํŒŒ์ผ์ด๋ฆ„= + ํŒŒ์ผ์ด๋ฆ„”); ๋‚˜๋Š” ๋‚ด ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ํ•  ์ˆ˜์—†๋Š” ํด๋”์—์žˆ๋Š” ๋ชจ๋“  ํŒŒ์ผ์„ ํ‘œ์‹œํ•˜๋Š” while ๋ฃจํ”„๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์Šคํ”„๋ง MVC๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ JSP์˜ ๋กœ์ปฌ ํด๋”์—์„œ ์ด๋ฏธ์ง€, PDF, zip ๊ฐ™์€ ํŒŒ์ผ์„ ํ‘œ์‹œํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋‹ค๋ฅธ ๋””๋ ‰ํ† ๋ฆฌ์— ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์–ด ์‹ถ์Šต๋‹ˆ๋‹ค. ์ฆ‰, ๋‚˜์—๊ฒŒ ์˜ˆ์™ธ๋ฅผ์ฃผ๊ณ ๋‚ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์ €๋ฅผ ๋„์™€์ฃผ์„ธ์š” …

๋งค๋‹ˆ, css ๋ฐ js ํŒŒ์ผ์€ ๋ฆฌ์†Œ์Šค ํด๋”์— ์žˆ์Šต๋‹ˆ๋‹ค (์˜ˆ : ServletFileUploadDownload srcmainwebapp๋ฆฌ์†Œ์Šค). ์ด ๊ฒฝ๋กœ๋กœ ์ด๋™ํ•˜์‹ญ์‹œ์˜ค. javax.servlet.ServletException: ํŒŒ์ผ ์ด๋ฆ„์€ null ๋˜๋Š” ๋นˆ ์ €๋„๋ฐ๋ธŒ์ผ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. UploadDownloadFileServlet.doGet (์—…๋กœ๋“œ ๋‹ค์šด๋กœ๋“œํŒŒ์ผ์„œ๋ฒŒ๋ ›.์ž๋ฐ”:38) ์ž๋ฐ”x.servlet.httpservlet.service (HttpServlet.java:618) ์ž๋ฐ”x.servlet.httpservlet.service(HttpServlet.httpServlet.service). ์ž๋ฐ” :725) org.apache.websocket.server.wsFilter.doFilter.doFilter (WsFilter.java:52) ์•ˆ๋…•ํ•˜์„ธ์š” ๋‚˜๋Š” ์‚ฌ์šฉ์ž ์ด๋ฆ„์œผ๋กœ ํด๋”๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ  ๊ทธ๋Ÿฐ ๋ชจ๋“  ์‚ฌ์šฉ์ž๋ฅผ์œ„ํ•œ ์‚ฌ์šฉ์ž ์ด๋ฆ„ ํด๋”์— ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. java.io.FileNotFoundException: nullpassword.txt (์‹œ์Šคํ…œ์ด ์ง€์ •๋œ ๊ฒฝ๋กœ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Œ) java.io.FileOutputStream.open (๋„ค์ดํ‹ฐ๋ธŒ ๋ฉ”์„œ๋“œ) ์—์„œ java.io.FileOutputStreamStream. (ํŒŒ์ผ ์ถœ๋ ฅ์ŠคํŠธ๋ฆผ.java:206) ์—์„œ ์ž๋ฐ”.io.FileOutputStream. (FileOutputStream.java:156) ์—์„œ org.apache.commons.fileupload.diskFile.write(DiskFileItem.java:394) ์—์„œ UploadDownloadFileServlet.doPost (UploadDownloadFileServlet.java:148) ์ž๋ฐ”x.servlet.http.httpServ let.service(HttpServlet.java:644) ์—์„œ ์ž๋ฐ”x.servlet.http.httpservlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ํ•„ํ„ฐ์ฒด์ธ.java:301) org.apache.catalina.core.applicationFilterChain.doFilter(์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ํ•„ํ„ฐ์ฒด์ธ.์ž๋ฐ”:206) ๋‚ด๋ถ€๋„ ํ•„ํ„ฐ(์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ํ•„ํ„ฐ์ฒด์ธ.์ž๋ฐ”:239)์—์„œ org.apache.catalina.core.ApplicationFilterChain.doFilter(์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ํ•„ํ„ฐ์ฒด์ธ.java:206) at org.netbeans.modules.web.server.monitor.monitorFilter.doFilter(๋ชจ๋‹ˆํ„ฐํ•„ํ„ฐ.java:393) org.apache.catalina.core.applicationFilterChain.internalDoFilter (์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ํ•„ํ„ฐ ์ฒด์ธ.์ž๋ฐ”:239) ์—์„œ org.apache.catalina.core์—์„œ org.apache.catalina.core.StandardWrapper.invo.apache.catalina.invo.apache.catalina.invo. (StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(์ธ์ฆ์ž.java:503) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136) at org.apache.catalina.valve.ErrorReportValve.invoke(์˜ค๋ฅ˜๋ฆฌํฌํŠธ๋ฐธ๋ธŒ.์ž๋ฐ”:74).java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.coyoteAdapter.service(์ฝ”์š”ํ…Œ์–ด๋Œ‘ํ„ฐ.java:516) at org.apache.coyote.http11.Abst


What are you searching for?

Find Us:

To learn more about our 3PL Third-Party Logistics Services we provide...

2195 Pendley Road, Cumming, GA 30041 FIND US