如何在 OpenSymphony WebWork 选择中获取所选项目
我继承了别人的代码,它使用了 OpenSymphony WebWorks,这是我以前从未遇到过的。我正在尝试对“货物崇拜”进行一个小修复。它在 JSP 中包含以下内容:
<ww:select
name="'selectedOrigDoctypes'"
value="selectedOrigDoctypes"
size="5"
multiple="true"
cssClass="'doctype'"
list="origDoctypeChoices"
theme="'simple'" />
我不知道如何从列表中获取所选项目。该列表已使用 Action bean 的 origDoctypeChoices 属性的内容正确填充。我以为我只需要在 Action bean 中实现“setSelectedOrigDoctypes(List docTypes)”,但这不起作用。相反,我在日志文件中看到以下内容:
150876 [http-8080-1] DEBUG com.opensymphony.xwork.interceptor.ParametersIntercep
tor - Setting params {selectedOrigDoctypes=[Ljava.lang.String;@5249c469}
150965 [http-8080-1] DEBUG com.opensymphony.xwork.util.CompoundRootAccessor - No object in the CompoundRoot has a property named 'selectedOrigDoctypes'.
I inherited somebody else's code, and it uses OpenSymphony WebWorks, which I've never encountered before. I'm trying to "cargo cult" a small fix to it. It includes the following in a JSP:
<ww:select
name="'selectedOrigDoctypes'"
value="selectedOrigDoctypes"
size="5"
multiple="true"
cssClass="'doctype'"
list="origDoctypeChoices"
theme="'simple'" />
and I can't figure out how to get the selected items out of the list. The list is correctly populated with the contents of the Action bean's origDoctypeChoices property. I thought I'd just have to implement a "setSelectedOrigDoctypes(List docTypes)" in the Action bean, but that's not working. Instead I see the following in the log files:
150876 [http-8080-1] DEBUG com.opensymphony.xwork.interceptor.ParametersIntercep
tor - Setting params {selectedOrigDoctypes=[Ljava.lang.String;@5249c469}
150965 [http-8080-1] DEBUG com.opensymphony.xwork.util.CompoundRootAccessor - No object in the CompoundRoot has a property named 'selectedOrigDoctypes'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于弄清楚了“selectedOrigDoctypes=[Ljava.lang.String;”是什么事情的意思是 - 我将“origDoctypeChoices”从列表更改为字符串[],一切正常。
I finally figured out what the "selectedOrigDoctypes=[Ljava.lang.String;" thing meant - I changed "origDoctypeChoices" from a List to an String[], and everything worked.