We are getting the inputs using HTML forms (mostly text box). The validations (like not empty) are done using Java Script. After the successful validation we have to generate XML document by using Java script and the same will be passed to EJB via JSP.

Simon Brown

Whilst there don't seem to be any solutions for building XML using JavaScript, there is another, maybe easier way that you can achieve the same result.

After validating the text fields on the client-side, you could POST the contents of the form back to another JSP. This JSP could use one of the various XML libraries available (e.g. Xerces from Apache or JAXP from Sun) to build the XML document for subsequently passing it to your EJB.