AJAX-supported automatic fill forms

Source: Internet
Author: User

An AJAX extension project for JSF actually has a better choice for users who use Myfaces: Using the Inputsuggestajax in Myfaces Sandbox

Usage is as follows:

1. Create a managed Bean:

package test;
Import java.util.ArrayList;
import java.util.List;
public class Bean {
//in t Hat function All what your had to ' do ' to
//specify what'll be displayed in the list
//note Keyword is the "text entered by" User
Public List getsuggestedwords (String keyword) {
list Li st = 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 page Code

<%@ taglib uri="" prefix="h" %>
<%@ taglib uri="" prefix="f" %>
<%@ taglib uri="" prefix="s" %>
<title>Ajax JSF sample (InputSuggestAjax)</title>
<body>
<f:view>
    <s:inputSuggestAjax suggestedItemsMethod="#{bean.getSuggestedWords}"
  value="#{bean.currentValue}" />
  <br />
    <br />
  </f:view>
</body>

3.web.xml Configuration

<context-param>
 <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
 <param-value>client</param-value>
</context-param>
//Instead of server make the state saving method on the client to make it works

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.