I want to develop a code which can take json object from the json file and bind it to Html page using java code .I have searched through browser i dint get the solution.Please give me suggestion to solve this issue.
I have the json file.
{
"policyN": "D800026158",
"policyStartDate": "23-Nov-2017",
"policyEndDate": "22-Nov-2018",
"policyIssueDate": "23-Nov-2017",
"agent": {
"agentCode": "100006767676702",
"agentName": "ZInsurance Limited",
"agentEmail": "[email protected]"
}
}
If i select PolicyN i should get all the informatiom which is having in json file.
I have tried by using this code
PojoMobile myObjects = mapper.readValue(new File("D:/godigit_doc/MobileJsonNew.json"), PojoMobile.class);
System.out.println(".=agentCode=."+myObjects.getAgent().getAgentCode());
System.out.println(".=agentEmail=."+myObjects.getAgent().getAgentEmail());
Pojo class is :
public class PojoMobile {
private String policyNumber;
private String policyStartDate;
private String policyEndDate;
private String policyIssueDate;
private Agent agent;
public String getPolicyNumber() {
return policyNumber;
}
public void setPolicyNumber(String policyNumber) {
this.policyNumber = policyNumber;
}
public String getPolicyStartDate() {
return policyStartDate;
}
public void setPolicyStartDate(String policyStartDate) {
this.policyStartDate = policyStartDate;
}
public String getPolicyEndDate() {
return policyEndDate;
}
public void setPolicyEndDate(String policyEndDate) {
this.policyEndDate = policyEndDate;
}
public String getPolicyIssueDate() {
return policyIssueDate;
}
public void setPolicyIssueDate(String policyIssueDate) {
this.policyIssueDate = policyIssueDate;
}
public Agent getAgent() {
return agent;
}
public void setAgent(Agent agent) {
this.agent = agent;
}
}
I can able to get the value but im not able to bind the output to Html page.Please Help me .Thanks In advance