Created
March 17, 2015 11:09
-
-
Save OdaShinsuke/018d9a1c1f3355e27648 to your computer and use it in GitHub Desktop.
Primefaces AutoComplete 日本語入力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample; | |
import java.io.Serializable; | |
import java.util.Arrays; | |
import java.util.List; | |
import javax.faces.view.ViewScoped; | |
import javax.inject.Named; | |
@SuppressWarnings("serial") | |
@Named(value = "autoCompleteBean") | |
@ViewScoped | |
public class AutoCompleteBean implements Serializable { | |
private String selectedMember; | |
public String getSelectedMember() { | |
return selectedMember; | |
} | |
public void setSelectedMember(String selectedMember) { | |
this.selectedMember = selectedMember; | |
} | |
public List<String> listNogizaka(String input) { | |
return Arrays.asList("田中健介", "田所", "中田", "佐藤", "今中", "田尻"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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:h="http://xmlns.jcp.org/jsf/html" | |
xmlns:p="http://primefaces.org/ui" | |
xmlns:pe="http://primefaces.org/ui/extensions" | |
xmlns:f="http://xmlns.jcp.org/jsf/core" | |
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> | |
<h:head> | |
<f:facet name="first"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> | |
<meta charset="UTF-8" /> | |
</f:facet> | |
<title>WildFly 勉強会!</title> | |
<h:outputStylesheet library="css" name="appstyle.css" /> | |
<h:outputScript library="javascript" name="appscript.js"/> | |
<ui:insert name="metadata"></ui:insert> | |
</h:head> | |
<h:body> | |
<h:form> | |
<p:autoComplete | |
value="#{autoCompleteBean.selectedMember}" | |
completeMethod="#{autoCompleteBean.listNogizaka}"> | |
<p:ajax event="itemSelect" update="txtMember" /> | |
</p:autoComplete> | |
<p:separator /> | |
<h:outputText id="txtMember" value="選ばれたメンバは#{autoCompleteBean.selectedMember}" /> | |
</h:form> | |
</h:body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://kikutaro777.hatenablog.com/entry/2015/03/17/191240 の日本語入力検証。
これで "今" っていれたら補完が出ず。。