Questions tagged [request-mapping]

Issues regarding usage of Spring MVC @RequestMapping methods

348 questions
0
votes
1 answer

Difference between two @RequestMapping annotations

I am pretty new in Spring MVC and I have the following doubt. In a controller, I have a method annotated in this way: @Controller @RequestMapping(value = "/users") public class UserController { @RequestMapping(params = "register") public…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
0
votes
0 answers

Spring singleton issue when using request scope within JUnit

When I run my JUnit tests Spring mistakenly uses the same instance of my JobRunner class each time I try calling the JobConfigurationREST.startJob method. However, when I call in via a REST web service call, Spring gives me a different instance of…
James Hutchinson
  • 841
  • 2
  • 13
  • 27
0
votes
2 answers

request mapping issue - spring mvc

I am facing an issue with the request mapping in spring-mvc as: There are two url by which I am able to see the response of uploadPage.jsp http://localhost:8080/dms/files/?module=abc http://localhost:8080/dms/files?module=abc The form in…
Mohammad Faisal
  • 5,783
  • 15
  • 70
  • 117
0
votes
2 answers

diffrence between @RequestParam and @RequestMapping

Line1: public ModelAndView viewCustomerDetails(@RequestParam("custId") Integer customerId, @RequestParam("categoryName") String categoryName, HttpServletRequest request) throws BusinessException{ Line2: public ModelAndView…
Piyush Mittal
  • 1,860
  • 1
  • 21
  • 39
0
votes
1 answer

Spring Rest Service Post request error

It may be a basic question related to Spring Rest service Post request Below is my Controller mapping code: @RequestMapping(value = "test", method = RequestMethod.POST) @ResponseBody public String addFruits(@RequestBody RequestWrapper…
abson
  • 9,148
  • 17
  • 50
  • 69
0
votes
0 answers

@RequestBody fails only at second time

I use @RequestBody notation to get a JSON from front-end and to add task to database. Looks like this @RequestMapping(method = RequestMethod.POST) public @ResponseBody ResponseEntity addTask(@RequestBody Task task) { try { …
0
votes
1 answer

How to view Spring MVC request mapping exception

When I deployed a Spring MVC application into Tomcat and startup the Tomcat instance, the log prints out various exception similar to the one below: INFO RequestMappingHandlerMapping:197 - Mapped…
Tony Vu
  • 4,251
  • 3
  • 31
  • 38
0
votes
1 answer

Spring Request Mapping complication

I have the following request mappings in my controllers, but when i hit /united-states/georgia it always goes to the method mapped with {country/city} even though . How to force it to go to the united-states method. Any suggestion would be…
minion
  • 4,313
  • 2
  • 20
  • 35
0
votes
1 answer

@RequestMapping Annotation

HomeController.java I have web page which loads the pages dynamically. My first Mapping method loads the appropriate pages as per the product choosed. I hav a menu in each product page and I need the second mapping method to execute. But it always…
user4149562
0
votes
1 answer

Why does my jsp page send null when I want to bind the user input using @ModelAttribute annotation in my controller?

I am trying to bind the user input using @ModelAttribute annotation when the user wants to add a new book in the database (book table). Book class has four properties(int bookId, String title, Author author, Publisher publisher). User just enters…
Nisman
  • 1,271
  • 2
  • 26
  • 56
0
votes
1 answer

Spring MVC+REST: issue mapping requests

I am trying to expose a REST API via Spring MVC+REST with some Spring Security configuration. However, I am getting 404. Here's the code. web.xml REST…
Manu
  • 4,019
  • 8
  • 50
  • 94
0
votes
1 answer

Spring MVC Using @RequestMapping on controller class with variable

I would like to write whole controller to work with entity. I would like to declare the id of entity on class level and use it on each method. Here is the controller class: @Controller @RequestMapping(value="/job/{j_id}/instance") public class…
masterdany88
  • 5,041
  • 11
  • 58
  • 132
0
votes
0 answers

Spring request mapping issue

I have a request mapping like below @RequestMapping(value = "/getPic/{moduleName}/**", method = RequestMethod.GET, produces = APPLICATION_JPEG) But above mapping fail when i hit below url /getPic/z012/{80BE26C1-7142-408C-903F-5721EBF5Eá28A}.jpg…
IMParasharG
  • 1,869
  • 1
  • 15
  • 26
0
votes
1 answer

Single @RequestMapping for multiple controllers

I'm trying to create a single @RequestMapping value for 2 or 3 controllers unfortunately I'm getting error Eg: @Controller public class contatcs { @RequestMapping(value="Save", params="m=contacts") public ModelAndView…
0
votes
1 answer

Spring MVC RequestMapping PathVariable in the first place

I would like to set for each user's own profile link. Like this: @RequestMapping(value = "/{userlogin}", method = RequestMethod.GET) public String page(@PathVariable("userlogin") String userlogin, ModelMap model) { …
Oleksandr
  • 3,574
  • 8
  • 41
  • 78