我有这种奇怪的情况,第一次访问包含此代码的页面时,每当我选择任何值时,控件都会从所选值闪烁并返回第一个值 - 如果存在则不调用Listener。从那时起,事情就可以了。
值是字母a-z加上空的非空字符串。
将它与tomcat 7一起使用
t hanks
launcher.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body >
<ui:composition template="/paginas/comun/layout.xhtml">
<ui:define name="contenido">
<ui:insert name="funcionalidad" >
<ui:include src="_launcher.xhtml" />
</ui:insert>
</ui:define>
</ui:composition>
</h:body>
</html>
_launcher.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:form id="form">
<p:panel
header="faster than the speed of love"
id="ulricso">
<p:selectOneMenu
value="#{direccionPuntualBean.letra11}">
<p:ajax
process="@all"
update="@form"/>
<f:selectItems value="#{direccionPuntualBean.letras}"/>
</p:selectOneMenu>
</p:panel>
</h:form>
</html>
bean摘录
public List<String> getLetras() {
List<String> ls = new ArrayList<String>();
ls.add("");
for (int i = 65; i <= 90; i++) {
ls.add(new String("" + (char)i));
}
return ls;
}