快捷搜索:

AJAX支持的自动填充表单

jsf的一个ajax扩展项目, 着实对付应用myfaces的用户来说还有个更的选择:应用MyFaces Sandbox 中的 InputSuggestAjax用法如下:

1.创建一个managed bean:

package test;

import java.util.ArrayList;

import java.util.List;

public class Bean {

//In that function all what you had to do is to

//Specify what will be displayed in the list

//Note that the keyword is the text entered by the user

public List getSuggestedWords(String keyword) {

List list = new ArrayList();

list.add(keyword + " Ahmed Saleh");

list.add(keyword + " Kahki");

list.add(keyword + " Kourany");

list.add(keyword + " Kiki");

list.add(keyword + " Saleh Abouetta");

list.add(keyword + " Hashim");

return list;

}

public String getCurrentValue() {

return currentValue;

}

public void setCurrentValue(String currentValue) {

this.currentValue = currentValue;

}

String currentValue;

}

2.jsp 页面代码

3.web.xml设置设置设备摆设摆设

javax.faces.STATE_SAVING_METHOD

client

//Instead of server make the state saving method on the client to make it works

您可能还会对下面的文章感兴趣: