struts2struts-configmodel-driven

Struts 2 ModelDriven for different request parameter name and bean property name


Is it possible to assign the value to the bean property by implementing ModelDriven interface but having different name in request and bean

for eg Ajax request DemoStruts.Action?param_a=649

the value of param_a parameter must set to the property paramAR in the bean. For doing this is there any xml configuration or annotation to specify this mapping


Solution

  • The normal mechanism is the alias interceptor, although I haven't used it for deep aliasing.

    There are some pretty hideous games you can play with this technique. I've never been entirely sure if it's a good idea or not, though; another option is to just map parameters manually in the action itself. This is often easier to understand.