Vinod Ghattamaneni
Vinod Ghattamaneni

Reputation: 1

Model attributes in the custom component controller of accelerator - How this is handled in the context of OCC and Spartacus?

Got confused after going through the documentation of Spartacus. I have a question related to the Custom component controller of traditional accelerators.

Current accelerator implementation: We have a bunch of custom component controllers in which some attributes are added to the model. These attributes are used in the component-specific JSPs.

@Controller("CustomProductListingComponentController")
@Scope("tenant")
@RequestMapping(value = "/view/CustomProductListingComponent.jsp")
public class CustomProductListingComponentController extends 
AbstractCMSComponentController<CustomProductListingComponentModel>
{
  @Resource
  private ProductSearchFacade productSearchFacade;
  @Resource
  private SearchRequestFactory searchRequestFactory;

  @Override
  protected void fillModel(final HttpServletRequest request, final 
  Model model, final CustomProductListingComponentModel component)
  {
      SearchParams searchParams = (SearchParams) 
                             request.getAttribute("searchParams");
      SearchRequestDTO searchRequestDTO = 
                            searchRequestFactory
                  .createSearchRequestDTOWithFacets(searchParams);
    HoffmannSearchPageData<SearchStateData, ProductData, 
    CategoryData> productSearchResult = 
                     productSearchFacade.search(searchRequestDTO);
    model.addAttribute("searchPageData", productSearchResult);
  }
 }

Now the question is how this kind of model attributes are implemented in the context of OCC and Spartacus?

Upvotes: 0

Views: 27

Answers (0)

Related Questions