my requirement is: A form submit should trigger the LoginServlet, from which the username and password are passed to UserService.login. If the username and password are validated (if statement is fine) an user xml string should be returned. Do I need to use Jaxb or any other parser? using String builder is good approach?
I have used String builder as:
StringBuilder validUser = new StringBuilder();
validUser.append("<username>");
validUser.append(username);
validUser.append("</username>");
validUser.append("<firstname>");
validUser.append("Jose");
validUser.append("</firstname>");
validUser.append("<lastname>");
validUser.append("Tom");
validUser.append("</lastname>");
validUser.append("</user>");
String result = validUser.toString();
From the above string i.e result, I need to get/display firstName i.e.Jose to the UI. I tried with String index, not able to get exact result since user name is always changes or user name length is always varies.