Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to Submit doGet and doPost request using javascript ?

Avatar

Level 1

Hi,

My requirement is:

Need to submit form to two different methods doGet and doPost.

doGet will authenticate the request by asking to enter username and password.

After successful authentication we need to call doPost to submit the data of form.

I tried using Get(url); and Post(url,data,type); methods of FormCalc but i am not able to retrive the attribute and its value using Post.

my FormCalc script is

Get("https://server:port/servlet"); //I am able to call doGet method successfully

Post("https://server:port/servler","user=abcd&password=123456"); //I am able to call doPost method but I am not able to retrive the attribute user and password in doPost method.

i tried request.getAttribute("user"); and also i tried request.getParameter("user");

both are coming as null. How to submit form data to doPost method of servlet.

Also I would like to know is there any javascript for the same.

0 Replies