⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addplaneaction.java

📁 eclipse java/jsp 航空管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                            + m_ViewForm.getSelectm1()
                            + m_ViewForm.getSelectm2());
                    /** 判断输入的小时是否大于24点 */
                    if (("2".equals(m_ViewForm.getSelecth1()))
                            && (Integer.parseInt(m_ViewForm.getSelecth2()) 
                                    >= 4)) {
                        count = false;
                    }
                    /** 判断输入的分钟数是否大于60 */
                    if (("6".equals(m_ViewForm.getSelectm1()))
                            && (Integer.parseInt(m_ViewForm.getSelectm2()) 
                                    > 0)) {
                        count = false;
                    }
                }

                /** 判断到达第一个城市的时间是否被输入 */
                if (("--".equals(m_ViewForm.getSelecth12()))
                        || ("--".equals(m_ViewForm.getSelecth22()))
                        || ("--".equals(m_ViewForm.getSelectm12()))
                        || ("--".equals(m_ViewForm.getSelectm22())))
                    count = false;
                /** 如果输入了则将时间值组合起来赋给text2来显示一个完整的时间 */
                else {
                    m_View.setText2(m_ViewForm.getSelecth12()
                            + m_ViewForm.getSelecth22() + ":"
                            + m_ViewForm.getSelectm12()
                            + m_ViewForm.getSelectm22());
                    /** 判断输入的小时是否大于24点 */
                    if (("2".equals(m_ViewForm.getSelecth12()))
                            && (Integer.parseInt(m_ViewForm.getSelecth22()) 
                                    >= 4)) {
                        count = false;
                    }
                    /** 判断输入的分钟数是否大于60 */
                    if (("6".equals(m_ViewForm.getSelectm12()))
                            && (Integer.parseInt(m_ViewForm.getSelectm22()) 
                                    > 0)) {
                        count = false;
                    }
                }

                /** 判断是否第三个城市被选择 */
                if (!"请选择".equals(toChinese(m_ViewForm.getSelect6()))) {
                    /**
                     * 如果选择了的话,那么进行判断 离开第二个城市的时间是否 被输入
                     */
                    if (("--".equals(m_ViewForm.getSelecth13()))
                            || ("--".equals(m_ViewForm.getSelecth23()))
                            || ("--".equals(m_ViewForm.getSelectm13()))
                            || ("--".equals(m_ViewForm.getSelectm23())))
                        count = false;

                    /** 如果输入了则将时间值组合起来赋给text3来显示一个完整的时间 */
                    else {
                        m_View.setText3(m_ViewForm.getSelecth13()
                                + m_ViewForm.getSelecth23() + ":"
                                + m_ViewForm.getSelectm13()
                                + m_ViewForm.getSelectm23());
                        /** 判断输入的小时是否大于24点 */
                        if (("2".equals(m_ViewForm.getSelecth13()))
                                && (Integer.parseInt(m_ViewForm.getSelecth23()) 
                                        >= 4)) {
                            count = false;
                        }
                        /** 判断输入的分钟数是否大于60 */
                        if (("6".equals(m_ViewForm.getSelectm13()))
                                && (Integer.parseInt(m_ViewForm.getSelectm23()) 
                                        > 0)) {
                            count = false;
                        }
                    }

                    /** 如果选择了的话,那么进行判断到达第三个城市的时间是否被输入 */
                    if (("--".equals(m_ViewForm.getSelecth14()))
                            || ("--".equals(m_ViewForm.getSelecth24()))
                            || ("--".equals(m_ViewForm.getSelectm14()))
                            || ("--".equals(m_ViewForm.getSelectm24())))
                        count = false;
                    /** 如果输入了则将时间值组合起来赋给text4来显示一个完整的时间 */
                    else
                        m_View.setText4(m_ViewForm.getSelecth14()
                                + m_ViewForm.getSelecth24() + ":"
                                + m_ViewForm.getSelectm14()
                                + m_ViewForm.getSelectm24());
                    /** 判断输入的小时是否大于24点 */
                    if (("2".equals(m_ViewForm.getSelecth14()))
                            && (Integer.parseInt(m_ViewForm.getSelecth24()) 
                                    >= 4)) {
                        count = false;
                    }
                    /** 判断输入的分钟数是否大于60 */
                    if (("6".equals(m_ViewForm.getSelectm14()))
                            && (Integer.parseInt(m_ViewForm.getSelectm24()) 
                                    > 0)) {
                        count = false;
                    }

                } else {
                    if ((!"--".equals(m_ViewForm.getSelecth13()))
                            || (!"--".equals(m_ViewForm.getSelecth23()))
                            || (!"--".equals(m_ViewForm.getSelectm13()))
                            || (!"--".equals(m_ViewForm.getSelectm23())))
                        count = false;
                    if ((!"--".equals(m_ViewForm.getSelecth14()))
                            || (!"--".equals(m_ViewForm.getSelecth24()))
                            || (!"--".equals(m_ViewForm.getSelectm14()))
                            || (!"--".equals(m_ViewForm.getSelectm24())))
                        count = false;
                }

                /** 判断是否第四个城市被选择 */
                if (!"请选择".equals(toChinese(m_ViewForm.getSelect7()))) {
                    /**
                     * 如果选择了的话,那么进行判断 离开第三个城市的时间是否 被输入
                     */
                    if (("--".equals(m_ViewForm.getSelecth15()))
                            || ("--".equals(m_ViewForm.getSelecth25()))
                            || ("--".equals(m_ViewForm.getSelectm15()))
                            || ("--".equals(m_ViewForm.getSelectm25())))
                        count = false;
                    /** 如果输入了则将时间值组合起来赋给text5来显示一个完整的时间 */
                    else {
                        m_View.setText5(m_ViewForm.getSelecth15()
                                + m_ViewForm.getSelecth25() + ":"
                                + m_ViewForm.getSelectm15()
                                + m_ViewForm.getSelectm25());
                        /**判断输入的小时是否大于24点*/
                        if (("2".equals(m_ViewForm.getSelecth15()))
                                && (Integer.parseInt(m_ViewForm.getSelecth25()) 
                                        >= 4)) {
                            count = false;
                        }
                        /**判断输入的分钟数是否大于60*/
                        if (("6".equals(m_ViewForm.getSelectm15()))
                                && (Integer.parseInt(m_ViewForm.getSelectm25()) 
                                        > 0)) {
                            count = false;
                        }
                    }
                    /** 如果选择了的话,那么进行判断到达第四个城市的时间是否被输入 */
                    if (("--".equals(m_ViewForm.getSelecth16()))
                            || ("--".equals(m_ViewForm.getSelecth26()))
                            || ("--".equals(m_ViewForm.getSelectm16()))
                            || ("--".equals(m_ViewForm.getSelectm26())))
                        count = false;
                    /** 如果输入了则将时间值组合起来赋给text6来显示一个完整的时间 */
                    else
                        m_View.setText6(m_ViewForm.getSelecth16()
                                + m_ViewForm.getSelecth26() + ":"
                                + m_ViewForm.getSelectm16()
                                + m_ViewForm.getSelectm26());
                    /**判断输入的小时是否大于24点*/
                    if (("2".equals(m_ViewForm.getSelecth16()))
                            && (Integer.parseInt(m_ViewForm.getSelecth26()) 
                                    >= 4)) {
                        count = false;
                    }
                    /**判断输入的分钟数是否大于60*/
                    if (("6".equals(m_ViewForm.getSelectm16()))
                            && (Integer.parseInt(m_ViewForm.getSelectm26()) 
                                    > 0)) {
                        count = false;
                    }

                } else {
                    if ((!"--".equals(m_ViewForm.getSelecth15()))
                            || (!"--".equals(m_ViewForm.getSelecth25()))
                            || (!"--".equals(m_ViewForm.getSelectm15()))
                            || (!"--".equals(m_ViewForm.getSelectm25())))
                        count = false;
                    if ((!"--".equals(m_ViewForm.getSelecth16()))
                            || (!"--".equals(m_ViewForm.getSelecth26()))
                            || (!"--".equals(m_ViewForm.getSelectm16()))
                            || (!"--".equals(m_ViewForm.getSelectm26())))
                        count = false;
                }

                if ((m_ViewForm.getSelect4().equals(m_ViewForm.getSelect5()))
                        || (m_ViewForm.getSelect4().equals(m_ViewForm
                                .getSelect6()))
                        || (m_ViewForm.getSelect4().equals(m_ViewForm
                                .getSelect7()))
                        || (m_ViewForm.getSelect5().equals(m_ViewForm
                                .getSelect6()))
                        || (m_ViewForm.getSelect5().equals(m_ViewForm
                                .getSelect7())))
                    count = false;

                if (!"请选择".equals(toChinese(m_ViewForm.getSelect6()))) {
                    if ((m_ViewForm.getSelect7()
                            .equals(m_ViewForm.getSelect6())))
                        count = false;
                }

                /** 如果航班没经过城市或只经过一个城市则报错 */
                if ((str.equals("||||")) || (str.equals("|||")))
                    count = false;
                /** 调用DAO对象更新记录 */
                if ("update".equals(action))
                    m_ViewDAO.update(m_View, expression);
                /** 调用DAO对象添加记录 */

                if (("insert".equals(action)) && (count == true)
                        && (userAddGrant == "Y")) {
                    m_ViewDAO.create(m_View);
                }

            }
            /** 返回一个字符串进行跳转 */
            /**
             * 权限
             * 
             * @param userTableName
             *            对表进行操作的权限
             */
            String userTableName = (String) request.getSession().getAttribute(
                    "userTableName");
            String str1 = "";
            int temp1 = 0;
            int temp2 = 0;
            for (int m = 0; m < userTableName.length(); m++) {
                str1 = userTableName.substring(m, m + 1);
                if (";".equals(str1)) {
                    if ("flight".equals(userTableName.substring(temp1, m)))
                        temp2++;
                    if ("city".equals(userTableName.substring(temp1, m)))
                        temp2++;
                    temp1 = m + 1;
                }
            }
            /** 判断是否只是做动作来进行跳转,是的话则跳转到addplane.jsp */
            if (("find".equals(action)) && (temp2 == 2)
                    && (userAddGrant == "Y")) {
                return mapping.findForward("success");
            }
            /** 当添加成功跳转则返回"adder" */
            else if ((!"find".equals(action)) && (count == true)
                    && (userAddGrant == "Y") && (temp2 == 2))
                return mapping.findForward("adder");
            /** 否则返回"adderror"跳转到出错页面 */
            else if ((userAddGrant == "N") || (temp2 != 2))
                return mapping.findForward("filter");
            else
                return mapping.findForward("adderror");

        } catch (SQLException e) {
            e.printStackTrace();
            throw new RuntimeException("Unable to get connection.");

        } finally {
            try {
                /** 关闭数据库连接 */
                if (con != null)
                    con.close();
            } catch (SQLException e) {
                throw new RuntimeException(e.getMessage());
            }
        }

    }

    /** 处理中文问题,实现编码转换 */
    public String toChinese(String ss) {

        if (ss != null) {
            try {
                String temp_p = ss;
                byte[] temp_t = temp_p.getBytes("ISO-8859-1");
                ss = new String(temp_t);
            } catch (Exception e) {
                System.err.println("toChinese exception:" + e.getMessage());
                System.err.println("The String is:" + ss);
            }
        }
        return ss;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -