1

我有这种奇怪的情况,当我第一次访问包含此代码的页面时,每当我选择任何值时,控件都会从所选值闪烁并返回到第一个值 - 如果存在,则不调用侦听器。从那时起,一切正常。

这些值是字母 az 加上一个空的非空字符串。

用tomcat 7运行它

谢谢

启动器.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>

豆类摘录

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;
    }
4

0 回答 0