ModelAndView is an object that holds both the model and view. The handler returns the ModelAndView object and DispatcherServlet resolves the view using View Resolvers and View. Use this tag for Spring MVC Framework.
Questions tagged [modelandview]
117 questions
0
votes
2 answers
Redirect to an API that has @RequestBody arguments
The below API is called from the UI, as well as it wants to be redirected to, by other APIs.
@RequestMapping(value = "/showAbc", method = RequestMethod.POST)
public ModelAndView showAbc(@RequestBody Abc abcInstance) {
//doSomething
}
The below…

aayoustic
- 99
- 9
0
votes
1 answer
Why does ModelAndView prompt a NumberFormatException error and not load a JSP page?
I'm calculating values (based on input from one JSP) in a method in my Controller class and trying to pass it to another different JSP page using ModelAndView but I'm getting a weird NumberFormatException that I think refers to the value at line 249…

Degsy
- 53
- 8
0
votes
1 answer
Spring mvc ModelAndView occur 404 Error
Using OSX, Spring mvc 4, intellij
I want to use ModelAndView.
When I enter server/board/showArticleList, It shows 404 Error like below.
And server doesn't show any error.
Error message in browser
Type Status Report
Message…

errorMessage
- 333
- 3
- 19
0
votes
1 answer
@requestmapping and ModelAndView
Hi help me please with Spring RequestMapping. I have page like this:

Mr._Rodman
- 5
- 3
0
votes
2 answers
Spring ModelAndView not working with ajax call
Ajax calls a Spring Controller employee_edit but the ModelAndView is not working. It does not redirect to jsp page with object.I want to redirect to the page employee_registration.jsp with the object employee. Code has no error.
Ajax
$('#example1…

Brahma Dutt Sudhakaran
- 11
- 1
- 6
0
votes
0 answers
$ expression is not evaluated
I have this code in spring jsp and I see ${message} instead of result of it.
${message}
I am setting
ModelAndView mav = null;
mav.addObject("message", "Username or Password is wrong!!");
I verified that I am using servelet 3.1. I am running pivotal…

chinni
- 47
- 2
- 3
0
votes
2 answers
Spring Boot ModelAndView - cannot update value to Model
I am trying to create a form with 3 fields within the class LoginForm: usuario, senha, msgLogin.
I receive the fields usuário and senha from the input boxes and then I try to redirect to the same page with the same fields plus the field MsgLogin.…
0
votes
0 answers
Spring unmodifiable View-/Display- Object
I want to display data which i am getting from my db in a view. As far as i know, in case i set my objects in the model defined as @ModelAtttibute, the user will be able to manipulate the data. For example: if my model has the attribute "firstname",…

TheGringott
- 3
- 2
0
votes
1 answer
ModelAndView does not redirect, but give correct response
I have the following function that makes a request:
function postIngredient(action, options) {
var xhr = new XMLHttpRequest();
xhr.open(options.method, action, true);
xhr.setRequestHeader('Content-Type', 'application/json;…

Cristian
- 1,590
- 5
- 23
- 38
0
votes
1 answer
0
votes
1 answer
Spring ModelAndView Attribute is null
I have one simple controller and one interceptor.
Within interceptor in postHandle-method I am checking user.
Problem: My user-model is sometimes null, between controller-handles.
postHandle invoked by home-handle==> User-Model is not…

Roma Kap
- 517
- 1
- 8
- 23
0
votes
1 answer
Spring-boot thymeleaf fragments: Exception evaluating SpringEL expression
I'm facing a problem trying to get access in a ModelAndView from a thymeleaf fragment that shows a modal window.
This is my index.html:
…

Tulio Martins
- 27
- 5
0
votes
2 answers
One object, multiple views
I have multiple views that need one and the same object. Does spring support something for it?
Example:
private LanguageDao dao;
At this point, in every method i need to pass the variable to my view. Every single time...
@GetMapping("/cart")
public…

yooouuri
- 2,578
- 10
- 32
- 54
0
votes
1 answer
ModelAndView not working properly
I have written the code in java. All the things are working properly. I just want to return the value of modelandview that is not returning correct web page. It is throwing blank page. The code of my controller is:
public class Part3 extends…

Uday Verma
- 99
- 9
0
votes
0 answers
Can you set a view name for all injected ModelAndView?
I am writing a spring application and for every page I return the same view and populate it with content fragments. Does anyone know if and how to set this view name so that I do not have to set it with every…

David Carek
- 1,103
- 1
- 12
- 26