【问题标题】:Importing IceFaces crashes the webapplication导入 IceFaces 会使 web 应用程序崩溃
【发布时间】:2015-11-15 16:04:58
【问题描述】:

我想使用 icefaces,但是一旦我导入 icefaces 库,我的 web 应用程序会在单击表单上的一个按钮后崩溃,该按钮在导入前可以正常工作。

会出什么问题?

Java 源代码:

package test,

import javax.faces.bean.ManagedBean;

@ManagedBean
public class Student {

private String firstName;

// create no-arg constructor
public Student() {

}

// define getter/setter methods 
public String getFirstName() {
    return firstName;
}

public void setFirstName(String firstName) {
    this.firstName = firstName;
}

}

index.xhtml:

<!DOCTYPE html>
<html lang="en"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
    <title>Student Registration Form</title>
</h:head>
<h:body>
    <h:form>
        First name: <h:inputText value="#{student.firstName}" />        
        <br/><br/>
        <h:commandButton value="Submit" action="student_response" />
    </h:form>
</h:body>

student_response.xhtml

<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
    <title>Student Confirmation</title>
</h:head>

<h:body>

    The student is confirmed: #{student.firstName} 

</h:body>
</html>

我得到的错误:

【问题讨论】:

  • 你从哪里得到 IceFaces 包?您正在复制 javax.facesjavax.servletjavax.annotation 等 API。
  • 确实,运行时类路径是一团糟。看起来 JAR 是随意扔进去的。从 WAR 中删除重复的和容器生产的 JAR。

标签: jsf icefaces


【解决方案1】:

你有 2 个 javax.faces。根据您的第一个屏幕截图,类路径中的 jars。

请删除您的类路径中的一个面孔罐子。

【讨论】:

  • 您能否添加一个链接,确认 IceFaces 有自己的 faces servlet 实现,并且不需要 mojarra 或 MyFaces。
  • 您在解释问题原因方面做得不好。请编辑和改进,这会误导未来的读者。
猜你喜欢
  • 2017-01-03
  • 2014-09-23
  • 2020-05-26
  • 2019-03-11
  • 1970-01-01
  • 1970-01-01
  • 2020-02-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多