如何在 OpenSymphony WebWork 选择中获取所选项目

发布于 2024-08-04 06:02:24 字数 819 浏览 4 评论 0原文

我继承了别人的代码,它使用了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

表情可笑 2024-08-11 06:02:24

我终于弄清楚了“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文