주소입력:http://localhost:8090/jsp_test1/a.jsp?id=aaa&pw=bbb&addr=ccc&tel=ddd
주소입력하면 회원정보보기 클자만 보이고
그 글자를 클릭하면 파라미터로 입력한 값들이 보임
void setAttribute(String name,
Object value)
a.jsp
==================================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="kr.co.seoulit.member.to.Member"%>
<%
String id=request.getParameter("id");
String pw=request.getParameter("pw");
String addr=request.getParameter("addr");
String tel=request.getParameter("tel");
Member m=new Member();
m.setId(id);
m.setPw(pw);
m.setAddr(addr);
m.setTel(tel);
session.setAttribute("member",m);
session.setAttribute("name","홍길동");
%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<a href="b.jsp">회원정보보기</a>
</body>
</html>
b.jsp
========================================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="kr.co.seoulit.member.to.Member"%>
<%
Member m=(Member)session.getAttribute("member");
%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%=m.getId()%><br>
<%=m.getPw()%><br>
<%=m.getAddr()%><br>
<%=m.getTel()%><br>
</body>
</html>
'개발하자 > JSP&Servlet' 카테고리의 다른 글
로그인,로그아웃,회원리스트,직원리스트보기 (0) | 2015.02.16 |
---|---|
application,session,request,pageContext (0) | 2015.02.16 |
key값과 value값 얻어오기map.get(key)과map.entrySet()이용 (0) | 2015.02.16 |
키값만 뽑아내기 (0) | 2015.02.16 |
현재시간 출력하기(Calendar클래스 이용) (0) | 2015.02.14 |