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
1
vote
1 answer
Spring MVC Test: java.lang.AssertionError: No ModelAndView found
I'm novice to all this stuff, writing test for Spring MVC controller and got error above, tried solution provided in
Spring 3.2.5 error "java.lang.AssertionError: No ModelAndView found" for all my controller Unit Test - still no luck! Could pls…

DmitryD
- 31
- 1
- 1
- 6
1
vote
1 answer
How to save specific properties of a JPA entity model attribute from JSP page
We are using JPA entity beans as our model for Spring MVC controller on a jsp page. One of our jsp pages is a partial view of this entity which does not show all properties. Whenever we try to update our entity using the service layer from the…

dukethrash
- 1,449
- 4
- 15
- 25
1
vote
0 answers
Passing multiple model in ModelAndView and Iterating those models
I have a requirement where I have to write HSSfWorkbook with multiple HSSfSheets.
For first sheet I have different columns and second sheet has different set of columns. For each sheet I have different stored procedure written.
Currently my java…

MSV
- 155
- 2
- 16
1
vote
0 answers
How can I get a ModelAndView in geoserver's OWS?
I'm Implementing a geoserver's OWS. I want to a specific method of the OWS get a ModelAndView as following:
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import…

Morteza Malvandi
- 1,656
- 7
- 30
- 73
1
vote
1 answer
Passing java variables to jsp with Spring @Controller ModelAndView
The controller class looks like this,
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import…

gTang
- 35
- 2
- 6
1
vote
1 answer
Spring MVC returns a blank page
In my project, I have a requirement to handle user POST request and fill the results into an iframe (called result_frame).
When POST request data is valid, I return a view to fill the result_frame as ModelAndView(myviewName)
When POST request data…

Nghia Le
- 535
- 2
- 6
- 16
1
vote
1 answer
Spring MVC : Unable to get json value in jsp, it's giving 0
Need your help. I am not able to get json string in jsp after adding in modelAndView. After debugging, I found it's get added in modelAndView instace.
Below is the code snippet:
Controller:…

ved
- 909
- 2
- 17
- 43
1
vote
1 answer
Is it alright to create an object of modelandview in each method of the class?
I have following controller which is serving different requests. I am wondering if the way that I create ModelAndView is correct? I am creating one object in each method. Is there any better approach?
@RequestMapping(method =…

Jack
- 6,430
- 27
- 80
- 151
1
vote
2 answers
Status 404 when trying to redirect a page using "redirect:" prefix when returning a ModelAndView
I'm trying to redirect my request after a success login, 2 pages are involved, commonly login and loginsuccess
here is the Controller class for Login mapping
@Controller
@SessionAttributes("userObj")
@RequestMapping("/user")
public class…

Jeff
- 519
- 1
- 10
- 18
1
vote
3 answers
how to display a message when modelAndView object is empty
I am trying to display a message when my declared modelAndView object is empty that are loaded using addObject() and returned via a controller
my code somthing like...
ModelAndView modelAndView = new…

Rana Aziz
- 11
- 1
- 3
1
vote
0 answers
return new ModelAndView redirect does not work for some reason
I'm really new to Spring MVC framework and I'm in desperate need of help right now.
For some reason, my redirect does not work its giving me HTTP Status 400, with no error on console that is why it is very hard to debug.
Scenario:
I have 2 forms.…

iamjpcbau
- 374
- 1
- 11
- 29
1
vote
0 answers
Spring Framework | Force the browser to download a file without redirecting to a new page
There's this application I'm working on that using Spring 3.x libraries. Now, We have a download page that contains 'n' number of links where 'n' is usually greater than 10.
What I've done is that I've created a URL pattern such…

va1b4av
- 431
- 9
- 26
1
vote
2 answers
1
vote
2 answers
How to access a modelAttribute with variable name from jQuery
I'm using Spring MVC and jQuery for processing in the JSP the objects sent by the controller.
My controller is sending to the JSP multiple objects using:
modelAndView.addObject("roleForm" + rol.getRolecode(), form);
Where form is an object of the…

Goyo
- 455
- 1
- 9
- 23
1
vote
1 answer
Return "View" inside "Json" with Spring MVC
I'm using Spring MVC, and I need return in the Controller, a Json object that contains the view, by example, the related jsp page.
return: { name: "fragment-form", other-info:"other-info", view: view}
where "view" should be the JSP page linked to…

Cristian Rinaldi
- 329
- 4
- 15