private void inserTransaction(HttpServletRequest request,
HttpServletResponse response)
{
response.setContentType("text/html");
PrintWriter pw =response.getWriter();
pw.println("<h3>Successfully Transaction has been Done</h3>");
pw.close();
rd.forward(request,response);
}
private void LoginSuccess(HttpServletRequest request,
HttpServletResponse response)
{
HttpSession session=request.getSession();
session.setAttribute("customerName",v_count);
session.setAttribute("customerId",V_username);
session.setAttribute("count",count);
try{
if(!v_count.isEmpty())
{
RequestDispatcher rd = request.getRequestDispatcher("jsp/Welcome.jsp");
try
{
rd.forward(request, response);
}
catch (Exception e)
{
System.out.println(e);
}
}
我想将响应对象从inserTransaction方法传递给同一个servlet类中的LoginSuccess方法。同时LoginSuccess方法将重定向到welcome.jsp页面,其中来自LoginSuccess的响应对象应包括来自两个方法的响应。