java - spring mvc receives an object. How to set different properties of the object?
漂亮男人
漂亮男人 2017-05-27 17:40:38
0
1
745
@RequestMapping(value = "/listByUserId") public PageInfo listByUserId(User user) { }

What I am receiving is a User object, in which the User attribute id, I want to set an initial value for it, that is, there is an initial value when the id parameter is not sent. I use @RequestParam to specify the id attribute defalutValue, but it does not work. Is there any way to achieve this? It is best not to change to the User class

漂亮男人
漂亮男人

reply all (1)
刘奇

This is what I wrote:

@RequestMapping(value="/student/{st_no}",method= RequestMethod.GET) public Student info(@PathVariable Integer st_no){ }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!