2009-12-02 22:16 struts2.0+spring2.0+hibernate3.2实现增删改查CURD

在每一个JSP页面头部加入<%@ taglib prefix="s" uri="/struts-tags" %>

1、用户列表页面(userlist.jsp)

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>增加用户</title>
</head>
<body>
   <form action="#" method="post">
            <table width="30%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CDCDCD">
            <tr>
               <td>ID号</td>
                  <td>用户名</td>
                  <td>密码:</td>
                </tr>
                <s:iterator id="user" value="#request.userlist">
                <tr>
                   <td><s:property value="id"/></td>
                   <td><s:property value="name"/> </td>
                   <td><s:property value="password"/> </td>
                   <td><s:a href="delete.action?del=%{id}">删除</s:a></td>
                   <td><s:a href="edit.action?edit=%{id}">修改</s:a></td>
                </tr>
                </s:iterator>
                <tr><td colspan="3" align="center"><s:a href="adduserlist.jsp">增加</s:a></td></tr>
            </table>
            </form>
</body>
</html>
2、用户添加页面(adduser.jsp)

<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>增加用户</title>
</head>
<body>
   <form action="user.action" method="post">
            <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CDCDCD">
                <tr bgcolor="#FAFAFA">
                    <td>       
                        <table border="0" cellspacing="0" cellpadding="0" align="center">
                            <tr>
                                <td>用户名:<input type="text" name="user.name" class="text" value=""/></td>
                            </tr>
                            <tr>
                                <td>密码:<input type="password" name="user.password" class="text" value=""/></td>
                            </tr>
                            <tr>
                                <td align="center"><input type="submit" value="增加" style="border-style:none; background-color:#FAFAFA"/>
                                       <input type="button" value="返回" οnclick="history.back();" style="border-style:none; background-color:#FAFAFA"/></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            </form>
</body>
</html>
3、用户编辑页面(edituser.jsp)

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>修改用户</title>
</head>
<body>
   <form action="update.action" method="post">
            <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CDCDCD">
                <tr bgcolor="#FAFAFA">
                    <s:textfield name="user.id" label="ID号" value="${user.id}"></s:textfield>
                  <s:textfield name="user.name" label="用户名" value="${user.name}"></s:textfield>
                  <s:textfield name="user.password" label="密码" value="${user.password}"></s:textfield>
                </tr>
                <tr>
                  <s:submit name="submit" value="更新" align="left"></s:submit>
                </tr>
            </table>
    </form>
</body>
</html>
4、用户登录页面(login.jsp)

<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>登录</title>
</head>
<body>
   <form action="login.action" method="post">
            <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CDCDCD">
                <tr bgcolor="#FAFAFA">
                    <td>       
                        <table border="0" cellspacing="0" cellpadding="0" align="center">
                            <tr>
                                <td>用户名:<input type="text" name="user.name" class="text" value="shilei"/></td>
                            </tr>
                            <tr>
                                <td>密码:<input type="password" name="user.password" class="text" value="shilei"/></td>
                            </tr>
                            <tr>
                                <td align="right"><input type="submit" value="登陆" style="border-style:none; background-color:#FAFAFA"/></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            </form>
</body>
</html>
5、登录成功页面(success.jsp)

<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>登录</title>
</head>
<body>
   登录成功
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值