How To


Add the annotation @EnableWebMvc to your configurer

Create a RestController and make sure that Spring finds it (@ComponentScan)

public class AjaxController {
  @RequestMapping(value = "my/path/to/ajax")
  public Object handleAjax(@RequestParam String value) {
    ModelAndView model = new ModelAndView();
    model.addObject("suppliedValue", value);
    return model;

Get the url to the AjaxController in JSP via the taglib

<api:controller var="ajaxUrl" resource="/my/path/to/ajax" />

Start sending requests to ${ajaxUrl} (i.e. with JQuery) and work with it.

Enable / Disable parts in your JSP

In your configurer

public void configureConfigurationTemplate(final ConfigurationTemplateConfigurer configurer) {
    .withDescription(Locale.ENGLISH, "Enable debug output");

In your JSP

<api:config key="plugin.debug" var="debugging" />
<c:if test="${debugging}">
  Debugging mode is enabled.


Let Spring inject the ApiShopContextFactory.

Mcs mcs = apiShopContextFactory.getDefaultShopContext().getMcs();
Locale locale = new Locale(mcs.getLanguage(), mcs.getCountry());

Path to plugin

In JSP simply use the controllerTag or resourceTag whenever possible.

In Java you can use servletContext.getContextPath() where the ServletContext needs to get injected first.


Just add the following code to your configurer. Create a class (i.e. SessionData) with your session data that ideally implements Serializable.

public AtomicReference<SessionData> getSessionData() {
  return new AtomicReference<SessionData>(new SessionData());
private Provider<AtomicReference<String>> stringForSession;