어리바리 신입 개발자의 얼렁뚱땅 개발 기록 ✨
23.03.22 / jsp 파일 경로 연결 (가짜 화면 구성) 본문
728x90
[ 경로 연결 ]
프로젝트 경로만 불러오는 코드 : <%= request.getContextPath() %>
<%= request.getContextPath() %> 코드가 리턴하는 값은 프로젝트명 / 리턴 데이터 타입은 String
즉, 프로젝트 경로만 불러오는 코드이기 때문에 뒤에 폴더이름 파일이름 써줘야 한다.
<%= request.getContextPath() %>/폴더이름/파일이름.파일명
//상대 경로 <a href="<%= request.getContextPath() %>/user/user_insert_form.jsp">회원 가입</a> //절대 경로 //파일이 같은 폴더에 있는 경우 ./파일명.파일확장자 //파일이 다른 폴더에 있는 경우 ../폴더명/파일명.파일확장자 <a href="../user/user_insert_form.jsp">회원 가입</a> <%= request.getContextPath() %> /프로젝트이름 출력
//스타일 (css파일) 연결 <link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/main.css" />
프로젝트 경로 / 파일 이름까지 불러오는 코드 : <%=request.getRequestURI() %>
<%=request.getRequestURI() %> 코드가 리턴하는 값은 프로젝트명/파일명.파일확장자 / 리턴 데이터 타입은 String<%= request.getRequestURI() %> /프로젝트이름/폴더이름/파일이름.jsp 출력
ㅍ
[ form 태그의 안의 정보 관리자에게 보내기 ]
1. 태그
- form : form 태그 안의 데이터를 한 묶음으로 묶어서 처리한다.
2. form 태그의 속성
- action : 폼 데이터를 서버로 보낼 때 데이터가 도착할 경로
- method : 사용자가 입력한 내용(폼 데이터)을 어떤 방식(get, post)으로 넘길 것인지를 지정한다.
<form action="<%= request.getContextPath() %>/user/user_list_insert.jsp" method="post"> 아이디 : <input type="text" name="uid"> <br/> 비밀번호번 : <input type="text" name="upw"> <br/> 권한 : <input type="text" name="ulevel"> <br/> 이름 : <input type="text" name="uname"> <br/> 이메일 : <input type="text" name="umail"> <br/> <input type="submit" value="회원가입버튼"> </form>
레이아웃 템플릿 참고 사이트
HTML Tutorial
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
728x90
'Back - end > JAVA' 카테고리의 다른 글
23.03.27 / 라이브러리 배포 (0) | 2023.03.27 |
---|---|
23.03.27 / jsp 파일 경로 연결 (폼 데이터 서버로 보내기) (0) | 2023.03.27 |
23.03.22 / static (0) | 2023.03.22 |
23.03.21 / 컬렉션 리스트 (0) | 2023.03.21 |
23.03.21 / 상속, 오버라이딩과 오버로딩, 추상 클래스, 인터페이스, 생성자 메소드 (0) | 2023.03.21 |