类 ModelAndView

    • 构造器详细资料

      • ModelAndView

        public ModelAndView​(String viewName)
        Convenient constructor when there is no model data to expose. Can also be used in conjunction with addObject.
        参数:
        viewName - name of the View to render, to be resolved by the DispatcherServlet's ViewResolver
        另请参阅:
        addObject(java.lang.String, java.lang.Object)
      • ModelAndView

        public ModelAndView​(String viewName,
                            @Nullable
                            Map<String,​?> model)
        Create a new ModelAndView given a view name and a model.
        参数:
        viewName - name of the View to render, to be resolved by the DispatcherServlet's ViewResolver
        model - a Map of model names (Strings) to model objects (Objects). Model entries may not be null, but the model Map may be null if there is no model data.
      • ModelAndView

        public ModelAndView​(View view,
                            @Nullable
                            Map<String,​?> model)
        Create a new ModelAndView given a View object and a model. Note: the supplied model data is copied into the internal storage of this class. You should not consider to modify the supplied Map after supplying it to this class
        参数:
        view - the View object to render
        model - a Map of model names (Strings) to model objects (Objects). Model entries may not be null, but the model Map may be null if there is no model data.
      • ModelAndView

        public ModelAndView​(String viewName,
                            HttpStatus status)
        Create a new ModelAndView given a view name and HTTP status.
        参数:
        viewName - name of the View to render, to be resolved by the DispatcherServlet's ViewResolver
        status - an HTTP status code to use for the response (to be set just prior to View rendering)
        从以下版本开始:
        4.3.8
      • ModelAndView

        public ModelAndView​(@Nullable
                            String viewName,
                            @Nullable
                            Map<String,​?> model,
                            @Nullable
                            HttpStatus status)
        Create a new ModelAndView given a view name, model, and HTTP status.
        参数:
        viewName - name of the View to render, to be resolved by the DispatcherServlet's ViewResolver
        model - a Map of model names (Strings) to model objects (Objects). Model entries may not be null, but the model Map may be null if there is no model data.
        status - an HTTP status code to use for the response (to be set just prior to View rendering)
        从以下版本开始:
        4.3
      • ModelAndView

        public ModelAndView​(String viewName,
                            String modelName,
                            Object modelObject)
        Convenient constructor to take a single model object.
        参数:
        viewName - name of the View to render, to be resolved by the DispatcherServlet's ViewResolver
        modelName - name of the single entry in the model
        modelObject - the single model object
      • ModelAndView

        public ModelAndView​(View view,
                            String modelName,
                            Object modelObject)
        Convenient constructor to take a single model object.
        参数:
        view - the View object to render
        modelName - name of the single entry in the model
        modelObject - the single model object