更新时间:2023-11-14 13:10:34
如果您遵循 Java bean 约定,则没有问题.
There are no issues if you follow Java bean conventions.
以下是解决问题的一些指南:
Here are some guidelines to resolve the issue:
长话短说遵循惯例.以上行为已用 Struts 2.3.4 测试
Long story short follow conventions. Above behaviour tested with Struts 2.3.4
我猜正在发生什么:getter 也允许设置(如果只有一个 setter,你只能在地图中设置一个项目,对于当前的参数拦截器,这是案件).检查 bean 的属性以查看它应该如何进行类型转换,可能首先它会查找失败的 setter,然后查看该名称的属性的操作以确定失败的类型,因为它需要使用默认值.默认参数类型是 String 到 String[] 的映射,这就是您所看到的.
What I'm guessing is happening: The getter allows for setting too (If there was only a setter you could only set one item in the map, well with the current parameter interceptor this is the case). The bean is inspected for the property to see how it should do type conversion probably first it looks for a setter failing that it looks at the action for a propterty of that name to determine the type failing that it will need to use the default. The default parameter type is a mapping of String to String[] and this is what you are seeing.