Created
March 8, 2012 08:05
-
-
Save enesakar/1999573 to your computer and use it in GitHub Desktop.
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
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