Reputation:
I want to send XML request from JSP to Servlet in doPost method. How can i achieve this.
This is in JSP page.
username = request.getParameter("username");
pasword = request.getParameter("password");
xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
+ "<login_credential><username>" + username + "</username>"
+ "<password>" + pasword + "</password></login_credential>";
This is in Servlet.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//HERE I want a xml which has sent from jsp page.
}
Upvotes: 0
Views: 1292
Reputation: 12212
Put the xml in hidden HTML file and submit a form. As an alternative you can create AJAX request.
Upvotes: 1