servlet just displays null on black page and does not doPost().?

I am trying to execute code in a servlet but it doesnt execute anything in the doPost() method. Instead when the servlet is accessed it shows a blank page with "null" in its body.

this is how i call the vm(which works):

protected String doExecute() throws Exception
{
return MULTIPLEVERSION;
}
this is the code for the vm(which works):
<html>
<head>
	<title>Warning</title>
</head>

<body class="lp">

<div class="module xsrf">
    <div class="mod-header">
        <h3>Warning</h3>
    </div>
    <div class="mod-content">
        <div class="notify warn">
<span style="color:#cc0000;font-weight:bold;">Confirmation</span>
<form name="multipleVersionForm" action="$theurl/plugins/servlet/aServlet" method="post" >
<input id="projectId" type="hidden" value="$projectId" >
<input id="versionName" type="hidden" value="$versionName" >
<input id="theNewDate" type="hidden" value="$theNewDate" >
<p>Do you wish to update 'SW Ready - 3 Weeks?'s Release date as well?</p>
<p><input type="submit" value="Yes" ></input>
<button onclick="history.go(-2);">No</button></p>
            </form>
        </div>
    </div>
</div>

</body>
</html>

and when i hit the yes button it goes to .../plugins/servlet/aServlet (the Correct servlet) which is this:

public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.getOutputStream().println("HI");
}

The Problem is that it is not executing the code in the doPost the page appears blank with only the word "null" in its body. Can anyone point out the problem?

1 answer

1 accepted

This widget could not be displayed.

Your doPost() is probably never getting executed. With my experiment I have found out that when the page is displayed, the action element of the form automatically has the correct url to the servlet. So, just keep the action element empty and see if it works

<form name="multipleVersionForm" action="" method="post" >

so i tried setting action to "" but that just gave me this error:

JIRA could not complete this action due to a missing form token.

You may have been away from your web browser for a while, which could have resulted in the expiry of your current form token. A new form token has been reissued.

JIRA administrators : Please refer to this page for details on disabling form token checking.

Problematic action : ExtendedEditVersionDetails.jspa

Openup firebug and see the url where your submit getting posted, in other words look for the url that has been substituted in the action element.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in United States

Local Atlassian Research Workshop opportunity on Sep. 28th

We're looking for participants for another workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sh...

34 views 0 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you