Java RichFaces4Ajax不是文字王
我正在使用JSF2.1、JBoss7.1、Seam2.3和DynamicWebModule 3.0 我已将richfaces 3.3迁移到4.3。我已经完成了RichFaces4.3的需求。例如, 罐子: javax-faces-2.1.5.jar 番石榴11.0.2 richfaces-core-api-4.3.5.Final.jar richfaces-core-impl-4.3.5.Final.jar richfaces-components-api-4.3.5.Final.jar richfaces-components-ui-4.3.5.Final.jar cssparser-0.9.13.jar 囊罐 我已经为测试写了一些代码 UserBean.javaJava RichFaces4Ajax不是文字王,java,ajax,jsf,richfaces,Java,Ajax,Jsf,Richfaces,我正在使用JSF2.1、JBoss7.1、Seam2.3和DynamicWebModule 3.0 我已将richfaces 3.3迁移到4.3。我已经完成了RichFaces4.3的需求。例如, 罐子: javax-faces-2.1.5.jar 番石榴11.0.2 richfaces-core-api-4.3.5.Final.jar richfaces-core-impl-4.3.5.Final.jar richfaces-components-api-4.3.5.Final.jar ric
import javax.annotation.ManagedBean;
import org.jboss.seam.annotations.Name;
@ManagedBean
@Name("userBean")
public class UserBean {
public String name;
public UserBean() {
}
public UserBean(String name)
{
this.name=name;
}
public String getName() {
System.out.println("Get " + name);
return name;
}
public void setName(String name) {
System.out.println("Set " + name);
this.name = name;
}
}
和.xhtml页面。我从richfaces 4 showcase中获取了richfaces代码
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" xmlns:o="http://openfaces.org/"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:richext="http://java.sun.com/jsf/composite/richext">
<h:outputStylesheet>
.outhello {
font-weight: bold;
}
</h:outputStylesheet>
<h:form>
<h:panelGrid columns="3">
<h:outputText value="Name:" />
<h:inputText value="#{userBean.name}" />
<a4j:commandLink value="Say Hello" render="out" execute="@form" />
</h:panelGrid>
</h:form>
<br />
<a4j:outputPanel id="out">
<h:outputText value="Hello #{userBean.name} !" styleClass="outhello" />
</a4j:outputPanel>
</ui:composition>
如何处理这个问题?您是否有定义bean及其作用域的faces-config.xml文件?另外,为什么bean上同时有
@Named
和@ManagedBean
?在我的项目中,一个项目由另外三个项目组成。我有ejb、ear和web项目。我在ejb中创建了bean,web页面是在web项目中创建的@name提供了从bean获取属性和方法。我上面写的那个例子。我在工作中也有同样的问题。我的项目在迁移之前工作顺利。我在web文件夹中有faces配置。ejb文件夹中的我的bean。
13:52:26,094 INFO [stdout] (http-localhost-127.0.0.1-8080-2) Get null
13:52:26,101 INFO [stdout] (http-localhost-127.0.0.1-8080-2) Get null