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
1 answer
How can I solve NullPointerException using ModelAndView object?
I found what made problem for 'nullPointerException'(Request processing failed; nested exception is 'java.lang.NullPointerException') as I used object 'ModelAndView' in the controller below.
Three kinds of variables can't get null below.
I know…
0
votes
1 answer
spring mvc: don't redirect after login - need two models?
I coded a wee login controller. It has an onSubmit method which logs in the user. If the login is successful I want to show the front page without having to redirect. The front page needs content from some other model. Because my LoginController…

Franz Kafka
- 10,623
- 20
- 93
- 149
0
votes
2 answers
How to get ModelAndView object coming from Spring into Vue data?
I have one controller class:
@RestController
public class ItemController {
@Autowired
private ItemService itemService;
@GetMapping("/auction_items")
public ModelAndView getAllItems() {
ModelAndView mv = new…

Pradeep Kumar
- 31
- 1
- 3
0
votes
1 answer
Why ModelMap, Model, @ModelAttribute, ModelAndView required when a simple return of jsp page name in string can do the work
I have the following spring mvc code snippet that works fine:
Controller snippet:
@RequestMapping(value="/submitForm", method=RequestMethod.POST)
public String formSubmission(Employee employee)
{
return "EmployeeWelcome";
}
On form data…

Shweta Priyadarshani
- 236
- 4
- 16
0
votes
1 answer
How to write a s3object downloaded from s3 to a file
I am trying to download s3object from s3 bucket then write that object to a html file. S3 object is downloading but when I try to create a file and try to write to that file I am facing NullPointerException, I am not sure what's wrong with my code.…

Pragati Kerur
- 145
- 1
- 13
0
votes
1 answer
modelandview var parameter using ajax.updater
In a page JSP y get by JSTL a var ModelAndView in "${model}
In this page I use JAVASCRIPT to update a DIV with ajax.updater, the code here:
document.getElementById("idFa").value=image.title;
var frm2="${model}";
var dataString =…

ACEVALLO
- 11
- 3
0
votes
2 answers
I can't get any HTML page via my RestController methods
everyone! Excuse me, I'm a beginner in Spring technologies. I'm using SpringMVC and I can't get any HTML page via my RestController methods, but objects in JSONs or String objects I get successfully. Any help, why I permanently get this message in…

Oleg Sandro
- 49
- 9
0
votes
1 answer
ModelAndView not changing view
@RequestMapping(value = { "postCustomer" }, consumes = "application/json", method = {RequestMethod.POST})
public ModelAndView postHome(@RequestBody JSONObject body, Model model) throws JSONException {
ModelAndView mav = new…
0
votes
1 answer
Pass data between different html pages and controllers in spring
Hi I'm new with Spring and I'm having problems in passing data between two pages using two different controllers.
I would like to know how I can handle this situations.
In my index.html I have a button that should redirect me to a new page passing…

andrea
- 47
- 1
- 12
0
votes
0 answers
@ModelAndView is working as expected from the ui, but does not when a json request is sent by postman
I have managed to make a modelAndView in my controller doing what Im expecting from the ui, but sometimes I need to test it via post man so when I tried the model attribute is always null, can someone explain what is happening exactly?
here is the…

Khaled
- 529
- 8
- 19
0
votes
1 answer
SecurityContextHolder.getContext().getAuthentication() returns null when called from @ControllerAdvice class
In my current spring project, I have this class which should provide some modelAttributes to several views, from different controllers:
@ControllerAdvice
public class Model {
@Autowired
private CategoriaService categoria;
@Autowired
private…

Kleber Mota
- 8,521
- 31
- 94
- 188
0
votes
2 answers
Redirected url not showing in browser
I am calling a view of one controller from another controller(say controller1 and controller2 respectively). And it is successfully working, but the browser shows the url of the controller1 even though I redirected to controller2. How to change…

Coding world
- 167
- 8
- 23
0
votes
1 answer
ModelAndView returning method object
I have this code:
@Controller
public class createUserController {
@RequestMapping(value = "/user/registerUser", method = RequestMethod.GET, produces = "application/json")
public ModelAndView createFleet(HttpServletRequest request,…

wonza
- 302
- 1
- 4
- 15
0
votes
1 answer
Can we Send Data To Multiple JSP pages in Spring?
I have a method in my controller say demo
@RequestMapping(value="/demo")
public ModelAndView demo("some parameters..")
{
.
.
.
.
return new ModelAndView("newPage","Message","Welcome to new Page");
{
This will send the data to the "newPage".…

Himanshu Arya
- 75
- 1
- 9
0
votes
1 answer
How to upload the modelandview to Azure blob storage in spring boot
I am new to Azure and I want to upload modelandview excel file to azure blob storage. Please help me how to upload modelandview file.

AMani
- 11
- 1
- 3