I am developing simple web application to learn jsp, mongodb, html. I have created an simple registration form in jsp which takes Name, Address and MobileNo information from user and insert it into mongodb, Now I want to retrieve this stored data and put value of every field in individual string variable.
Ex:
Name: varun;
Address: Nagpur;
MobileNo: 1234567890
Above data is stored in mongodb as:
{
"_id" : ObjectId("5259bacea6f8b1c4cd3431d3"),
"Name" : "varun",
"Address" : "nagpur",
"MobileNumber" : "1234567890"
}
Retrieved in jsp as follows:
MongoClient mongoC = new MongoClient(new ServerAddress("Localhost",27017));
DB database = mongoC.getDB("dbfrnzout");
DBCollection collec1 = database.getCollection("coll");
DBObject dock= collec1.findOne();
out.println(dock);
This code print one record as json document and I want to store value associated with every
field in individual string variable, something like this:
String s1 = varun ie. value of field Name
Need some guidance.