Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sorry, im new in java. The question is, how do i need to get the data from xml and use it as my username, password, body message, subject in email ? i already look at java Xml parse but still dont have an idea how to solve my problem.

the variable string such as : string from, string to, string subject, string msg, i need to get all those information from XML file. Please guide me. tq

What I have tried:

 public static void main( String[] args )
{

    System.out.println("Start Application");

    ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Mail.xml");

    MailMail mm = (MailMail) context.getBean("mailMail");

//*************************************************************************
    String from = "test";
    String to = "test";
    String subject = "test";
    String msg = "test";

    mm.sendMail(from, to, subject, msg);
    System.out.println("mail succesfully send");

    System.out.println("End Application");

}
Posted
Comments
wseng 31-Oct-17 2:22am    
your configuration looked wrong.
Asyraf Patt 31-Oct-17 3:40am    
i just want ask a way or idea to get the information such as from , to, subject, msg from xml file..
wseng 31-Oct-17 3:51am    
Looked like a spring batch to me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900