Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Design Pattern & UML  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 4 [Re:prettyxx]
prettyxx





发贴: 75
积分: 42
于 2003-12-16 13:31 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
新建用户newAccount.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Account</title>
</head>

<body>
<font color="#996633">创建新用户 </font>
<form name="form1" method="post" action="<%=response.encodeURL("new_account")%>">
<table width="75%" border="0" cellpadding="3">
<tr>
<td width="42%" align="right">用户名:</td>
<td width="58%"><input type="text" name="userName"></td>
</tr>
<tr>
<td align="right">密码:</td>
<td><input type="text" name="userPwd"></td>
</tr>
<tr>
<td align="right">密码问题:</td>
<td><input type="text" name="hint"></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" name="Submit" value="提交"> </td>
</tr>
</table>
</form>
</body>
</html>

注册的控制器NewAccountServlet.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

import beans.LoginDB;

public class NewAccountServlet extends HttpServlet {

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{
LoginDB loginDB = (LoginDBlack EyegetServletContext().getAttribute("loginDB");
LoginDB.addUser(request.getParameter("userName"),
request.getParameter("userPwd"),
request.getParameter("hint"));
request.getRequestDispatcher(response.encodeUrl("accountCreated.jsp")).forward(request,response);
}
}

accountCreated.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
新用户已经创建! <font color="#0000FF">
<%=request.getParameter("userName")%></font>
<hr><%@ include file="login_form.jsp" %>
</body>
</html>



我的Blog:阿泠的自省札记
========心有多大,舞台就有多大========

话题树型展开
人气 标题 作者 字数 发贴时间
7466 [转帖]用MVC架构简单的注册、登录例子 prettyxx 2237 2003-12-16 13:28
6278 2 prettyxx 3282 2003-12-16 13:29
6429 3 prettyxx 1468 2003-12-16 13:30
6316 4 prettyxx 1756 2003-12-16 13:31
6420 Re:[转帖]用MVC架构简单的注册、登录例子 ccw 4 2004-01-04 09:52

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923