์ํํธ์จ์ด๊ณตํ ์ค๋ฌด - 2
2023-03-10
์ด์ ์๊ฐ์ ํ๋ ๋ด์ฉ์ด๊ธด ํ๋ฐ..
google classroom์ ๋๊ฐ์ ๊ฑธ ์ฌ๋ฆฌ์
จ๋ค์.. ๋ฐฐ์ฐ๋ ๋ด์ฉ์ ๋ค๋ฅผ๊ฑฐ๋๊น ์๊ด ์๊ฒ ์ฃ ?
์์ PDF ๋ด์ฉ์ธ๋ฐ ์ ์ ์ ๊ฐ ์ ๋ฆฌํ๊ฑฐ๋ ์ฐจ์ด๊ฐ ์๊ธด ํด์
ํน์ฑํ๋ ํน๋ชฉ๊ณ ๋ฉด ์์ผ๋ก ๊ณต๋ถํ ๋ด์ฉ์ ๋ค ์ ๋ฆฌํ๋ฉด ์ข๊ฒ ๋ค์
๋ณด์ํ๋ฉด ํฌํด์ ์ฌ๋ฆด๊ฒ์ด.. ์ฑ๊ณผ๋ง ์์๊ฑด๋ฐ ์ ๋ ๋ณ๋ก ์์ด์์ ใ
Project Start!!
Spring MVC Project๋ก ๋ฐ๋ก ๋ง๋ค์ด์ ํด์ผํ๋๋ฐ
์ ์๋์ด Mac์ ๋ค์ด ์๋ค๊ณ ํด์ ์ด๋ ๊ฒ ํ๋ฒ ํด๋ด
์๋ค.
๋๋ฉ์ธ์ ์ญ์์ผ๋ก rev๋ก ์ค์ ํ๊ธฐ์ Group ID๋ฅผ ์ ๋ ๊ฒ ์์ฑํฉ๋๋ค.
๋๋จธ์ง๋ ์ด๋์ ๋๋ง ์ค์ ํ๊ณ Maven Setting์ ๊ฑด๋ค์ง ๋ง๊ณ
Next๋๋ฅด์๋ฉด..
Generate Example์ ์ด๋์ ๋์ ๊ตฌ์ฑ์ ํด์ฃผ๋๊ฑด๋ฐ
์ฐ๋ฆฌ๋ ๋ฐฐ์ฐ๋ ์
์ฅ์ด๋๊น ๋๋ฅด์ ๋ง์๊ณ Finish ใฑใฑ
๊ทธ๋ฅ Web Project๋ฅผ Spring ํ์ ์ผ๋ก ๋ฐ๊พธ๋ ๊ณผ์ ์ ํด๋ด ์๋ค.
View
MVC ํน์ง์ ๊ณ ๋ คํ์ฌ ํด๋๋ฅผ ์์ฑํ ๊ป์
์ฐ์
๊ธฐ์ฌ๋ฅผ ํ์๋๋ ์ ๋ฐ๊ฑธ ๊ณ ๋ คํ์ง ์์์ง๋ง
MVC(Spring)๊ฐ์ ๊ฒ์ ์ ์ฉ/๋ฐฐํฌํ ๋ ํด๋ผ์ธก์ ์์ฒญ์ ์๋๋ C(ontroller)์์ ๋ฐ์
์ฒ๋ฆฌํ๊ธฐ์ ๋ฐ๋ก V(iew)์ธก์์ ์ ๊ทผ X๊ฐ ๊ธฐ๋ณธ์ ์ธ ํ์์
๋๋ค.
๊ทธ๋์ Web-INF(Web manage file)๋ก ๋ฃ์ด์ ๊ถํ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํด์ผํฉ๋๋ค.
์ ํฌ๋ MVC๊ตฌ์กฐ์ ERP์ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๊ฑฐ๋๊น์
๋ํ ๊ธฐ์ ์ด ์ฌ๋ผ๊ฐ๋ค๋ฉด WAS์ View๋ฅผ ๋ถ๋ฆฌ๋ฅผ ํ ์ ์๊ฒ JSP๋ฅผ ์ ์ฐ๋๊ฒ ์ข์๋ฐ
์ ํฌ๋ ๊ณต๋ถ๋ฅผ ํ๋ ๋ถ๋ถ์์ jsp๋ก ํ๋ค์ (FE: react / BE : node, spring ์ถ์ฒ)
๊ทธ๋ฆฌ๊ณ board → template.jsp ๋ฅผ ์์ฑํฉ์๋ค.
ERP ๊ตฌ์กฐ๋ผ์ ์ ๋ณด์ฒ๋ฆฌ์ฐ์
๊ธฐ์ฌ ํ๋ก์ ํธ์ฒ๋ผ ๋ง๋ค๊ฑฐ ๊ฐ๋ค์
template์ ์ค์ผ๋ ํค ์ฝ๋์์
์ผ์ชฝ๊ณผ ์ค๋ฅธ์ชฝ(left.jsp & right.jsp) ํ์ผ์ ์์ฑํฉ๋๋ค.
Controller
์ดํ
๊ทธ๋ฅ Dynamic Web Project๋ฅผ MVC(Spring)์ ํ์์ผ๋ก ํ๊ธฐ์ํด
Controller๋ฅผ java packet(FC)์ผ๋ก ๋ฃ์ด์ค ๋ชจ์ต์
๋๋ค.
๋ํ ์์ ์ด๋ฏธ์ง์์ ํ์ธํ๋ฏ์ด ์ญํ (์ํฉ์ ๋ง๊ฒ ๊ตฌ์กฐํ)์
๋ง๊ฒ ์กฐ์ํ๋ Java Class๋ฅผ ์์ฑํ์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ ์ ํฌ๋ ๊ณ์ํ์ ํ์์ผ๋ก ๋ง๋ค ๊ฑฐ๊ธฐ์ ์๊ฐํ๋ฉด์ ์ ์ํด์ผ๊ฒ ์ฃ ?
์๋ค์ ์ก[๊ณ์ํ ์๋ฃํ(VO, DTTO, etc..)]
POJO(Plain old Java Object)
ํ๋ ์์ํฌ๋ฅผ ์ฌ์ฉ๋๋ฐ ์ด๋ ํ ์ ์ฝ์ด ์๋ ์๋ฐ ๊ฐ์ฒด(๊ธฐ๋ณธ ์ ๊ณต)
๋น์ง๋์ค ์ฒ๋ฆฌ๋ณด๋จ ๋ฐ์ดํฐ๋ฅผ ์ ์งํ๋๋ฐ ์ฃผ๋ก ์ฌ์ฉ๋จ
Getter/Setter๋ฅผ ๊ฐ์ง ๋จ์ ์๋ฐ ์ต์ ์ด๋ฉฐ ์์กด์ฑ X
ํ ์คํธ๋ ์ฉ์ดํด ์ถํ ์์ /์ ์ง๋ณด์๊ฐ ํธ๋ฆฌํ๋ค๋ ์ฅ์ ์ด ์กด์ฌํจ
DAO(Data Access Object)
DB์ฒ๋ฆฌ ๋ฐ ์ง์์ฑ์ ๋ด๋นํ๋ฉฐ, ํ๋ง๋๋ก DB์ ์ก์ธ์คํ๋ ๊ฐ์ฒด
DAO๋ POJO์ ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ฅ/๋ถ๋ฌ์ค๊ธฐ ๋ฑ์ ํ ์ ์์
DTO(Data Transfer Object)
VO(Value Object)๋ก ์๋ ค์ง DTO๋ SW App ํ์ ์์คํ ๊ฐ์
๋ฐ์ดํฐ๋ฅผ ์ ์กํ๋ ๋ฐ ์ฌ์ฉ๋๋ ๋์์ธ ํจํด
DTO๋ ์ข ์ข DB์์ ๋ฐ์ดํฐ๋ฅผ ๊ฒ์ํ๊ธฐ ์ํด ๋ฐ์ดํฐ ์ก์ธ์ค ๊ฐ์ฒด์ ํจ๊ป ์ฌ์ฉ
VO(Value Object)
VO๋ DTO์ ๋์ผํ ๊ณ๋ ์ผ๋ก read only ์์ฑ์ ์ง๋
- VO : ํน์ ๋น์ฆ๋์ค ๊ฐ์ ์ ์ฅ ๊ฐ์ฒด
- DTO : Layer๊ฐ์ ํต์ ์ฉ๋๋ก ์ก์์ ๊ฐ์ฒด
Difference between DTO, VO, POJO, JavaBeans?
Have seen some similar questions: What is the difference between a JavaBean and a POJO? What is the Difference Between POJO (Plain Old Java Object) and DTO (Data Transfer Object)? Can you also pl...
stackoverflow.com
DB์ค๊ณ๊ฐ ํนํ ์ค์ํ๊ณ (ERD)๋ก ์ถํ ์ค๊ณ๋ ํด์ผ๊ฒ ์ฃ
๊ทธ๋ฆฌ๊ณ ์ค๋ฌด์์ ์ฉ์ด๊ฐ ๋ค ์ ํด์ ธ์๋ค๊ณ ํ๋ค์(๋์์ธ ํจํด, ์ ์์ผ ๋ฑ์ผ๋ก)
์ด ๋ถ๋ถ์ DB์ ์ฐ๋ํ์ฌ ์๋ฒ๋ฅผ ๊ตฌ๋ํ Java Class์ ๋๋ค.
์๋, ๋ณด์์์ํด Private๋ก ์ง์ ํ๊ณ ํธ์ถํด์ผํ๋ Getter/Setter๋ฅผ ์ฌ์ฉ
์ฐ๋ฆฌ๊ฐ ์ฐ๊ธฐ ์ฝ๊ฒ ์์ํด ํด๋น ์์ฑ์ ๋ฌธ์์ด๋ก ์นํ ์ฌ์ฉํ ๊ฑฐ๋๊น toString
Root Controller
FC(Front Comand Controller)๋ผ๊ณ ๋ถ๋ฆฌ๋ฉฐ ๊ฐ๋จํ ์ ๋ฆฌํ์๋ฉด..
Front๋จ์ ๋ช
๋ น๋ค์ Controller๊ฐ ๋จผ์ ๋ฐ๊ณ ์ฒ๋ฆฌํ๋๋ฐ FC๋ ๊ทธ ํต์ฌ!!
ํ๋ง๋๋ก ํธํ
์ ์๋ด๋ฐ์คํฌ๋ผ๊ณ ๋ณด์๋ฉด ๋ฉ๋๋ค.
๋ฐ์ ๋งํฌ๋ hub๋ผ์(๋ณผ ํ์๊ฐ ์๊ธดํ๋ฐ).. ๊ทผ๋ฐ ๋น์ทํ ๋๋์ด๋ผ ์ฌ๋ ค๋ด ๋๋ค.
What is the difference between usb root hub and usb host controller?
From the oracle wiki (usb controller): The USB host controller has an embedded hub called the root hub. The ports that are visible at the system's back panel are the ports of the root hub. ...
electronics.stackexchange.com
์์ ์ด๋ฏธ์ง๊ฐ ์๋ชป๋ฌ๋๋ฐ file๋ก ๋ค์ด๊ฐ์ ํด์ผํด์
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="https://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
xml.. ๋ฐ์ดํฐ์ ์ ํ๊ณผ ํน์ง์ ์ค๋ช
ํด์ฃผ๋ ์ธ์ด์
๋๋ค.
์์ธํ๊ฑด ๊ฑด๋๋ธ๊ป์
๋ค์์ผ๋ก ๋์ด๊ฐ์ ํด๋น ์ฝ๋๋ฅผ ๋ถ์ํด๋ด ์๋ค.
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="kr.board.controller" />
</beans:beans>
์.. ๊ทผ๋ฐ ์ค๋ช
ํ๊ธฐ ๊ท์ฐฎ๋ค์
์์ด๋ ์ด๋ฏธ์ง ๋ณด์๋ฉด ๋์ถฉ ์ ์ ์์ด์
"๋ด๋ ๋ชจ๋ฅด๊ฒ ๋ค" ํ์๋ฉด ๋งํด์ฃผ์ธ์
๋ฐ๋ก ์๋ ค๋๋ฆด๊ป์(์๋ง๋?)
์ด ๋ถ๋ถ์ ์ฝ๋๋ฅผ ๋ฃ์์๋ ๋งตํ ํ ์ฝ๋ ์์๋ก ํ์๋ง ์ก์์ต๋๋ค.
๋ค์ ์๊ฐ์ ์ฌ์ฉํด๋ณด๋ฉด์ ์ ๋ฆฌํด๋ณผ๊ป์
๊ณผ์
ใxml, DTT, ์คํค๋ง, DD(ํจ์น ์์ ์) FCใ์ ๋ํ์ฌ ์์์ค๊ธฐ
์์ ๋์์๊ธฐ๋ ํ๊ณ .. ์๋ค์ ์ก ๋๋์
๋๋ค.
๋ค์ ๊ฐ๋ฉด ๋ ์ ๊ฐ ์ ๋ฆฌํ ๊ฑฐ ๊ฐ์ผ๋๊น ์ํ์ ๋ ๋ ๊ฑฐ ๊ฐ๋ค์
์ฐธ๊ณ ์๋ฃ
์ฐธ๊ณ ์ด๋ฏธ์ง