Skip to content

Instantly share code, notes, and snippets.

@enesakar
Created March 8, 2012 08:05
Show Gist options
  • Save enesakar/1999573 to your computer and use it in GitHub Desktop.
Save enesakar/1999573 to your computer and use it in GitHub Desktop.
private void save(HttpServletRequest request) {
String phone = request.getParameter("phone");
String name = request.getParameter("name");
Map<String, Contact> mapContacts = Hazelcast.getMap("Contacts");
mapContacts.put(name, new Contact(name, phone));
request.setAttribute("message","Contact has been added.");
}
private void search(HttpServletRequest request) {
Map<String, Contact> mapContacts = Hazelcast.getMap("Contacts");
Contact contact = mapContacts.get(request.getParameter("searchName"));
if(contact != null) {
request.setAttribute("found","Contact found with Name: <b>"+contact.getName()+"</b> and Phone: <b>"+contact.getPhone()+"</b>");
}
else{
request.setAttribute("found","Contact not found");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment