2012-10-23 113 views
0

我是新來的icefaces組件,想要使用ice:selectInputText組件與showcase [ice:selectInputText showcase] [1]相同,但是默認的css在showcase中顯示的功能對我來說沒有相同的功能。當輸入內容時,我會看到下拉列表,但當鼠標移動到任何項目上時,顯示的值爲透明行,沒有任何值顯示。ice:selectInputText CSS(默認/內部)不起作用。

任何人都可以指導在哪裏可以成爲問題: 這裏是我的代碼:test.xhtml

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:ui="http://java.sun.com/jsf/facelets" 
xmlns:h="http://java.sun.com/jsf/html" 
xmlns:f="http://java.sun.com/jsf/core" 


xmlns:ice="http://www.icesoft.com/icefaces/component"> 
<h:head></h:head> 
<h:body> 

<h:form> 

    <h:panelGroup> 
<h:outputLabel value="Enter your name(autocomplete) :"></h:outputLabel> 
           <ice:selectInputText id="heloo" 
          value="#{helloBean.selectedItem}" 
           rows="10" width="152" valueChangeListener="#{helloBean.ValueChangeL}" actionListener="#{helloBean.ActionL}"> 
          <f:selectItems value="#{helloBean.itemList}"></f:selectItems> 

        </ice:selectInputText> 
         </h:panelGroup> 


    </h:form> 
     </h:body> 
    </html> 

管理bean類:

import java.util.ArrayList; 
import java.util.List; 

import javax.faces.bean.ManagedBean; 
import javax.faces.bean.RequestScoped; 
import javax.faces.bean.SessionScoped; 
import javax.faces.event.ActionEvent; 
import javax.faces.event.ValueChangeEvent; 
import javax.faces.model.SelectItem; 

import com.icesoft.faces.component.selectinputtext.SelectInputText; 
@ManagedBean(name= "helloBean") 
@SessionScoped 
public class HelloBean { 

private String selectedItem; 
private Integer seelectedId; 
private List<SelectItem> itemList=new ArrayList<SelectItem>(); 

public String getSelectedItem() { 
    return selectedItem; 
} 
public void setSelectedItem(String selectedItem) { 
    this.selectedItem = selectedItem; 
} 
public Integer getSeelectedId() { 
    return seelectedId; 
} 
public void setSeelectedId(Integer seelectedId) { 
    this.seelectedId = seelectedId; 
} 
public List<SelectItem> getItemList() { 
    return itemList; 
} 
public void setItemList(List<SelectItem> itemList) { 
    this.itemList = itemList; 
} 


public void ValueChangeL(ValueChangeEvent event) 
{ 
String query=(String) event.getNewValue(); 
System.out.println("query is "+query); 
SelectItem item1=new SelectItem(); 
SelectItem item2=new SelectItem(); 
SelectItem item3=new SelectItem(); 
item1.setLabel("abc"); 
item1.setValue(1); 
item2.setLabel("bbc"); 
item2.setValue(2); 
item3.setLabel("aaa"); 
item3.setValue(3); 
itemList.add(item1); 
itemList.add(item2); 
itemList.add(item3); 

} 

public void ActionL(ActionEvent event) 
{ 
    System.out.println("HELLO IN LISTENER of SELECTINPUTTEXT"+event.getSource().toString()); 
    System.out.println("HELLO IN LISTENER of PHASEID IS"+event.getPhaseId()); 
    if (event != null && event.getSource() instanceof SelectInputText) 
    { 
    SelectInputText comp_ = (SelectInputText) event.getSource(); 
    SelectItem selectItem_ = comp_.getSelectedItem();//critical line 
    System.out.println("selected id"+selectItem_.getValue()); 
    seelectedId=(Integer)selectItem_.getValue(); 
    } 
} 

public String submitFunc() 
{ 

    System.out.println("checking selected item: "+ selectedItem); 
    System.out.println("checking selected id: "+ seelectedId); 

    return "success"; 

} 
    } 

回答

1

有更多的展示比上顯示這一頁。該頁面上包含一些樣式表。

如果你想有相同的樣式。請參閱他們的代碼基地here幷包括這些。