FileDocCategorySizeDatePackage
ViewCartController.javaAPI DocExample1414Thu Dec 04 08:19:26 GMT 2003org.springframework.samples.jpetstore.web.spring

ViewCartController

public class ViewCartController extends Object implements org.springframework.web.servlet.mvc.Controller
author
Juergen Hoeller
since
30.11.2003

Fields Summary
private String
successView
Constructors Summary
Methods Summary
public org.springframework.web.servlet.ModelAndViewhandleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

		Cart cart = (Cart) WebUtils.getOrCreateSessionAttribute(request, "sessionCart", Cart.class);
		UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession");
		String page = request.getParameter("page");
		if (userSession != null) {
			if ("next".equals(page)) {
				userSession.getMyList().nextPage();
			}
			else if ("previous".equals(page)) {
				userSession.getMyList().previousPage();
			}
		}
		if ("nextCart".equals(page)) {
			cart.getCartItemList().nextPage();
		}
		else if ("previousCart".equals(page)) {
			cart.getCartItemList().previousPage();
		}
		return new ModelAndView(this.successView, "cart", cart);
	
public voidsetSuccessView(java.lang.String successView)

		this.successView = successView;