Questions tagged [modelandview]

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.

117 questions
0
votes
0 answers

Redirect a respone to a html page in Spring Boot

I am new to Spring boot and I am trying to redirect a I have a controller class `@RestController public class Redirect{ @GetMapping("redirect") public void redirectPage(HttpServletRequest req, HttpServletResponse res,@RequestHeader("x-query")…
0
votes
2 answers

How to send parameters to JSP and get them back updated in Spring MVC

I'm new to Spring MVC and JSP developing, so please be gentle telling me I'm doing something stupid :P Told that, the question: I studied a bit Spring MVC and got a nice piece of working code. Now I'm stuck on an apparently stupid problem: it seems…
Andrea
  • 336
  • 2
  • 9
  • 32
0
votes
2 answers

Why doesn't ModelAndView add a property?

i have such a RestController @Controller public class ExchangeRateController { private final static Logger LOGGER = LoggerFactory.getLogger(ExchangeRateController.class); @GetMapping(value = "/current") public ModelAndView…
Alpharius
  • 489
  • 5
  • 12
0
votes
0 answers

How to use a variable via Java method parameter?

Below is some simple code. @RequestMapping(value="/main") public ModelAndView main(ModelAndView model) { model.addObject("project",mainService.selectProject()); return null; } I thought until now that the role of parameter should…
바보린
  • 159
  • 1
  • 13
0
votes
1 answer

Does ModelAndView serialize model before sending response to client

In spring mvc, when we return ModelAndView / Model object, does this get serialized to be sent on HTTP? Just like it happens in REST API that the @ResponseBody annotated method returned value is serialized. If not, how is Model object transferred…
0
votes
1 answer

Controller doesn't recognizes Template using ModelAndView

I'm having some problems that i don't know how to solve. I need to add an "new house" system to my real estate advertisement site. So i added a button in the advertise management page linking to a dashboard page, when i click the button, it goes to…
0
votes
0 answers

convert ModelAndView object to []byte array

I have an API that returns a ModelAndView object having 2 params in the constructor, an ExcelGenerator that I implemented and a map (see below code). Everything is fine , when I access the endpoint in the browser , the excel file is automatically…
Marius Pop
  • 158
  • 1
  • 4
  • 20
0
votes
2 answers

spring to spring boot 2.4.5 migration: Not able to send ModelAndView as a result from spring controller in Ajax call from UI

we have recently started migrating our web application from spring to spring boot 2.4.5. In spring we were able to send ModelAndView as a result from spring controller in Ajax call from UI, but after migrating to spring boot 2.4.5 we are not able to…
Surendra
  • 21
  • 4
0
votes
1 answer

Why the first property can be parse but no the second property of the same object

Currently in a web app project where I upload 1 value and 1 multifile as a form in jsp. I have already tried my first chartType can be use as a property but not the other two. Running with : java spring, mnv, jsp JSP
Chew Yiwei
  • 38
  • 5
0
votes
1 answer

how to use c:forEach with arrayList?

selectProcess.jsp

out.print("list:"+${departmentList });

${department.getCode() } ${department.getDep_name() }

output << how to print departmentList's…
Hime
  • 1
  • 1
0
votes
1 answer

How do I manipulate the http response using ModelAndView in java?

I want that when adding a data in the database, the status to be returned is 201 instead of 200. I tried to use the following code but it didn't work: @PostMapping("/salvar") public ModelAndView salvar(Artigo artigo) { ModelAndView mv = new…
0
votes
0 answers

How to bind Java object to HTML form using Spring MVC and Pebble template engine

I am having trouble getting Pebble template engine to display Java object values in HTML form in a HTTP GET request. In Pebble template I have a form like this.
0
votes
1 answer

Can't display two dropdown box in Spring Mvc and question about ModelAndView

i'm working on a JSP that should have two dropdown box, where the second dropdown box is depending from the first one. Running the app, the first drowpdown box is populated with some elements. A client side jquery ajax method is called when the…
AmiStack
  • 23
  • 7
0
votes
0 answers

How to add body using RedirectView / ModelAndView in Spring MVC

I'm trying to redirect post request to another post request with parameters inside body instead of query params. @RequestMapping(value = "/redirect/{redirect_uri}", method = RequestMethod.POST, produces = {MediaType.APPLICATION_JSON_VALUE}) public…
AliY
  • 1
  • 1
0
votes
2 answers

How to access Model Attribute's value and set to ModelAndView

I cant seem to find the solution for this. I have method that returns ModelAndView to view web pages. I store a webpage filename to model whenever a condition is true. Example: @RequestMapping(value = "/process", method = RequestMethod.POST) …
Aya Sato
  • 29
  • 1
  • 9