Code: Select all
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView model = new ModelAndView();
System.out.println("Casting to MyProductImpl");
MyProductImpl product = (MyProductImpl) request.getAttribute(ProductHandlerMapping.CURRENT_PRODUCT_ATTRIBUTE_NAME);
assert(product != null);
model.addObject(MODEL_ATTRIBUTE_NAME, product);
addDeepLink(model, deepLinkService, product);
if (StringUtils.isNotEmpty(product.getDisplayTemplate())) {
model.setViewName(product.getDisplayTemplate());
} else {
model.setViewName(getDefaultProductView());
}
return model;
}
I am getting the following error while accessing the product page..
org.broadleafcommerce.core.catalog.domain.ProductImpl cannot be cast to com.mycompany.core.catalog.domain.MyProductImpl
My Question is where is this attribute set and how could I set this? If I could set the MyProductImpl to the request attribute, then it will be ok? But how could I do this?
Thanks in advance. Hope you will reply as soon as possible.