I want to save Object values in xml file which is located in my Spring MVC project's SRC folder.
I little bit know about marshaling and un-marshaling concept of JAX-B for saving object to xml file.
example ,
Employee emp1=new Employee(1,"Robin",50000);
File file =new File("c://myfiles//employee.xml"))
marshallerObj.marshal(emp1, new FileOutputStream(file);
here above code save the my emplyee object to employee.xml file which is locate in C/myfiles folder.
so how i can use same code in spring controller like below,
@RequestMapping(value="/saveNotice",method=RequestMethod.POST)
public void saveNotice(Notice notice){
Employee emp1=new Employee(1,"Robin",50000);
File file =new File("src/employee.xml"))
marshallerObj.marshal(emp1, new FileOutputStream(file);
}
need help here........
thanks.
No comments:
Post a Comment