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
8
votes
3 answers

What's the diference between "return new ModelAndView("redirect:surveys.html");" and "return new ModelAndView("surveys.html");"

The question is in the title. I got a Spring MVC Web App and I have to modify many things, I'm noob with this and before do anything I'm trying to understand how is made. What's the difference between: return new…
user2938355
  • 97
  • 1
  • 1
  • 3
8
votes
1 answer

Request method 'POST' not supported when throwing exception

I am throwing exception in a scenario. Which is handled by @ExceptionHandler. But when throwing exception it says Request method 'POST' not supported Controller code @RequestMapping(value = "abcd", method = {RequestMethod.POST,RequestMethod.GET…
sandy
  • 1,153
  • 7
  • 21
  • 39
6
votes
3 answers

Display list of values on JSP using Spring

I would like to display my List of values in my jsp view, but i am not able to do this. Here is my controller class below, which is only add List to the ModelAndView map and than it redirects to my index.jsp…
Stepan Mocanu
  • 69
  • 1
  • 2
  • 5
5
votes
1 answer

Spring MVC 3: open ModelAndView in a new tab

I am submitting a form in jsp. After running the underlying logic spring mvc returns view. There are 2 conditions. i.e. if(condition1){ mav = new ModelAndView("jspPageName1"); return mav; }else{ mav = new ModelAndView("jspPageName2"); …
Muhammad Imran Tariq
  • 22,654
  • 47
  • 125
  • 190
4
votes
2 answers

In my JUnit test, how do I verify a Spring RedirectView?

I'm using Spring 3.2.11.RELEASE and JUnit 4.11. In a particular Spring controller, I have a method that ends thusly ... return new ModelAndView(new RedirectView(redirectUri, true)); In my JUnit test, how do I verify return from a submission to my…
Dave
  • 15,639
  • 133
  • 442
  • 830
4
votes
1 answer

How do I addObject in Spring RedirectView

I'm kinda new to Spring and I'd like to know how to addOject in RedirectView just like in ModelAndView where I can add objects that can be used in views. mnv = new ModelAndView( FORM_URL ); mnv.addObject( "wpassbook", passbook ); …
iamjpcbau
  • 374
  • 1
  • 11
  • 29
3
votes
2 answers

get modelandview object in another controller

I am working to pass data from one controller to another. I have one class that is annotated with @ControllerAdvice that is used to handle all exception of application. I am processing exception and adding them to custom class then in ModelAndView I…
user3145373 ツ
  • 7,858
  • 6
  • 43
  • 62
3
votes
2 answers

Spring 3.2.2: MockMVC, returning Empty results

I have the following REST controller @Controller @RequestMapping("/rest/transceptors") public class TransceptorRestController { @Autowired private TransceptorDao transceptorDao; @RequestMapping(value="/get/{idTransceptor}",…
devnull
  • 49
  • 1
  • 4
2
votes
1 answer

How do I wire up ModelAndViewDefiningException to send errors to my view

In the easiest, most straightforward way, how do I wire up a/the ModelAndViewDefiningException doodad to send errors to my specified view? This guy should be called from: org.springframework.web.servlet.ModelAndViewDefiningException Much thanks to…
stackoverflow
  • 18,348
  • 50
  • 129
  • 196
2
votes
1 answer

Spring MVC, Return ModelAndView statements are ignored in Controller

I have following app setup. The dispatcher servlet is matched to the *.htm URL pattern. Controller has the annotation @RequestMapping(value = "doSuccess") The method for the above annotation just returns new ModelAndView("success");
user825282
  • 61
  • 5
2
votes
1 answer

Can I return ModelAndView with parameters?

I must return address myaccount.htm#box-two with modelMap. "#box-two" is very important for me, when I put: return new ModelAndView("redirect:myaccount.htm#box-two", modelMap); it doesn't work, I got my parameters in my…
zax
  • 91
  • 2
  • 5
  • 7
2
votes
1 answer

Passing file/stream between Spring Boot applications

I'm having an issue with Spring Boot (v. 1.5). Consider following scenario: User sends a POST request to Spring Boot app (let's call it App_A). Controller in App_A sends a new POST request to another Spring Boot app (be it App_B) that does some…
ukulele
  • 317
  • 4
  • 9
2
votes
0 answers

input map value into another map name in jsp page

I want to generate tables in jsp page using data I got from Map in java. I use which use map value for define 'item'. But, The name of map value that I want to put on 'item' needs value from another map. To be clear, here my jsp code; …
Zsy
  • 21
  • 2
2
votes
0 answers

Return ModelAndView from Spring when handling exceptions

Dealing with exceptionhandling in spring project. I had followed this approach to handle the exceptions. Everything is going good, but I want to return a ModelAndView instead of writing a text/html using PrintWriter object. Following is the approach…
Deve
  • 115
  • 1
  • 8
2
votes
1 answer

how to inject spring ModelAndView object attributes in to an Angular module?

My application uses SpringMVC with apache velocity. Now I am going to add Angularjs controllers to the *.vm files(velocity files). I am finding a problem in accessing the objects set in the ModelAndView objects returned by the Spring…
user2230867
  • 93
  • 1
  • 3
1
2 3 4 5 6 7 8