tag:blogger.com,1999:blog-3237724005744642470.post2839897359873141804..comments2020-07-30T12:43:10.297+01:00Comments on Captain Debug's Blog: Accessing Request Parameters using Spring 3 MVCRoger Hugheshttp://www.blogger.com/profile/07042290171112551665[email protected]Blogger9125tag:blogger.com,1999:blog-3237724005744642470.post-41745092839839113212013-10-12T08:53:14.879+01:002013-10-12T08:53:14.879+01:00Thanks a lot for posting this....
You can visit m...Thanks a lot for posting this....<br /><br />You can visit my blog <br /><br />http://javakafunda.blogspot.com<br /><br />for some interesting posts :)Yogihttps://www.blogger.com/profile/15382350910254695035[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-932691412964000442013-08-29T17:51:40.669+01:002013-08-29T17:51:40.669+01:00Thank you for making it so clear. Helped me a lot....Thank you for making it so clear. Helped me a lot.Anonymoushttps://www.blogger.com/profile/10721968237638658607[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-6544044464852850352012-09-30T09:57:51.859+01:002012-09-30T09:57:51.859+01:00salient1
A good point. So good that I've writt...salient1<br />A good point. So good that I've written a quick blog outlining this technique. See <a href="/2012/09/a-footnote-on-accessing-request.html" rel="nofollow">A Footnote on Accessing Request Parameters using Spring 3 MVC</a>Roger Hugheshttps://www.blogger.com/profile/07042290171112551665[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-69767017731611552502012-09-21T21:15:38.854+01:002012-09-21T21:15:38.854+01:00Most of your examples don't actually require y...Most of your examples don't actually require you to use the @RequestParam annotation. You could have just created a String parameter called uuid and Spring would still automap it for you. You only need the annotation if you want your variable be different than the name of the value passed in or you want to change the default value, etc. Otherwise, it's a waste of space.salient1https://www.blogger.com/profile/00667451308500303792[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-90506169396805714292012-07-24T20:57:19.283+01:002012-07-24T20:57:19.283+01:00Aprajitha
A good question...
@RequestMapping is...Aprajitha<br /><br />A good question... <br /><br />@RequestMapping is only used to map request URLs to your controller. The 'params' value is used to narrow the mapping down allowing you to map different param values (uuids in this case) to different methods. For example:<br /><br />/** This is only called when uuid=6 e.g.: /help/detail?uuid=6 */ <br />@RequestMapping(value = "/help/detail", params={"uuid=6"} method = RequestMethod.GET)<br />public String displaySomeHelpDetail(Model model) {<br /> <br /> // Do Something<br /> return "view.name" <br />}<br /><br />/** This is only called when uuid=1234 e.g.: /help/detail?uuid=1234 */ <br />@RequestMapping(value = "/help/detail", params={"uuid=1234"} method = RequestMethod.GET)<br />public String displaySomeHelpDetail(Model model) {<br /> <br /> // Do Something Else<br /> return "another.view.name" <br />}<br /><br />Whilst @RequestParam is used to pass request parameters into a method so that you can use them. For example:<br /><br />@RequestMapping(value = "/help/detail", method = RequestMethod.GET)<br />public String displaySomeHelpDetail(@RequestParam("uuid") String uuid, Model model) {<br /> <br /> log.info("The uuid = " + uuid);<br /> return "view.name" <br />}Roger Hugheshttps://www.blogger.com/profile/07042290171112551665[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-72289115189667654282012-07-24T18:11:01.654+01:002012-07-24T18:11:01.654+01:00Nice post. I would like to know the difference bet...Nice post. I would like to know the difference between @RequestMapping's param attribute AND @RequestParam.<br /><br />Method 1:<br />@RequestMapping(value = "/help/detail", method = RequestMethod.GET)<br /> public String displaySomeHelpDetail(@RequestParam("uuid") String uuid, Model model) {<br />return "view.name" <br />}<br /><br /><br />@RequestMapping(value = "/help/detail", params={"uuid"}method = RequestMethod.GET)<br /> public String displaySomeHelpDetail(Model model) {<br />// How to use the "uuid" in this way?<br />return "view.name" <br />}aprajitha[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-84398942459053324162012-06-22T09:54:00.711+01:002012-06-22T09:54:00.711+01:00Awesome logic, thanks and this help me for differe...Awesome logic, thanks and this help me for different program! <a href="http://www.samplecontracts.org/" rel="nofollow">Sample Contracts</a>Anonymoushttps://www.blogger.com/profile/09680687232989598778[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-22399253012270708862011-09-14T14:21:59.533+01:002011-09-14T14:21:59.533+01:00Yes, the answer is to encrypt the uuid using somet...Yes, the answer is to encrypt the uuid using something like RC4 and then convert that to ASCII using base64. Take a look at <a href="/2011/09/using-restful-urls-on-your-spring-3-mvc.html" rel="nofollow">this blog</a>Roger Hugheshttps://www.blogger.com/profile/07042290171112551665[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-34882009031715035842011-09-09T20:05:01.426+01:002011-09-09T20:05:01.426+01:00Do you know how to encode the uuid so it is not vi...Do you know how to encode the uuid so it is not visible to the user for security converns?blong824https://www.blogger.com/profile/14570983460969791476[email protected]