
Html 만들기Front-End2023. 6. 28. 18:27
Table of Contents
자바를 이용한 HTML 만들기
기본적인 구조
<html>
<head>
<title>제목</title>
</head>
<body>
<table>
<tr>
<td>
<a href="링크주소">
<img src=./파일위치/파일명" />
</a>
</td>
</tr>
</table>
</body>
</html>
tr = table row ( 테이블의 줄을 만드는 역할 )
td = table data 테이블 데이터
파일의 위치를 정확하게 적어야 원하는 것을 출력할 수 있다.
ArrayList 와 HTML, 다중 클래스의 이용
각 클래스 역할
MainClass(controller) : 전체적인 컨트롤
NewsClass(Model) : 한 신문사 정보 저장 (1)
DataClass : 모든 신문사들 정보 저장 (2)
private void readData(String url){~~~}
1. 파일읽기 : FileReader / BufferedReader(줄단위)
2. 읽은 내용으로 NaverNewsClass 객체 생성하여
3. ArrayList에 추가 : ArrayList<NaverNewsClass> news
MethodClass : HTML 태그 생성 (3)
public static String createHTML(ArrayList<NaverNewsClass> news){~~~}
HTML tag들 : <table><tr>
<td>
<a href=' '>
<img src=' ' />
</a>
</td>
</tr>
</table>
예) String tags="<img src=' ' />";
PrintClass(View) : HTML 태그 파일로 저장 (4)
public static void saveHTML(String url, String tags){~~~}
행렬
html 에서 행렬로 배치하고자 할 때 예시
행열배치
<table>
for(int n=0; n<2; n++){ //행
<tr>
for(int k=0; k<3; k++){ //열
<td> </td>
}
</tr>
}
</table>
<table>
<tr><td>11</td><td>12</td>13</td></tr>
<tr><td>11</td><td>12</td>13</td></tr>
</table>
'Front-End' 카테고리의 다른 글
React + TypeScript + TailwindCSS 로그인 구현 (0) | 2024.05.17 |
---|---|
Axios 를 이용한 로그인 구현하기 (0) | 2024.04.24 |
@BaekSJ :: 개발자의 길
Back-End, Front-End, DevOps 기록 블로그
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!