jsp第五天练习「建议收藏」

jsp第五天练习「建议收藏」Java代码:package com.demo.action;import org.apache.struts.action.Action;im

欢迎大家来到IT世界,在知识的湖畔探索吧!

jsp第五天练习「建议收藏」

jsp第五天练习「建议收藏」

jsp第五天练习「建议收藏」

jsp第五天练习「建议收藏」

jsp第五天练习「建议收藏」

Java代码:

package com.demo.action;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class InputGoAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        String methodName = request.getParameter("method");
        if ("saveUserInfo".equals(methodName)) {
            return mapping.findForward("saveforward");
        }

        if ("checkUserInfo".equals(methodName)) {
            return mapping.findForward("checkforward");
        }
        return null;
    }

}

欢迎大家来到IT世界,在知识的湖畔探索吧!

欢迎大家来到IT世界,在知识的湖畔探索吧!package com.demo.action;

import com.demo.dao.UserInfoDao;
import com.demo.form.UserInfoForm;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class UserInfoAction extends DispatchAction {
    private UserInfoDao dao = null;
    private UserInfoForm userInfoForm = null;

    public ActionForward saveUserInfo(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response) {
        userInfoForm = (UserInfoForm) form;
        dao = new UserInfoDao();
        if (dao.saveUserInfo(userInfoForm)) {
            request.getSession().setAttribute("userInfo", userInfoForm);
            request.setAttribute("information", "注册用户成功!");
        }
        else {
            request.setAttribute("information", "您注册用户失败!");
        }
        return mapping.findForward("opeationUserInfo");
    }

    public ActionForward checkUserInfo(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response) {
        HttpSession session = request.getSession();
        userInfoForm = (UserInfoForm) form;
        dao = new UserInfoDao();
        String account = userInfoForm.getAccount();
        String password = com.demo.tools.Encrypt.encodeMD5(userInfoForm.getPassword());
        userInfoForm = dao.queryUserInfo(account);
        if (null == userInfoForm) {
            request.setAttribute("information", "用户名不存在!");
        }
        else if (!userInfoForm.getPassword().equals(password)) {
            request.setAttribute("information", "用户登录密码有误!");
        }
        else {
            request.setAttribute("information", "用户登录成功!");
            session.setAttribute("userInfo", userInfoForm);
        }
        return mapping.findForward("opeationUserInfo");
    }
}
package com.demo.check;

import com.demo.dao.UserInfoDao;
import com.demo.form.UserInfoForm;

public class CheckOutData {
    /**
     * 校验用户名在数据表中是否存在
     * @param account
     * @return
     */
    public static String isCheckUser(String account) {
        String result = "";
        if (null != account || !account.equals("")) {
            UserInfoDao dao = new UserInfoDao();
            UserInfoForm userInfo = dao.queryUserInfo(account);
            if (null != userInfo) {
                result = "该用户不能使用!";

            }
        }
        return result;
    }

    /**
     * 校验Email地址是否正确
     * @param email
     * @return
     */
    public static String idCheckEmail(String email) {
        String result = "";
        if (null != email || !email.equals("")) {
            boolean flag = com.demo.tools.Encrypt.checkEmail(email);
            if (!flag) {
                result = "您输入的Email地址不合法!";
            }
        }
        return result;
    }
}
欢迎大家来到IT世界,在知识的湖畔探索吧!package com.demo.dao;

import com.demo.form.UserInfoForm;
import com.demo.tools.JDBConnection;

import java.sql.ResultSet;
import java.sql.SQLException;

public class UserInfoDao {
    private JDBConnection connection = null;

    private UserInfoForm userInfoForm = null;

    public UserInfoDao() {
        connection = new JDBConnection();
    }

    /**
     * 保存用户信息
     * @param userInfoForm
     * @return
     */
    public boolean saveUserInfo(UserInfoForm userInfoForm) {
        StringBuilder sql = new StringBuilder();
        sql.append("insert into t_userinfo2 (account,password,email,sign,question,result,name,sex,fromspace,qq,introduce) ");
        sql.append("values(?,?,?,?,?,?,?,?,?,?,?)");
        boolean flag = false;
        String[] pam = {
                userInfoForm.getAccount(),
                com.demo.tools.Encrypt.encodeMD5(userInfoForm.getPassword()),
                userInfoForm.getEmail(), userInfoForm.getSign(),userInfoForm.getQuestion(),
                userInfoForm.getResult(), userInfoForm.getName(),userInfoForm.getSex(),
                userInfoForm.getFromspace(),userInfoForm.getQq(), userInfoForm.getIntroduce()};
        if (connection.updateData(sql.toString(),pam)) {
            flag = true;
        }
        return flag;
    }

    /**
     * 查询用户信息
     * @param account
     * @return
     */
    public UserInfoForm queryUserInfo(String account) {
        try {
            String sql = "select * from t_userinfo2 where account=?";
            String[] pam = {account};
            ResultSet rs = connection.queryByPsStatement(sql,pam);
            while (rs.next()) {
                userInfoForm = new UserInfoForm();
                userInfoForm.setId(rs.getInt(1));
                userInfoForm.setAccount(rs.getString(2));
                userInfoForm.setPassword(rs.getString(3));
                userInfoForm.setEmail(rs.getString(4));
                userInfoForm.setSign(rs.getString(5));
                userInfoForm.setQuestion(rs.getString(6));
                userInfoForm.setResult(rs.getString(7));
                userInfoForm.setName(rs.getString(8));
                userInfoForm.setSex(rs.getString(9));
                userInfoForm.setFromspace(rs.getString(10));
                userInfoForm.setQq(rs.getString(11));
                userInfoForm.setIntroduce(rs.getString(12));

            }
        }
        catch (SQLException ex) {
            return null;
        }
        finally {
            connection.closeAll();
        }
        return userInfoForm;
    }
}
package com.demo.form;

import com.demo.dao.UserInfoDao;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class UserInfoForm extends ActionForm {
    private Integer id = -1;

    private String code = "";

    private String account = "";

    private String password = "";

    private String repassword = "";

    private String email = "";

    private String sign = "0";

    private String question = "";

    private String result = "";

    private String name = "";

    private String sex = "男";

    private String fromspace = "";

    private String qq = "";

    private String introduce = "";

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFromspace() {
        return fromspace;
    }

    public void setFromspace(String fromspace) {
        this.fromspace = fromspace;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getRepassword() {
        return repassword;
    }

    public void setRepassword(String repassword) {
        this.repassword = repassword;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        String requestString = request.getQueryString();
        HttpSession session = request.getSession();
        String rand=(String)session.getAttribute("rand");
        if (requestString.equalsIgnoreCase("method=saveUserInfo")) {

            if (null == code || code.equals("")) {
                errors.add("code", new ActionMessage("request.error.code"));
            }
            else if (!code.equals(rand)) {
                errors.add("code", new ActionMessage("request.error.decode"));
            }
            if (null == account || account.equals("")) {
                errors.add("account",
                        new ActionMessage("request.error.account"));
            }
            else {
                UserInfoDao dao = new UserInfoDao();
                if (null != dao.queryUserInfo(account)) {
                    errors.add("account", new ActionMessage("request.error.account1"));
                }

            }
            if (null == password || password.equals("")) {
                errors.add("password", new ActionMessage(
                        "request.error.password"));
            }
            if (null == repassword || repassword.equals("")) {
                errors.add("repassword", new ActionMessage(
                        "request.error.repassword"));
            }
            if (!repassword.equals(password)) {
                errors.add("repassword", new ActionMessage(
                        "request.error.dfpassword"));
            }
            if (null == email || email.equals("")) {
                errors.add("email", new ActionMessage("request.error.email"));
            } else if (!com.demo.tools.Encrypt.checkEmail(email)) {
                errors.add("email", new ActionMessage("request.error.email1"));
            }
            if (question.length() != 0) {
                if (null == result || result.equals("")) {
                    errors.add("result", new ActionMessage(
                            "request.error.result"));
                }
            }
        }

        if (requestString.equalsIgnoreCase("method=checkUserInfo")) {

            if (null == account || account.equals("")) {
                errors.add("account",
                        new ActionMessage("request.error.account"));
            }
            if (null == password || password.equals("")) {
                errors.add("password", new ActionMessage(
                        "request.error.password"));
            }
            if (null == code || code.equals("")) {
                errors.add("code", new ActionMessage("request.error.code"));
            }
            else if (!code.equals(rand)) {
                errors.add("code", new ActionMessage("request.error.decode"));
            }

        }
        return errors;
    }

    /**
     * Method reset
     *
     * @param mapping
     * @param request
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        // TODO Auto-generated method stub
    }
}
package com.demo.tools;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Encrypt {
    public static String encodeMD5(String str) {
        if (str == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        try {
            MessageDigest code = MessageDigest.getInstance("MD5");
            code.update(str.getBytes());
            byte[] bs = code.digest();
            for (int i = 0; i < bs.length; i++) {
                int v = bs[i] & 0xFF;
                if (v < 16) {
                    sb.append(0);
                }
                sb.append(Integer.toHexString(v));
            }
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return sb.toString().toUpperCase();
    }

    public static boolean checkEmail(String email) {
        String regex = "[a-zA-Z][\\w_]+@\\w+(\\.\\w+)+";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(email);
        return m.matches();

    }
}
package com.demo.tools;

import java.sql.*;

public class JDBConnection {
    private final String dbDriver = "com.mysql.jdbc.Driver";
    private final String url = "jdbc:mysql://localhost:3306/testdb?useUnicode&characterEncodiing=utf-8&useSSL=true&rewriteBatchedStatements=true";
    private final String userName = "root";
    private final String password = "root";
    private ResultSet rs = null;
    private Statement stmt = null;
    private Connection con = null;
    private PreparedStatement preparedStatement  = null;

    public JDBConnection() {
        try {
            Class.forName(dbDriver).newInstance();
        }
        catch (Exception ex) {
            System.out.println("数据库加载失败");
        }
    }


    private boolean creatConnection() {
        try {
            con = DriverManager.getConnection(url, userName, password);
            con.setAutoCommit(true);
            return true;
        }
        catch (SQLException e) {
            System.out.println(e.getMessage());
            return false;
        }

    }

    private void createPsStatement(String sql) {
        creatConnection();
        try {
            System.out.println("创建PrepareStatement通道对象。。。");
            preparedStatement  = con.prepareStatement(sql);
        }
        catch (SQLException e) {
            System.out.println("创建PrepareStatement通道对象失败。。。");
            e.printStackTrace();
        }
    }

    private  void bundle(String[] parm) {
        //判断数组Parm是否为空
        if (parm != null) {
            //通过for循环将参数绑定起来
            for (int i = 0; i < parm.length; i++) {
                try {
                    System.out.println( "进行参数的绑定。。。");
                    preparedStatement.setString(i + 1, parm[i]);
                }
                catch (SQLException e) {
                    System.out.println("绑定参数失败。。。");
                    e.printStackTrace();
                }
            }
        }
    }

    public ResultSet queryByPsStatement(String sql,String[] pram) {
        createPsStatement(sql);
        bundle(pram);
        try {
            System.out.println("采用PrepareStatement方法执行sql查询语句。。。");
            rs = preparedStatement .executeQuery();
        }
        catch (SQLException e) {
            System.out.println("采用PrepareStatement方法执行sql查询语句失败");
            e.printStackTrace();
        }
        return rs;
    }

    public Boolean updateData(String sql,String[] parm) {
        //创建通道
        createPsStatement(sql);
        //绑定参数
        bundle(parm);
        int row = 0;
        try {
            System.out.println("修改数据中。。。");
            row = preparedStatement.executeUpdate();
        } catch (SQLException e) {
            System.out.println("修改数据失败。。。");
            e.printStackTrace();
        }
        boolean res = false;
        if (row > 0) {
            res = true;
        }
        return res;
    }

    public void closeAll() {
        if (rs != null) {
            try {
                System.out.println("关闭resultSet。。。");
                rs.close();
            } catch (SQLException e) {
                System.out.println("关闭resultSet异常。。。");
                e.printStackTrace();
            }
        }
        if (stmt != null) {
            try {
                System.out.println("关闭statement。。。");
                stmt.close();
            } catch (SQLException e) {
                System.out.println("关闭statement异常。。。");
                e.printStackTrace();
            }
        }
        if (preparedStatement  != null) {
            try {
                System.out.println("关闭preparestatement。。。");
                preparedStatement .close();
            } catch (SQLException e) {
                System.out.println("关闭preparestatement异常。。。");
                e.printStackTrace();
            }
        }
        if (con != null) {
            try {
                System.out.println("关闭connection。。。");
                con.close();
            } catch (SQLException e) {
                System.out.println("关闭connection异常。。。");
                e.printStackTrace();
            }
        }
    }
}
package com.demo.tools;


import org.apache.struts.action.RequestProcessor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;

public class SelfRequestProcessor extends RequestProcessor {
    public SelfRequestProcessor() {
    }

    protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) {

        super.processPreprocess(request, response);

        try {
            request.setCharacterEncoding("UTF-8");
        }
        catch (UnsupportedEncodingException ex) {
            ex.printStackTrace();
        }
        return true;
    }
}
request.error.code=\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801\uff01
request.error.decode=\u60a8\u8f93\u5165\u7684\u9a8c\u8bc1\u7801\u4e0d\u6b63\u786e\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01
request.error.account=\u8bf7\u8f93\u5165\u7528\u6237\u540d\uff01
request.error.account1=\u60a8\u8f93\u5165\u7684\u7528\u6237\u540d\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01
request.error.password=\u8bf7\u60a8\u8f93\u5165\u767b\u5f55\u5bc6\u7801\uff01
request.error.repassword=\u8bf7\u60a8\u8f93\u5165\u786e\u8ba4\u5bc6\u7801\uff01
request.error.dfpassword=\u60a8\u8f93\u5165\u7684\u5bc6\u7801\u4e0e\u786e\u8ba4\u5bc6\u7801\u4e0d\u540c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01
request.error.email=\u8bf7\u60a8\u8f93\u5165Email\u5730\u5740\uff01
request.error.result=\u8bf7\u60a8\u8f93\u5165\u95ee\u9898\u7684\u7b54\u6848\uff01
request.error.email1=\u60a8\u8f93\u5165\u7684Email\u5730\u5740\u4e0d\u5408\u6cd5\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01

CSS代码:

<!--
td {
    font-size: 9pt;color: #000000;
}
a:hover {
    font-size: 9pt;
    color: #FF0000;
}
a {
    font-size: 9pt;
    text-decoration: none;
    color: #000000;
}
img{
    border:0;
}
.img1{
    border:1px;
}
.blue {
    font-size: 9pt;
    color: #034683;
}
.bgcolor {
    font-size: 9pt;
    color: #1980DB;
}
.btn_grey {
    font-family: "宋体";
    font-size: 9pt;
    color: #333333;
    background-color: #eeeeee;
    cursor: hand;
    padding:1px;
    height:19px;
    border-top: 1px solid #FFFFFF;
    border-right:1px solid #666666;
    border-bottom: 1px solid #666666;
    border-left: 1px solid #FFFFFF;
}
input{
    font-family: "宋体";
    font-size: 9pt;
    color: #333333;
    border: 1px solid #999999;
}
.word_white{
    color:#FFFFFF;
}
.word_deepgrey{
    color:#999999;
}
.word_orange{
    color:#FF6600;
}
.word_green{
    color:#FEECEA;
}
.noborder{
    border:none;
}
.word_gray{
    color:#dddddd;
}
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
textarea {
    font-family: "宋体";
    font-size: 9pt;
    color: #333333;
    border: 1px solid #999999;
}

hr{
    border-style:dashed;
    color:#CCCCCC;
}

.tableBorder_lb {
    border: #D8D8D8 1px solid;
    border-top-style:none;
    border-bottom-style:none;
}
.a1:link {
    color: #FFFFFF;
    TEXT-DECORATION: none;
    font-size:9pt;
}
.a1:visited {
    color: #FFFFFF;
    TEXT-DECORATION: none;
    font-size:9pt;
}
.a1:active {
    color: #FFFFFF;
    TEXT-DECORATION: none;
    font-size:9pt;
}
.a1:hover {
    color: #FF0000;
    font-size:9pt;
}
.a2:link {
    color: #FF0000;
    TEXT-DECORATION: none ;
    font-size:9pt;
}
.a2:visited {
    color: #FF0000;
    TEXT-DECORATION: none;
    font-size:9pt;
}
.a2:active {
    color: #FF0000;
    font-size:9pt;
    text-decoration:none;
}
.a2:hover {
    color: #FFFFFF;
    font-size:9pt;
}
.a3:link {
    color: #FFFFFF;
    TEXT-DECORATION: none ;
    font-size:9pt;
}
.a3:visited {
    color: #FFFFFF;
    TEXT-DECORATION: none;
    font-size:9pt;
}
.a3:active {
    color: #FFFFFF;
    font-size:9pt;
    text-decoration:none;

}
.a3:hover {
    color: #FF0000;
    font-size:9pt;
}
.a4:link {
    color: #6C6C6E;
    TEXT-DECORATION: none ;
    font-size:10pt;
    font-weight:bold;
}
.a4:visited {
    color: #6C6C6E;
    TEXT-DECORATION: none;
    font-size:10pt;
    font-weight:bold;
}
.a4:active {
    color: #6C6C6E;
    font-size:10pt;
    text-decoration:none;
    font-weight:bold;
}
.a4:hover {
    color: #FF0000;
    font-size:10pt;
    font-weight:bold;
}

.lineline{
    line-height:1.5em;
}
.a5:link {
    color: #F9B77D;
    TEXT-DECORATION: none ;
    font-size:10pt;
    font-weight:bold;
}
.a5:visited {
    color: #F9B77D;
    TEXT-DECORATION: none;
    font-size:10pt;
    font-weight:bold;
}
.a5:active {
    color: #F9B77D;
    font-size:10pt;
    text-decoration:none;
    font-weight:bold;
}
.a5:hover {
    color: #FF0000;
    font-size:10pt;
    font-weight:bold;
}
.a6:link {
    color: #FF0000;
    TEXT-DECORATION: underline ;
    font-size:9pt;
    font-weight:bold;
}
.a6:visited {
    color: #FF0000;
    TEXT-DECORATION: underline;
    font-size:9pt;
    font-weight:bold;
}
.a6:active {
    color: #FF0000;
    font-size:9pt;
    text-decoration: underline;
    font-weight:bold;
}
.a6:hover {
    color: #000000;
    font-size:9pt;
    font-weight:bold;
}
.lineline{
    line-height:1.5em;
}
.a7:link {
    color: #FF0000;
    TEXT-DECORATION: none ;
    font-size:10pt;
    font-weight:bold;
}
.a7:visited {
    color: #FF0000;
    TEXT-DECORATION: none;
    font-size:10pt;
    font-weight:bold;
}
.a7:active {
    color: #FF0000;
    font-size:10pt;
    text-decoration: none;
    font-weight:bold;
}
.a7:hover {
    color: #000000;
    font-size:10pt;
    font-weight:bold;
}
.line{
    color:#FFE400;
    font-size:9pt;
    line-height:12pt;
}
select{
    font-family: "宋体";
    font-size: 9pt;
    color: #333333;
    border: 1px solid #999999;
}
.cannelBorder{
    border: 0px solid #999999;
}
.inputinput{
    font-family: "宋体";
    font-size: 9pt;
    color: #333333;
    border: 1px solid #67A0CD;

}

JSP页面:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:directive.page import="com.demo.form.UserInfoForm"/>
<%@ taglib prefix="html"  uri="/WEB-INF/struts-html.tld"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工作室—用户登录</title>
    <link href="css/style.css" type="text/css" rel="stylesheet" />
    <script language="javascript">
        function reload(){
            document.getElementById("checkCode").src="image.jsp?nocache="+new Date().getTime();
        }
    </script>
</head>
<body>
<table width="840" height="71" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_01.png">
    <tr>
        <td width="236"> </td>
        <td width="604" valign="top"><table width="573" border="0" align="right" cellpadding="0" cellspacing="0">
            <tr>
                <td width="573" height="43" valign="bottom">
                    <a href="#" class="a2">首页</a>   
                    <a href="#" class="a1">Cisco</a>   
                    <a href="#" class="a1">Windows</a>   
                    <a href="#" class="a1">Linux</a>   
                    <a href="#" class="a1">Java</a>   
                    <a href="#" class="a1">.Net</a>   
                    <a href="#" class="a1">互联网</a>   
                    <a href="#" class="a1">IT动态网</a>   
                    <a href="#" class="a1">网络设备</a>  
                    <a href="#" class="a1">服务器</a>
                </td>
            </tr>
            <tr>
                <td height="24">
                    <a href="#" class="a1">      IDC</a>    
                    <a href="#" class="a1">IT技术</a>    
                    <a href="#" class="a1">专题</a>    
                    <a href="#" class="a1">培训</a>   
                    <a href="#" class="a1">下载</a>   
                    <a href="#" class="a1">搜索</a>  
                    <a href="#" class="a1">虚拟考场</a>  
                    <a href="#" class="a1">远程培训</a>  
                    <a href="#" class="a1">周刊</a>  
                    <a href="#" class="a1">博客</a>
                </td>
            </tr>
        </table></td>
    </tr>
</table>
<table width="840" height="131" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_02.gif">
    <tr>
        <td width="746"> </td>
        <td width="94">
            <a href="#" class="a3">About US</a><br>
            <br>
            <a href="#" class="a3">Cortent US</a><br>
            <br>
            <a href="#" class="a3">Home</a></td>
    </tr>
</table>

<%
    UserInfoForm userInfoForm=null;
    if(null==session.getAttribute("userInfo")){
%>
<table width="840" height="33" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_03.gif">
    <tr>
        <td>
                <span class="STYLE1"><font color="6C6C6E">您尚未</font></span>  <a href="#" class="a4">登录</a>  <a href="register.jsp" class="a4">注册</a>  |  <a href="#" class="a4">推荐 </a> |  <a href="#" class="a4">搜索 </a> |  <a href="#" class="a4">社区服务</a>  |  <a href="#" class="a4">朋友圈</a>  |  <a href="#" class="a4">我的空间</a>  |  <a href="#" class="a4">帮助</a>	  </td>
    </tr>
</table>
<table width="840" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder_lb">
    <tr>
        <td height="104" valign="top">
            <br>
            <table width="249" height="30" border="0" cellpadding="0" cellspacing="0" background="images/land_07.gif">
                <tr>
                    <td width="35"> </td>
                    <td width="214"><span class="STYLE9">工作室登录窗口</span></td>
                </tr>
            </table>
            <table width="249" height="137" border="0" cellpadding="0" cellspacing="0" background="images/land_08.gif">
                <tr>
                    <td width="24"> </td>
                    <td width="225">
                        <br>
                        <table width="203" border="0">

                            <html:form action="userInfo.do?method=checkUserInfo">
                                <tr>
                                    <td width="53" height="30"> 用户名: </td>
                                    <td width="140"><html:text property="account"  styleClass="inputinput"/></td>
                                </tr>
                                <tr>
                                    <td height="30"> 密  码:</td>
                                    <td><html:password property="password" styleClass="inputinput"/></td>
                                </tr>
                                <tr>
                                    <td height="30"> 验证码: </td>
                                    <td><html:text property="code" styleClass="inputinput"/></td>
                                </tr>
                                <tr>
                                    <td height="30"> </td>
                                    <td><table width="131" border="0">
                                        <tr>
                                            <td width="74">
                                                <img border=0 src="image.jsp" id="checkCode"/>
                                            </td>
                                            <td width="47">
                                                <a href="#" class="a6" onClick="reload()">看不清</a>
                                            </td>
                                        </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                    <td height="30"> </td>
                                    <td>
                                        <html:submit value=" " style="background-image:url(images/land_10.gif);border:0;width:54;height:20"/>  

                                        <html:button value=" " property="register"
                                                     style="background-image:url(images/land_11.gif);
                                                     border:0;width:54;height:20"
                                                     onclick="javasrcipt:window.location.href='register.jsp'">

                                        </html:button>
                                    </td>
                                </tr>
                                <tr>
                                    <td> </td>
                                    <td>
                                        <html:errors property="account"/><br>
                                        <html:errors property="password"/><br>
                                        <html:errors property="code"/><br>
                                    </td>
                                </tr>
                            </html:form>
                        </table>
                    </td>
                </tr>
            </table>
            <img src="images/land_09.png" width="249" height="57"></td>
        <td width="601" valign="top">
            <br>

            <table width="562" height="28" border="0" cellpadding="0" cellspacing="0" background="images/land_05.gif">
                <tr>
                    <td width="37"> </td>
                    <td width="525"><span class="STYLE6">关于工作室</span></td>
                </tr>
            </table>

            <table width="484" height="94" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="462" height="94">
                        <span class="lineline">
                            <span class="STYLE7">  
                                <span class="STYLE8">工作室</span>
                            </span>是由几个志同道合的朋友一起创办的集博客、论坛、空间、新闻等8大功能于一身的门户网站机构、先已拥有800万固定网友...... </span>
                    </td>
                </tr>
            </table>

            <table width="148" height="19" border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="19">
                        <a href="#" class="a5"><img src="images/land_19.gif" width="49" height="15"></a>
                    </td>
                </tr>
            </table><br><br>

            <table width="562" height="28" border="0" cellpadding="0" cellspacing="0" background="images/land_05.gif">
                <tr>
                    <td width="37"> </td>
                    <td width="525"><span class="STYLE6">打造国内最酷个人空间</span></td>
                </tr>
            </table>

            <table width="446" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="208" height="45" valign="bottom" class="word">
                        <span class="lineline"><strong class="STYLE8">空间</strong><br>
                            提供50MB免费空间,支持MySQL数据库</span>
                    </td>
                    <td width="189" valign="bottom" class="word">
                        <span class="lineline">
                            <strong class="STYLE8">空间</strong><br>30位斑竹热聘中....</span>
                    </td>
                </tr>
            </table>

            <table width="446" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="234" height="54" valign="bottom" class="word">
                        <span class="lineline"><strong class="STYLE8">博客</strong>
                            <br>新近研发博客搬家工具,方便之门</span>
                    </td>
                    <td width="212" valign="bottom" class="word"><span class="lineline">
                        <strong class="STYLE8">下载</strong>
                        <br>500万资源供您下载</span>
                    </td>
                </tr>
            </table>

            <table width="148" height="19" border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="19"><a href="#" class="a5">
                        <img src="images/land_19.gif" width="49" height="15"></a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<%}else{
    userInfoForm=(UserInfoForm)session.getAttribute("userInfo");
%>
<table width="840" height="33" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_03.gif">
    <tr>
        <td align="right">    
            <span class="STYLE1"><font color="6C6C6E">您已经登录</font></span>  
            <a href="dealwith.jsp?sign=3" class="a4">如果想退出,请单击此链接</a>   | 
            <a href="#" class="a4">朋友圈</a>  |  
            <a href="#" class="a4">我的空间</a>  |  
            <a href="#" class="a4">帮助  </a>
        </td>
    </tr>
</table>
<table width="840" height="62" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder_lb">
    <tr>

        <td width="664" align="center">
            <br>
            <table width="651" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_14.gif">
                <tr>
                    <td height="30" colspan="2"  background="images/land_13.gif">       显示用户信息</td>
                </tr>
                <tr>
                    <td width="120" height="30" align="right">  用户名:</td>
                    <td width="531"> <%=userInfoForm.getAccount() %></td>
                </tr>
                <tr>
                    <td height="30" align="right">  Email:</td>
                    <td height="30"> <%=userInfoForm.getEmail() %></td>
                </tr>
                <tr>
                    <td height="30" align="right">  昵  称:</td>
                    <td height="30"> <%=userInfoForm.getName() %></td>
                </tr>
                <tr>
                    <td height="30" align="right">  性  别:</td>
                    <td height="30"> <%=userInfoForm.getSex() %></td>
                </tr>
                <tr>
                    <td height="30" align="right">  来  自:</td>
                    <td height="30"> <%=userInfoForm.getFromspace() %></td>
                </tr>
                <tr>
                    <td height="30" align="right">  QQ:</td>
                    <td height="30"> <%=userInfoForm.getQq() %></td>
                </tr>
                <tr>
                    <td height="30" align="right">  自我介绍:</td>
                    <td height="30"> <%=userInfoForm.getIntroduce() %></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <img src="images/land_15.gif" width="651" height="5">
                    </td>
                </tr>
            </table>
            <br>
        </td>
        <td width="174" valign="bottom">
            <div align="right">
                <img src="images/land_12.png" width="173" height="57">
            </div>
        </td>
    </tr>
</table>
<%} %>

<table width="840" height="48" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_06.gif">
    <tr>
        <td align="center">
            <span class="STYLE3"><br>
              <span class="STYLE12"></span>
           </span>
        </td>
    </tr>
</table>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="html"  uri="/WEB-INF/struts-html.tld"%>
<html>
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工作室—用户注册</title>
    <link href="css/style.css" type="text/css" rel="stylesheet" />
    <script language="javascript">
        var http_request = false;
        function createRequest(url,alert) {
            //初始化对象并发出XMLHttpRequest请求
            http_request = false;
            if (window.XMLHttpRequest) {
                // Mozilla或其他除IE以外的浏览器
                http_request = new XMLHttpRequest();
                if (http_request.overrideMimeType) {
                    http_request.overrideMimeType("text/xml");
                }
            }
            else if (window.ActiveXObject) {
                // IE浏览器
                try {
                    http_request = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        http_request = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) {}
                }
            }
            if (!http_request) {
                alert("不能创建XMLHTTP实例!");
                return false;
            }
            http_request.onreadystatechange = alert;    //指定响应方法
            //发出HTTP请求
            http_request.open("GET", url, true);
            http_request.send(null);
        }

        function alertAccount() {    //处理服务器返回的信息
            if (http_request.readyState == 4) {
                if (http_request.status == 200) {
                    account1.innerHTML=http_request.responseText;
                } else {
                    alert('您请求的页面发现错误');
                }
            }
        }

        function alertEmail() {    //处理服务器返回的信息
            if (http_request.readyState == 4) {
                if (http_request.status == 200) {
                    email.innerHTML=http_request.responseText;
                } else {
                    alert('您请求的页面发现错误');
                }
            }
        }

        function alertRepassword() {    //处理服务器返回的信息
            if (http_request.readyState == 4) {
                if (http_request.status == 200) {
                    repassword.innerHTML=http_request.responseText;
                } else {
                    alert('您请求的页面发现错误');
                }
            }
        }

        function alertCode() {    //处理服务器返回的信息
            if (http_request.readyState == 4) {
                if (http_request.status == 200) {
                    code.innerHTML=http_request.responseText;
                } else {
                    alert('您请求的页面发现错误');
                }
            }
        }
    </script>
    <script language="javascript">

        function F_code(code){
            createRequest("dealwith.jsp?sign=0&code="+code,alertCode);
        }

        function F_account(account){
            createRequest("dealwith.jsp?sign=1&account="+account,alertAccount);
        }

        function F_email(email){
            createRequest("dealwith.jsp?sign=2&email="+email,alertEmail);
        }

        function F_repassword(repassword){
            var password= userInfoForm.password.value;
            createRequest("dealwith.jsp?sign=4&&password="+password+"&repassword="+repassword,alertRepassword);
        }

        function reload(){
            document.getElementById("checkCode").src="image.jsp?nocache="+new Date().getTime();
        }
    </script>
</head>
<body>
<table width="840" height="71" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_01.png">
    <tr>
        <td width="236"> </td>
        <td width="604" valign="top">
            <table width="573" border="0" align="right" cellpadding="0" cellspacing="0">
            <tr>
                <td width="573" height="43" valign="bottom">
                    <a href="#" class="a2">首页</a>   
                    <a href="#" class="a1">Cisco</a>   
                    <a href="#" class="a1">Windows</a>   
                    <a href="#" class="a1">Linux</a>   
                    <a href="#" class="a1">Java</a>   
                    <a href="#" class="a1">.Net</a>   
                    <a href="#" class="a1">互联网</a>   
                    <a href="#" class="a1">IT动态网</a>   
                    <a href="#" class="a1">网络设备</a>  
                    <a href="#" class="a1">服务器</a>
                </td>
            </tr>
            <tr>
                <td height="24">
                    <a href="#" class="a1">      IDC</a>
                       <a href="#" class="a1">IT技术</a>
                       <a href="#" class="a1">专题</a>
                       <a href="#" class="a1">培训</a>
                      <a href="#" class="a1">下载</a>
                      <a href="#" class="a1">搜索</a>  
                    <a href="#" class="a1">虚拟考场</a>  
                    <a href="#" class="a1">远程培训</a>  
                    <a href="#" class="a1">周刊</a>  
                    <a href="#" class="a1">博客</a>
                </td>
            </tr>
            </table>
        </td>
    </tr>
</table>

<table width="840" height="131" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_02.gif">
    <tr>
        <td width="746"> </td>
        <td width="94">
            <a href="#" class="a3">About US</a><br>
            <br>
            <a href="#" class="a3">Cortent US</a><br>
            <br>
            <a href="#" class="a3">Home </a></td>
    </tr>
</table>

<table width="840" height="33" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_03.gif">
    <tr>
        <td width="645">   </td>
        <td width="195">
            <span class="STYLE2"> 
                <span class="STYLE3">游客:</span>
            </span>
            <a href="register.jsp" class="a4">注册</a> |
            <a href="index.jsp" class="a4">登录</a> |
            <a href="#" class="a4">帮助</a>
        </td>
    </tr>
</table>

<table width="840" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder_lb">
    <tr>
        <td width="789" height="129">

            <br>
            <table width="651" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_14.gif">
                <html:form action="userInfo.do?method=saveUserInfo">
                    <tr>
                        <td height="30" colspan="3" background="images/land_13.gif">      注册</td>
                    </tr>
                    <tr>
                        <td height="30" colspan="3" align="center">
                            <span class="STYLE5">以 下 条 目 注 册 用 户 必 须 填 写</span>
                        </td>
                    </tr>

                    <tr>
                        <td width="158" height="40" align="right">  验证码:</td>
                        <td>
                            <html:text property="code" onkeydown="F_code(this.value)"
                                       onkeypress="F_code(this.value)" onkeyup="F_code(this.value)"/>
                        </td>
                        <td>
                            <table width="322" border="0">
                            <tr>
                                <td width="52" height="34">
                                    <a href="#" onClick="reload();">
                                        <img border=0 src="image.jsp" id="checkCode">
                                    </a>
                                </td>
                                <td width="260" id="code">
                                    <html:errors property="code"/> </td>
                            </tr>
                        </table>
                        </td>
                    </tr>

                    <tr>
                        <td height="40" align="right">  用户名:</td>
                        <td width="159" height="40">
                            <html:text property="account" onkeydown="F_account(this.value)"
                                       onkeypress="F_account(this.value)" onkeyup="F_account(this.value)"/>
                        </td>
                        <td width="334" id="account1">
                            <html:errors property="account"/> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  密码:</td>
                        <td height="40"><html:password property="password"/></td>
                        <td height="40" id="password">
                            <html:errors property="password"/> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  确认密码:</td>
                        <td height="40">
                            <html:password property="repassword" onkeydown="F_repassword(this.value)"
                                           onkeypress="F_repassword(this.value)" onkeyup="F_repassword(this.value)"/>
                        </td>
                        <td height="40" id="repassword">
                            <html:errors property="repassword"/> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  Email地址:</td>
                        <td height="40">
                            <html:text property="email" onkeydown="F_email(this.value)"
                                       onkeypress="F_email(this.value)" onkeyup="F_email(this.value)"/>
                        </td>
                        <td height="40" id="email">
                            <html:errors property="email"/> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  高级选项:</td>
                        <td height="40" colspan="2">
                            <html:checkbox value="1" property="sign" styleClass="cannelBorder"/>
                             显示高级用户设置选项</td>
                    </tr>
                    <tr>
                        <td height="30" colspan="3" align="center">
                            <span class="STYLE5">
                                以 下 条 目 注 册 用 户 选 填</span>
                            </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  安全提问:</td>
                        <td height="40" colspan="2"><html:select property="question">
                            <html:option value="">请选择问题</html:option>
                            <html:option value="你的母亲叫什么名字">你的母亲叫什么名字</html:option>
                            <html:option value="你的父亲叫什么名字">你的父亲叫什么名字</html:option>
                            <html:option value="你的孩子叫什么名字">你的孩子叫什么名字</html:option>
                            <html:option value="你毕业哪所高校">你毕业哪所高校</html:option>
                            <html:option value="你的出生日期是多少">你的出生日期是多少</html:option>
                        </html:select>
                        </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  回答:</td>
                        <td height="40"><html:text property="result"/></td>
                        <td height="40"><html:errors property="result"/> </td>
                    </tr>
                    <tr>
                        <td height="40"align="right" >  昵称:</td>
                        <td height="40"><html:text property="name"/></td>
                        <td height="40"> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  性别:</td>
                        <td height="40" colspan="2">
                            <html:radio property="sex" value="男" styleClass="cannelBorder"/>
                              男  
                            <html:radio property="sex" value="女" styleClass="cannelBorder"/>
                              女</td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  来自:</td>
                        <td height="40"><html:text property="fromspace"/></td>
                        <td height="40"> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  QQ:</td>
                        <td height="40"><html:text property="qq"/></td>
                        <td height="40"> </td>
                    </tr>
                    <tr>
                        <td height="40" align="right">  自我介绍:</td>
                        <td height="40" colspan="2"><html:textarea property="introduce" cols="50"/></td>
                    </tr>
                    <tr align="center">
                        <td height="30" colspan="3">

                            <html:submit value=" " style="background-image:url(images/land_17.gif);border:0;width:54;height:20"/>  
                            <html:reset value=" " style="background-image:url(images/land_16.gif);border:0;width:54;height:20"/>
                        </td>
                    </tr>


                    <tr align="center">
                        <td colspan="3">
                            <img src="images/land_15.gif">
                        </td>
                    </tr>
                </html:form>
            </table>
        </td>

        <td width="49" valign="bottom">
            <img src="images/land_12.png" width="173" height="57">
        </td>
    </tr>
</table>

<table width="840" height="48" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_06.gif">
    <tr>
        <td align="center">
            <span class="STYLE4"><br>
                <span class="STYLE12"></span></span>
        </td>
    </tr>
</table>
</body>
</html>
<%@ page contentType="image/jpeg"
         import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" language="java" %>
<%!Color getRandColor(int fc, int bc)
{//给定范围获得随机颜色
    Random random = new Random();
    if (fc > 255)
        fc = 255;
    if (bc > 255)
        bc = 255;
    int r = fc + random.nextInt(bc - fc);
    int g = fc + random.nextInt(bc - fc);
    int b = fc + random.nextInt(bc - fc);
    return new Color(r, g, b);
}%>
<%
    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    // 在内存中创建图象
    int width = 60, height = 20;
    BufferedImage image = new BufferedImage(width, height,
            BufferedImage.TYPE_INT_RGB);

    // 获取图形上下文
    Graphics g = image.getGraphics();

    //生成随机类
    Random random = new Random();

    // 设定背景色
    g.setColor(getRandColor(200, 250));
    g.fillRect(0, 0, width, height);

    //设定字体
    g.setFont(new Font("Times New Roman", Font.PLAIN, 18));

    // 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到
    g.setColor(getRandColor(160, 200));
    for (int i = 0; i < 155; i++)
    {
        int x = random.nextInt(width);
        int y = random.nextInt(height);
        int xl = random.nextInt(12);
        int yl = random.nextInt(12);
        g.drawLine(x, y, x + xl, y + yl);
    }

    // 取随机产生的认证码(4位数字)
    String sRand = "";
    for (int i = 0; i < 4; i++)
    {
        String rand = String
                .valueOf(random.nextInt(10));
        sRand += rand;
        // 将认证码显示到图象中
        g.setColor(new Color(20 + random.nextInt(110),
                20 + random.nextInt(110), 20 + random
                .nextInt(110)));
        //调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
        g.drawString(rand, 13 * i + 6, 16);
    }

    // 将认证码存入SESSION
    session.setAttribute("rand", sRand);

    // 图象生效
    g.dispose();

    // 输出图象到页面
    ImageIO.write(image, "JPEG",response.getOutputStream());
    out.clear();
    out=pageContext.pushBody();
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%
        String information=null;
        if(null!=request.getAttribute("information")){
            information=(String)request.getAttribute("information");
        }
    %>
    <title><%=information %></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="css/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<table width="840" height="71" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_01.png">
    <tr>
        <td width="236"> </td>
        <td width="604" valign="top">
            <table width="573" border="0" align="right" cellpadding="0" cellspacing="0">
            <tr>
                <td width="573" height="43" valign="bottom">
                    <a href="#" class="a2">首页</a>   
                    <a href="#" class="a1">Cisco</a>   
                    <a href="#" class="a1">Windows</a>   
                    <a href="#" class="a1">Linux</a>   
                    <a href="#" class="a1">Java</a>   
                    <a href="#" class="a1">.Net</a>   
                    <a href="#" class="a1">互联网</a>   
                    <a href="#" class="a1">IT动态网</a>   
                    <a href="#" class="a1">网络设备</a>  
                    <a href="#" class="a1">服务器</a>
                </td>
            </tr>
            <tr>
                <td height="24">
                    <a href="#" class="a1">      IDC</a>    
                    <a href="#" class="a1">IT技术</a>    
                    <a href="#" class="a1">专题</a>    
                    <a href="#" class="a1">培训</a>   
                    <a href="#" class="a1">下载</a>   
                    <a href="#" class="a1">搜索</a>  
                    <a href="#" class="a1">虚拟考场</a>  
                    <a href="#" class="a1">远程培训</a>  
                    <a href="#" class="a1">周刊</a>  
                    <a href="#" class="a1">博客</a>
                </td>
            </tr>
            </table>
        </td>
    </tr>
</table>

<table width="840" height="131" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_02.gif">
    <tr>
        <td width="746"> </td>
        <td width="94">
            <a href="#" class="a3">About US</a><br>
            <br>
            <a href="#" class="a3">Cortent US</a><br>
            <br>
            <a href="#" class="a3">Home </a>
        </td>
    </tr>
</table>

<table width="840" height="33" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_03.gif">
    <tr>
        <td width="666">   </td>
        <td width="174"><a href="#" class="a4">显示登录结果</a></td>
    </tr>
</table>

<table width="840" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder_lb">
    <tr>
        <td width="789"><br>
            <table width="651" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_14.gif">
                <tr>
                    <td height="30" colspan="3" background="images/land_13.gif">
                              
                        <span class="STYLE6">工作室 >> <%=information%>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td width="334" colspan="3" align="center">
                        <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <table width="549" height="150" border="0" align="center" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td width="539" height="148" align="center">
                                            <table width="305" border="0" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td width="102">
                                                        <img src="images/land_18.gif" width="99" height="146">
                                                    </td>
                                                    <td width="203" valign="top">
                                                        <table width="196" border="0">
                                                        <tr>
                                                            <td width="186" height="67" valign="bottom">
                                                                <span class="STYLE6"><%=information%></span>  
                                                                <a href="index.jsp" class="a7">请返回!</a>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>

                <tr align="center">
                    <td colspan="3"><img src="images/land_15.gif"></td>
                </tr>

            </table>
        </td>
        <td width="49" valign="bottom">
            <img src="images/land_12.png" width="173" height="57">
        </td>
    </tr>
</table>

<table width="840" height="48" border="0" align="center" cellpadding="0" cellspacing="0" background="images/land_06.gif">
    <tr>
        <td align="center">
            <span class="STYLE4"><br>
                <span class="STYLE12"></span>
            </span>
        </td>
    </tr>
</table>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%
    request.setCharacterEncoding("utf-8");
    Integer sign = Integer.parseInt(request.getParameter("sign"));
    if (sign == 0) {
        String code = request.getParameter("code");
        String rand = (String) session.getAttribute("rand");
        if (null != code||!code.equals("")) {
            if (!code.equals(rand)) {
                out.print("您输入的校验码不正确");
            }
        }
    }
    if (sign == 1) {
        String account = request.getParameter("account");
        account = new String(account.getBytes("ISO8859_1"), "utf-8");
        System.out.print(account);
        String result = com.demo.check.CheckOutData.isCheckUser(account);
        out.print(result);
    }
    if (sign == 2) {
        String email = request.getParameter("email");
        String result = com.demo.check.CheckOutData.idCheckEmail(email);
        out.print(result);
    }
    if (sign == 3) {
        session.invalidate();
        response.sendRedirect("index.jsp");
    }
    if (sign == 4) {
        String password = request.getParameter("password");
        String repassword = request.getParameter("repassword");
        if (repassword != null || !repassword.equals("")) {
            if (!password.equals(repassword)) {
                out.print("您两次输入的密码不一致");
            }
        }
    }
%>

struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
	<form-beans>
		<form-bean name="userInfoForm" type="com.demo.form.UserInfoForm" />
	</form-beans>

	<action-mappings>
		<action path="/inputGo" type="com.demo.action.InputGoAction"
			name="userInfoForm" scope="request" validate="false">
			<forward name="saveforward" path="/register.jsp" />
			<forward name="checkforward" path="/index.jsp" />
		</action>

		<action path="/userInfo" type="com.demo.action.UserInfoAction"
			name="userInfoForm" scope="request" parameter="method"
			validate="true" input="/inputGo.do">
			<forward name="opeationUserInfo" path="/showOperation.jsp" />
			<forward name="queryAccount" path="/dealwith.jsp" />			
		</action>
	</action-mappings>

	<controller processorClass="com.demo.tools.SelfRequestProcessor" />

	<message-resources parameter="ApplicationResources" />

</struts-config>

web.xml

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>registerDemo2</display-name>

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

</web-app>

pom

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
</dependency>

<dependency>
  <groupId>javax.servlet.jsp</groupId>
  <artifactId>javax.servlet.jsp-api</artifactId>
  <version>2.3.1</version>
</dependency>

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>5.1.34</version>
</dependency>

<dependency>
  <groupId>struts</groupId>
  <artifactId>struts</artifactId>
  <version>1.2.9</version>
</dependency>

<dependency>
  <groupId>javax.mail</groupId>
  <artifactId>mail</artifactId>
  <version>1.4.7</version>
</dependency>

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://itzsg.com/22891.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

联系我们YX

mu99908888

在线咨询: 微信交谈

邮件:itzsgw@126.com

工作时间:时刻准备着!

关注微信