0
if (request.getParameter("print_type") != null) {
    String print_type = request.getParameter("print_type").toString();

    if (print_type.contains("1"))//Preprinted page
    {
        session.removeAttribute("default_selected_opd_ticket");
        session.setAttribute("default_selected_opd_ticket", "1");

        if (session.getAttribute("opdTicket_preprinted") != null) {
            printpg = session.getAttribute("opdTicket_preprinted").toString();
        } else if (print_type.contains("3"))//Preprinted page
        {
            session.removeAttribute("default_selected_opd_ticket");
            session.setAttribute("default_selected_opd_ticket", "3");
            printpg = "../opdreport/antenatal_report.jsp";

        }

    } else {  //for blank page
        session.removeAttribute("default_selected_opd_ticket");
        session.setAttribute("default_selected_opd_ticket", "2");

        if (session.getAttribute("opdTicket_blank") != null) {
            printpg = session.getAttribute("opdTicket_blank").toString();
        } else {
            printpg = "../opdreport/opdTicket_blank.jsp";
        }
    }

    //  printpg = "../opdreport/opdTicket_blank.jsp";//this is a jsp
    request.getSession().setAttribute("backpage", backpg);
    request.getSession().setAttribute("printpage", printpg);
    request.getSession().setAttribute("regNo", registration.getRegistrationno());
    request.getSession().setAttribute("pID", registration.getPatientid());

    registration = null;
    if (request.getParameter("SelectedOption") != null) {
        String strSelectedOption = request.getParameter("SelectedOption").toString();

        if (strSelectedOption.equals("withoutNk")) {
            response.sendRedirect("../opdreport/printframe.jsp");
            return;
        } else if (strSelectedOption.equals("withNK")) {
            response.sendRedirect("../opdregistration/Nk1Details.jsp");
            return;
        }

    }
}

上記はコードの一部です。ここで、前述の jsp ページにリダイレクトできません。

ページにリダイレクトせずにすべてのデータが保存され、不正な状態の例外エラーが発生します。ここでは、値がそれぞれ 1、2、3 の 3 つのラジオ ボタンを使用しています。

ユーザーは、要件に従ってラジオボタンを選択し、それに従って、それぞれのページにリダイレクトします。

4

1 に答える 1