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 的单选按钮。
用户将根据要求选择单选按钮,并根据该单选按钮重定向到相应的页面。