Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

POST method to servlet

Mamikon Papikyan
Contributor
October 12, 2020

Hi, atlassian I want to execute POST request to servlet in order to execute doPost function. So and I use http://localhost:8080/plugins/servlet/my-servlet for my servlet page. Also I'm using .vm file to display login and password on the issue page, it displayed fine, and when I write my host (http://localhost:8080/plugins/servlet/my-servlet) in form action value it works perfectly. But i don't want to hardcode it, so and I'm using this javascript method to get url. But it not works. How can I use my servlet host in action value? Sorry for bad english :-)


<script language="JavaScript">
function get_servlet_host () {
var host = location.protocol + "//" + location.host + "/plugins/servlet/my-servlet";
return host.toString();
}
</script>

<form action="javascript&colon;get_servlet_host()" method="post" target="_blank">
<label for="username">Username:</label>
<input type="text" id="username" name="username"<br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"<br>
<input type="submit" value="Login">
</form>

 Thanks, 

Mamikon

0 answers

Suggest an answer

Log in or Sign up to answer