Hi
Please excuse a somewhat stupid question but I am having a problem with @RequestParam which I can't seem to get around.
Im creating a service that takes 30+ request parameters. Some of these parameters are named so that I can not create fields in java to match their names. I have no control over the parameter names. With then @RequestParam annotation I can use the value field to map names to method arguments. How do I do the same for fields in a POJO?
Example of how its done with @RequestParam
This becomes quite cumbersome with 30+ parameters. So I want to do:Code:public void doSomething(@RequestParam(value="-stupid_name1") validParamNameOne,@RequestParam(value="stupid-name2") validParamNameTwo (...))
and then in ParamPojo doCode:public void doSomething(ParamPojo paramPojo)
Is there a way this can be done or have I missed something regarding how spring handles binding of paramaters that can not match java fields?Code:class ParamPojo{ @NiceAnnotation(value="-stupid_name1") // <- this annotation or equivalent is what i am looking for private String validParamNameOne; }


Reply With Quote