【问题标题】:Primefaces SelectOneMenu not sending selected value on AIXPrimefaces SelectOneMenu 未在 AIX 上发送选定值
【发布时间】:2016-05-31 00:31:06
【问题描述】:

我有一个使用 PrimeFaces 的应用程序,它是在 Windows 上使用 WebSphere 服务器开发的。

当我尝试在 IBM AIX 上运行它时,所有 SelectOneMenu 都不起作用。选择的值不会发送到 bean 并在表单提交时重置为默认值。控制台中没有 JavaScript 错误,也没有 Java 错误。

我使用 PrimeFaces 5.2 和 Websphere server 8.5.5。我在 Google Chrome 和 Internet Explorer 11 中测试该应用程序。

有一个我做的 SelectOneMenu 示例(在 Windows 上工作):

<p:selectOneMenu id="selectType" 
    required="true"
    value="#{exampleBean.newExample.exampleType}"
    widgetVar="selectExampleType">

    <f:selectItem itemLabel="exampleType"
        itemValue="#{null}" 
        noSelectionOption="true" />

    <f:selectItems value="#{exampleBean.exampleTypeList}"
        var="exampleType" 
        itemLabel="#{exampleType.getCurrentDescription()}"
        itemValue="#{exampleType}" />

</p:selectOneMenu>

【问题讨论】:

  • Linux 与 Unix 不同。它到底是什么操作系统?尽管如此,提及客户端(网络浏览器)的品牌/版本也会有所帮助。
  • AIX IBM 的,因为 Unix 家族,我把 Linux 放在了
  • 我们使用 Internet Explorer 11 来测试应用程序,但我们也在 Google Chrome 上尝试了两种环境(AIX/Windows)
  • 你调试了什么(比较工作和非工作环境)?
  • @Kukeltje 我们尝试将 SelectOneMenu 元素从 Primefaces 更改为 jsf 元素,删除 SelectOneMenu 上的所有 css。我们在多个浏览器上测试所有这些更改。我们还尝试添加 ajax 调用以“手动”更新 bean,我们还添加了自己的 Javascript,但这些更改都不起作用

标签: jsf jsf-2 primefaces aix


【解决方案1】:

我终于找到了问题所在。当我在某个对象上覆盖 getAsString 方法并使用这行代码在字符串之间添加一个空格时:

System.getProperty("line.separator")

似乎 AIX 不将此行解释为空格(我不知道为什么),所以我不得不将其替换为引号之间的简单空格,如下所示:

" "

如果有人能解释为什么会这样,那就太好了。纯属运气,我发现这是诚实的。

【讨论】:

  • 我认为这是因为 line.operator 仅设置为 Windows 运算符,并且在 linux 上执行应用程序时该运算符不起作用。
猜你喜欢
  • 2018-04-06
  • 2021-03-03
  • 2013-11-30
  • 2023-03-03
  • 2012-10-03
  • 2014-03-21
  • 1970-01-01
  • 1970-01-01
  • 2014-01-27
相关资源
最近更新 更多