http-request-parameters

Spring MVC - Why not able to use @RequestBody and @RequestParam together

六眼飞鱼酱① 提交于 2019-11-26 08:49:27
问题 Using HTTP dev client with Post request and Content-Type application/x-www-form-urlencoded 1) Only @RequestBody Request - localhost:8080/SpringMVC/welcome In Body - name=abc Code- @RequestMapping(method = RequestMethod.POST) public String printWelcome(@RequestBody String body, Model model) { model.addAttribute(\"message\", body); return \"hello\"; } // Gives body as \'name=abc\' as expected 2) Only @RequestParam Request - localhost:8080/SpringMVC/welcome In Body - name=abc Code-

What is difference between @RequestBody and @RequestParam?

风格不统一 提交于 2019-11-26 05:17:29
问题 I have gone through the Spring documentation to know about @RequestBody , and they have given the following explanation: The @RequestBody method parameter annotation indicates that a method parameter should be bound to the value of the HTTP request body. For example: @RequestMapping(value = \"/something\", method = RequestMethod.PUT) public void handle(@RequestBody String body, Writer writer) throws IOException { writer.write(body); } You convert the request body to the method argument by

Retaining GET request query string parameters on JSF form submit

随声附和 提交于 2019-11-26 00:25:49
问题 I have 3 pages: main.xhtml agreement.xhtml generated.xhtml The agreement.xhtml needs two parameters to load correctly: serviceId and site . So, a normal url looks like this: /app/agreement.xhtml?site=US&serviceId=AABBCC . I have this button on agreement.xhtml <h:form> <h:commandButton value=\"Generate License File\" action=\"#{agreement.generateMethod}\" /> </h:form> The @RequestScoped bean #{agreement} has this method: public String generateMethod(){ ....... return \"generated\"; } I need

How do I process GET query string URL parameters in backing bean on page load?

寵の児 提交于 2019-11-25 23:41:07
问题 I\'ve read how to send parameters using JSF but what if the user types their companyId in the URL when accessing their login page? For example, http://my.company.url/productName/login.faces?companyId=acme. The way we do it now, there is a bit of scriptlet code that grabs the value from the request and then set it in the session. That parameter changes their look and feel starting from the login page forward so each customer could have a different login page view. We are using extjs until I