반응형

 

 특수코드 값

 실제 표현

 뜻 / 용도

 <

 < (부등호 꺽쇠)

 오른쪽으로 열린 부등호.

 수식에서 A < B 와 같은 형태로 사용.

 HTML 코드에서 모든 태그의 시작 기호.

 &gt;

 > (부등호 꺽쇠)

 왼쪽으로 열린 부등호.

 수식에서 A > B 와 같은 형태로 사용.

 HTML 코드에서 모든 태그의 끝 기호.

 &nbsp;

 ' ' (공백, Space 한칸)

 공백 문자 한칸을 의미.

 연속하여 쓰면 여러 공백 문자를 삽입할 수 있음.

 &amp;

 & (앰퍼샌드)

 앰퍼샌드(Ampersand) 라 불리며 & 문자를 뜻함.

 AND 라는 의미를 포함하여 javascript나 java 등에서 AND 연산 기호로 사용되기도 함.

 & 문자를 화면에 출력하고 싶으면 &amp; 를 사용.

 &quot;

 " (큰따옴표 하나)

 쌍따옴표는 HTML에서 특정 속성 값들을 묶기 위한 용도로 사용되기 때문에 쌍따옴표를 화면에 출력하려면 &quot;를 사용.

 

(Ex. <a href="javascript:test("hello");return false;">테스트 링크</a> 와 같이 사용 시, href 속성 안에 또다른 따옴표가 존재하므로 문제가 발생. HTML 파싱 시, test(" 의 따옴표가 href=" 시작 따옴표와 쌍을 이룬다고 판단하여 오류 발생.

 이럴때 <a href="javascript:test(&quot;hello&quot;);return false;"> 사용.

또는 <a href="javascript:test(\"hello\");return false;">와 같은 형태도 사용 가능함.)

 

출처: http://ooz.co.kr/199

'Web개발 > JSP, Web' 카테고리의 다른 글

HTTP 에러  (0) 2016.08.29
JAR 파일에 JSP 파일 넣는 방법  (0) 2016.08.23
ext js 환경  (0) 2016.06.03
CSS 란  (0) 2014.11.18
[JSP] Mybatis 사용하기  (0) 2014.11.18
반응형
ext js : http://docs.sencha.com/extjs/4.2.3/#!/example/build/KitchenSink/ext-theme-neptune/

'Web개발 > JSP, Web' 카테고리의 다른 글

JAR 파일에 JSP 파일 넣는 방법  (0) 2016.08.23
Html, Mybitis, Ibitis 특수문자 태크정리  (0) 2016.06.22
CSS 란  (0) 2014.11.18
[JSP] Mybatis 사용하기  (0) 2014.11.18
[JSP] json 파싱, xml 파싱 예제  (0) 2014.11.18
반응형
CSS(Cascading Style Sheet)HTML 3.2부터 지원하기 시작한 것으로 웹 디자이너와 사용자들의 필요에 의해 특별히 개발되었습니다.
CSS에서는 폰트, 색상, 공백, 공간과 그 밖의 문서 표현 측면을 자유롭게 지정할 수 있는 기능을 제공합니다.

기존의 HTML은 웹 문서를 다양하게 설계하고 수시로 변경하는 데 많은 제약이 있었기 때문에 이것을 보완하기 위해 CSS를 만든 것입니다


'Web개발 > JSP, Web' 카테고리의 다른 글

Html, Mybitis, Ibitis 특수문자 태크정리  (0) 2016.06.22
ext js 환경  (0) 2016.06.03
[JSP] Mybatis 사용하기  (0) 2014.11.18
[JSP] json 파싱, xml 파싱 예제  (0) 2014.11.18
[JSP] 파일 업로드 예제(File Upload)  (0) 2014.11.18
반응형

패키지 구성이다


addMapper.xml

<?xml version="1.0" encoding="UTF-8"?>


<!-- 여기 복붙!! -->

<!DOCTYPE mapper

  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<!-- 여기 복붙!! -->


<mapper namespace="addMapper">


<select id="allAddress" resultType="db.AddressDto">

select * from addressbook

</select>


<select id="selectAddress" parameterType="Integer" resultType="java.util.HashMap">

select *

from addressbook

where num=#{num}

</select>

<insert id="insertAddress" parameterType="db.AddressDto">

insert into

addressbook(NUM, NAME, ADDRESS, BIRTHDAY)

values

(#{num},#{name},#{address},#{birthday})

</insert>

<delete id="deleteAddress" parameterType="Integer">

DELETE FROM AddressBook

WHERE NUM = #{num}

</delete>

<update id="updateAddress" parameterType="java.util.HashMap" >

update addressbook

set birthday = #{birthday}, name = #{name}, address =#{address}

where num = #{num}

</update>


</mapper>

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE configuration

PUBLIC "-//mybatis.org//DTD Config 3.0//EN"

"http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>

<environments default="development">

    <environment id="development">

      <transactionManager type="JDBC"/>

      <dataSource type="POOLED">

        <property name="driver" value="oracle.jdbc.driver.OracleDriver" />

        <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/>

        <property name="username" value="아이디"/>

        <property name="password" value="비밀번호"/>

      </dataSource>

    </environment>

  </environments>

  <mappers>

    <mapper resource="/db/addMapper.xml"/>

  </mappers>

</configuration>


dao 

package db;

import java.io.*;
import java.util.*;

import org.apache.ibatis.io.*;
import org.apache.ibatis.session.*;

public class BatisDao {

	// sql 세션을 생성해 줄 수 있는 세션 팩토리변수
	private SqlSessionFactory sqlSessionFactory;

	// 세션 팩토리 객체를 생성하고 그 결과를 리턴해주는 메서드
	private boolean connect() {
		boolean result = false;
		try {
			// 환경 설정 파일의 경로를 문자열로 저장
			String resource = "/db/mybatis-config.xml";

			// 문자열로 된 경로의파일 내용을 읽을 수 있는 Reader 객체 생성
			Reader reader = Resources.getResourceAsReader(resource);

			// reader 객체의 내용을 가지고 SqlSessionFactory 객체 생성
			sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
			result = true;
		}

		catch (Exception e) {
			System.out.println("세션 팩토리 생성 실패:" + e.getMessage());
		}

		return result;

	}

	// 전체 리스트 출력
	public ArrayList viewMember() {

		// 데이터를 저장할 변수 생성
		ArrayList list = null;

		try {
			connect();
			// 세션팩토리를 이용해서 세션 객체를 생성
			SqlSession session = sqlSessionFactory.openSession();
			list = (ArrayList) session.selectList("addMapper.allAddress");
			session.close();
		} catch (Exception e) {
			System.out.println("데이터 가져오기 실패 : " + e.getMessage());
		}

		return list;
	}

	// 하나의 목록 찾기(HashMap 사용)
	public HashMap selectAddress(int num) {
		HashMap temp = null;
		if (connect()) {
			SqlSession session = sqlSessionFactory.openSession();
			try {
				temp = (HashMap) session.selectOne("addMapper.selectAddress",
						new Integer(num));
			} finally {
				session.close();
			}
		}
		return temp;
	}

	public boolean insertAddress(AddressDto dto) {
		boolean result = false;

		if (connect()) {
			SqlSession session = sqlSessionFactory.openSession();
			try {
				int r = session.insert("addMapper.insertAddress", dto);
				if (r > 0) {
					result = true;
					session.commit();
				}
			} catch (Exception e) {
				System.out.println("삽입 실패: " + e.getMessage());
			} finally {
				session.close();
			}
		}

		return result;
	}
	//삭제
	public boolean deleteAddress(int num) {
		boolean result = false;
		if (connect()) {
			SqlSession session = sqlSessionFactory.openSession();
			try {
				int imsi = session.delete("addMapper.deleteAddress",
						new Integer(num));
				if (imsi > 0)
					result = true;
				session.commit();
			} finally {
				session.close();
			}
		}
		return result;
	}
	
	//수정
	public boolean UpdateAddress(HashMap map) {
		boolean result = false;
		if (connect()) {
			SqlSession session = sqlSessionFactory.openSession();
			try {
				int imsi = session.update("addMapper.updateAddress",
						map);
				if (imsi > 0)
					result = true;
				session.commit();
			} finally {
				session.close();
			}
		}
		return result;
	}

}

dto


package db;

import java.security.*;
import java.sql.*;

public class AddressDto {
	
	private int num;
	private String name;
	private String address;
	private Date birthday;
	public AddressDto() {
		super();
		// TODO 자동 생성된 생성자 스텁
	}
	public AddressDto(int num, String name, String address, Date birthday) {
		super();
		this.num = num;
		this.name = name;
		this.address = address;
		this.birthday = birthday;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	@Override
	public String toString() {
		return "AddressDto [num=" + num + ", name=" + name + ", address="
				+ address + ", birthday=" + birthday + "]";
	}
	
	

}


'Web개발 > JSP, Web' 카테고리의 다른 글

ext js 환경  (0) 2016.06.03
CSS 란  (0) 2014.11.18
[JSP] json 파싱, xml 파싱 예제  (0) 2014.11.18
[JSP] 파일 업로드 예제(File Upload)  (0) 2014.11.18
[JSP] Sevlet 사용하는 예제  (0) 2014.11.18
반응형

'Web개발 > JSP, Web' 카테고리의 다른 글

CSS 란  (0) 2014.11.18
[JSP] Mybatis 사용하기  (0) 2014.11.18
[JSP] 파일 업로드 예제(File Upload)  (0) 2014.11.18
[JSP] Sevlet 사용하는 예제  (0) 2014.11.18
[JSP] Filter 사용하기  (0) 2014.11.18
반응형

'Web개발 > JSP, Web' 카테고리의 다른 글

[JSP] Mybatis 사용하기  (0) 2014.11.18
[JSP] json 파싱, xml 파싱 예제  (0) 2014.11.18
[JSP] Sevlet 사용하는 예제  (0) 2014.11.18
[JSP] Filter 사용하기  (0) 2014.11.18
[JSP] EL 사용하기  (0) 2014.11.18
반응형

'Web개발 > JSP, Web' 카테고리의 다른 글

[JSP] json 파싱, xml 파싱 예제  (0) 2014.11.18
[JSP] 파일 업로드 예제(File Upload)  (0) 2014.11.18
[JSP] Filter 사용하기  (0) 2014.11.18
[JSP] EL 사용하기  (0) 2014.11.18
[JSP] 쿠키 변경  (0) 2014.11.18
반응형

<%@ 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>로그인 화면</title>

</head>

<body>

<form action="Login.action" method="post">

<table border=1>

<tr>

<td align="right">아이디</td>

<td align=left style="padding-left: 20px;"><INPUT TYPE=TEXT

NAME=id SIZE=8></td>

</tr>

<tr>

<td align="right">패스워드</td>

<td align=left style="padding-left: 20px;"><INPUT TYPE=TEXT

NAME=pw SIZE=8></td>

</tr>

<tr>

<td colspan=2 align=center><INPUT TYPE=SUBMIT VALUE='로그인'

style="width: 100px;">&nbsp; <INPUT TYPE=RESET VALUE='취소'

style="width: 100px;">

</table>

</form>


</body>

</html>



20140926Filter.zip


'Web개발 > JSP, Web' 카테고리의 다른 글

[JSP] 파일 업로드 예제(File Upload)  (0) 2014.11.18
[JSP] Sevlet 사용하는 예제  (0) 2014.11.18
[JSP] EL 사용하기  (0) 2014.11.18
[JSP] 쿠키 변경  (0) 2014.11.18
[JSP] 쿠키 삭제  (0) 2014.11.18
반응형


20140924el.zip

collectionResult.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>

${ar[0] }<br />

${map["a"]} <br />

<%@ page import="java.util.*" %>

<%

HashMap<String,String> map = (HashMap<String,String>)request.getAttribute("map");

//map에 저장된 모든 키와 값을 출력

Set<String> keys = map.keySet();

for(String key:keys){

out.println(key+ " : "+map.get(key)+ "<br >");

}

%>


</body>

</html>

elresult.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>attribute 출력</title>

</head>

<body>

자바 코드 사용: <%= request.getAttribute("email") %><br />

EL 이용: ${email} <br />

초기화 파라미터 가져오기: ${initParam.name }<br />

초기화 파라미터 가져오기: ${initParam["name"]}<br /> 


</body>

</html>

mapCreate.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>EL에서의 컬렉션</title>

</head>

<body>

<%@ page import="java.util.*" %>

<%

//문자열을 저장하는 ArrayList 만들어서 문자열을 저장

ArrayList<String> al = new ArrayList<String>();

al.add("기역");

al.add("니은");

al.add("디귿");

//HashMap 만들어서 문자열을 헤시맵에 저장

HashMap<String, String>map = new HashMap<String,String>();

map.put("a","에이요!");

map.put("b","비요!");

map.put("c","씨요!");

map.put("d","디요!");

request.setAttribute("ar", al);

request.setAttribute("map", map);

RequestDispatcher dispatcher = request.getRequestDispatcher("collectionResult.jsp");

dispatcher.forward(request, response);


%>


</body>

</html>

NewFile.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<%

request.setAttribute("email", "dltkd1214@gmail.com");

RequestDispatcher dispatcher = request.getRequestDispatcher("elresult.jsp");

dispatcher.forward(request, response);


%>

pageContext.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 uri = request.getRequestURI();


String conextPath = request.getContextPath();

out.println("전체 경로 : "+ uri+"<br />");

out.println("프로젝트 경로 : "+ conextPath+ "<br />");

String command = uri.substring(conextPath.length());

out.println("요청 경로 : "+ command+ "<br />");



%>


</body>

</html>

'Web개발 > JSP, Web' 카테고리의 다른 글

[JSP] Sevlet 사용하는 예제  (0) 2014.11.18
[JSP] Filter 사용하기  (0) 2014.11.18
[JSP] 쿠키 변경  (0) 2014.11.18
[JSP] 쿠키 삭제  (0) 2014.11.18
[JSP] 모든 쿠키 읽기  (0) 2014.11.18
반응형

<%@ 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>쿠키 변경</title>

<%

//쿠키 변경은 동일한 이름의 쿠키를 생성해서 추가해주면 됩니다.

Cookie cookie = new Cookie("name", "sang");

response.addCookie(cookie);

%>



</head>

<body>

<a href="allCookie.jsp">쿠키읽기</a>


</body>

</html>

'Web개발 > JSP, Web' 카테고리의 다른 글

[JSP] Filter 사용하기  (0) 2014.11.18
[JSP] EL 사용하기  (0) 2014.11.18
[JSP] 쿠키 삭제  (0) 2014.11.18
[JSP] 모든 쿠키 읽기  (0) 2014.11.18
[JSP] 쿠키생성하기  (0) 2014.11.18

+ Recent posts