I have a Struts Action that has a DTO as a member:
public class MyAction {
private MyDTO dto;
void execute() {
String bar = dto.getBar() ;
//struts has mapped GET parameter dto.bar by calling dto.setBar()
// do something with bar:
return bar != null ? SUCCESS : INPUT;
}
}
I want the parameter named "b" to be mapped to dto.bar, simply to make my GET url cleaner. Instead of: http://myurl?dto.bar=xxx I want: http://myurl?b=xxx
I know I can do this by adding to my Action a setB(final String b), but that would make my code more brittle and harder to understand.
Is there a way I can tell Struts to do this mapping, so that for a url of http://myurl?b=xxx, MyAction.getDto.setBar() is called?