入口網頁:gContactAdd.jsp

<%@ page language="java" contentType="text/html; charset=BIG5" pageEncoding="BIG5"%> <%@ page import="com.google.appengine.api.users.User,com.google.appengine.api.users.UserService,com.google.appengine.api.users.UserServiceFactory"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <% String googleAccount = ""; UserService userService = UserServiceFactory.getUserService(); User currentUser = userService.getCurrentUser(); if (currentUser != null) { googleAccount = currentUser.getEmail(); } else { response.sendRedirect(userService.createLoginURL(request.getRequestURI())); } %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=BIG5"> <title>通訊錄</title> </head> <body> <form method="get" action="/gContactAdd" target="gContact"> <table border="1" cellspacing="1" cellpadding="1"> <tr> <td bgcolor='silver'>使用者</td> <td><%=googleAccount%></td> </tr> <tr> <td bgcolor='silver'>MSN</td> <td><input type="text" name="MSN" value=""></td> </tr> <tr> <td bgcolor='silver'>姓名</td> <td><input type="text" name="realName" value=""></td> </tr> <tr> <td bgcolor='silver'>電話</td> <td><input type="text" name="TEL" value=""></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="新增"> <input type="button" value="查詢" onclick="window.open('/gContactQuery', 'gContact')"></td> </tr> </table> </form> </body> </html>