--> -->

JSP

UpdateFormUserServlet 

 

package com.slipp.user;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet("/users/updateform")
public class UpdateFormUserServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		HttpSession session=request.getSession();
		Object object =session.getAttribute(LoginServlet.SESSION_USER_ID);
		if(object==null){
			response.sendRedirect("/");
			return;
		}
		String userid=(String)object;
		System.out.println("User Id : " + userid);
		UserDAO userDAO =new UserDAO();
		
		User user=userDAO.findByUserId(userid);
		request.setAttribute("user", user);
		RequestDispatcher rd=request.getRequestDispatcher("/update_form.jsp");
		rd.forward(request, response);
		
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

 

update_form.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/_head.jspf" %>
<body>
<%@ include file="/commons/_top.jspf" %>




	<div class="container">
		<div class="row">
			<div class="span12">
				<section id="typography">
				<div class="page-header">
					<h1>개인정보 수정</h1>
				</div>
<!-- 				private String userid;
	private String password;
	private String name;
	private String email; -->
				
				<form class="form-horizontal" action="/users/update" method="post">
					<div class="control-group">
						<label class="control-label" for="userId">사용자 아이디</label>
						<div class="controls">
							<input type="hidden" name="userId" value="${user.userid }" />
							${user.userid }
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="password">비밀번호</label>
						<div class="controls">
							<input type="password" id="password" name="password" placeholder="">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="name">이름</label>
						<div class="controls">
							<input type="text" id="name" name="name" value="${user.name }" placeholder="">
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="email">이메일</label>
						<div class="controls">
							<input type="text" id="email" name="email" value="${user.email}" placeholder="">
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<button type="submit" class="btn btn-primary">회원가입</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
</html>

 

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  머나먼나라

이것이 최악이라고 말할 수 있는 동안은 아직 괜찮다. -셰익스피어

댓글 ( 0)

댓글 남기기

작성