Monday, 9 September 2013

Servlet URL redirecting

Servlet URL redirecting

In my JAVA Dynamic Web Application i am passing a value from a Payment.jsp
to a servlet by action="post". In servlet doPost() method:
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws
ServletException, IOException {
String cost=request.getParameter("COST_ID");
HttpSession session=request.getSession();
synchronized (session) {
session.setAttribute("payamount", cost);
}
request.setAttribute("cost", cost);
request.getRequestDispatcher("makepayment.jsp").forward(request,
response);
}
in makepayment.jsp i get the value by using ${cost}
my problem is when i go the the address bar and press enter the ${cost}
prints nothing.
In know thats because it calls doGet() method but how can i solve ths
problem?

No comments:

Post a Comment