Skip to content Skip to sidebar Skip to footer

Not Able To Call Servlet Dopost Method From Js Form

I'm facing an issue in calling a servlet doPost method from my dynamically generated Javascript form. var form = document.createElement('form'); form.setAttribute('action', 'c

Solution 1:

The data you're sending won't be the same--your hiddeninputfield field should be named orderId, and be initialized with the order ID. Alternatively, you could parse the hiddeninputfield request parameter, but that seems kind of silly.

The jQuery call correctly sends an orderId form value.

It would have been very simple to debug this by seeing that orderId was null in the servlet, and/or by looking at the actual request sent by the browser to see what parameters were being sent, and how.

Post a Comment for "Not Able To Call Servlet Dopost Method From Js Form"