Class ElementComponentController

  • All Implemented Interfaces:
    DelegatedController, ComponentAware, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.mvc.Controller

    public class ElementComponentController
    extends ComponentController
    This class is the delegation controller for elements. Note that this controller is not running in the Spring application context. It is only used for controller delegation from a MainSpringController which runs inside the Spring application context. Custom controllers for element components should extend this class.
    WebManager 9.0.8
    • Constructor Detail

      • ElementComponentController

        public ElementComponentController()
    • Method Detail

      • formBackingObject

        public Object formBackingObject​(javax.servlet.http.HttpServletRequest request)
                                 throws javax.servlet.ServletException
        Retrieve a form backing object for the current form from the given request. This method returns the element the controller was created from by default, override to return a custom form backing object.
        Specified by:
        formBackingObject in interface DelegatedController
        formBackingObject in class ComponentController
        request - current HTTP request
        the FormBackingObject
        Exception - in case of invalid state or arguments
        javax.servlet.ServletException - in case of errors
      • initFormBackingObject

        protected void initFormBackingObject​(Element element,
                                             Element fbo)
        Initialize element form backing object with default values This method is deprecated: use the BeanUtils class contained by the spring framework instead: BeanUtils.copyProperties(element, formBackingObject);
        element - Element entity to retrieve properties from
        fbo - Element form backing object to set properties on
      • onSubmit

        public void onSubmit​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             Object command,
                             org.springframework.validation.BindException errors,
                             org.springframework.web.servlet.ModelAndView modelAndView)
                      throws Exception
        Override this method to implement specific logic which must be executed upon submitting the page. Note that returning a ModelAndView in this method does not have any effect since the MainSpringController will be in charge of returning the ModelAndView, which is a RedirectView in case of a page submit.
        Specified by:
        onSubmit in interface DelegatedController
        onSubmit in class BaseWebmanagerController
        request - current servlet request
        response - current servlet response
        command - form backing object to which request parameters are bound
        errors - Errors instance without errors (subclass can add errors if it wants to)
        modelAndView - the model and view prepared by the main spring controller
        Exception - in case of errors
      • createEditViews

        protected void createEditViews()
        Description copied from class: BaseWebmanagerController
        Callback to add edit views. Sub classes should implement this method, call the super and invoke addEditViews to add its own edit views to the controller.
        Specified by:
        createEditViews in class BaseWebmanagerController
      • getElement

        public final Element getElement()
        USed for backwards compatibility with legacy templates
      • setElement

        public final void setElement​(Element element)
        Invoked by ElementBase on construction
        element - Element managed this controller. This is not the form backing object, unless form backing object and business object are one and the same object