티스토리 뷰
반응형
|
EL : JSP 출력에 대한 부분을 쉽게 하기위해 개발한 TAG 기존의 값을<%= request.getParameter(“id”)%>로받았다면 (값을가져온게 없으면 null로 ) 표현언어에서는 로받음 ${param.id} (값을 가져온게 없으면 공백 null을공백처리) 표현식과 표현언어로의 덧셈 구현 값을 입력받는 elForm.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <form method=post action="result.jsp"> 숫자 1 : <input type="text" name=num1> 숫자 2 : <input type="text" name=num2> <input type=submit value="전송"> </form> </body> </html> 표현식과 표현언어로의 값을받는 result.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> 고전적인방식 : <% String str1= request.getParameter("num1"); String str2= request.getParameter("num2"); int num1= Integer.parseInt(str1); int num2= Integer.parseInt(str2); %> <%=num1%>+<%=num2%>=<%=num1+num2%> <!--[endif]--> EL방식 : ${param.num1} + ${param.num2} = ${param.num1+param.num2} </body> </html> ------------ (서비스에서 MySQL 수동인 경우 직접 실행 시켜준후 cdm창에서 실행해줘야한다.) MySQL설치 후 (http://dev.mysql.com/downloads/workbench/ ) -> cdm mysqladmin –u root create samplewdb mysql –u root (비번설정 안해줬으니 비번없이 로그인 됨) use samplewdb (db사용) (드라이버설치) http://dev.mysql.com/downloads/ ->connector부분에서 ZIP파일 다운바당 압출풀면 musql-connector-java-5.1.22-bin (jar파일)을 C- Promgram file –java (jdk가 깔려있을 경우 jre가 깔려있을수도 있음) 어떤게 컴파일될지모르니 다집어넣어줘야함 ( JDK설치 디렉터리밑의 /jre/lib/ext ) jre만설치한경우는 jre설치 디렉터리밑의 lib/ext디렉터리에 복사 jsp –MySQL 연결잘되는지 테스트 -드라이버 로드 try{ Class.formName(“com.mysql~~~ } ---- -드라이버 연결 ... |
반응형
'it' 카테고리의 다른 글
| PHP 구구단 (0) | 2023.03.14 |
|---|---|
| 개발환경 구축 -2 / JSP 개발환경 구축 (서버구축) (0) | 2023.03.13 |
| Window 사용중인 port 및 프로그램 확인 (0) | 2023.03.11 |
| 튜닝기본 - 1 데이터베이스 튜닝 (0) | 2023.03.10 |
| 운영체제에 대한 관점 / 커널 구성 레벨및 레벨별 해당 모듈 (0) | 2023.03.09 |
댓글
