Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Access POST input with Java

Bob Jones May 29, 2015

I'm writing an add-on for Jira.  One of the features is an HTML form with a text box input.  How do I retrieve that data server side once it is submitted?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Gabor Nagy [Midori]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2015

Hi Bob,

It depends on what technology you are using. For example, if you use WebWork/XWork, here are some docs and source codes to get started:

https://developer.atlassian.com/jiradev/jira-architecture/jira-technical-overview/jira-webwork-actions
https://bitbucket.org/mdoar/webwork-sample/src 

For standard servlet technology, check this guide:

https://developer.atlassian.com/docs/getting-started/learn-the-development-platform-by-example/create-a-gui-with-templates-and-aui

Hope that this helps smile 

Bob Jones May 29, 2015

I don't think I'm using either of those. All I have done so far is create a jira plugin using the SDK's script, and then added a issue tab module to it. Within the issue tab module, I wrote velocity code to display the form. I do not know how to use the links you posted above to proceed with the plugin.

Gabor Nagy [Midori]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2015

OK, then I think the servlet way is easier. If you do not know how to write a servlet at all, read some servlet tutorial first, you can find numerous examples, e.g. http://www.tutorialspoint.com/servlets/ In short, you need to extend HttpServlet and override the doPost() method, it's really easy. Then here is how you can tell JIRA use your brand new servlet and assign a unique URL by which you can access it. Take this URL and set as the HTML form's action parameter and set the method parameter to "post", something like this: <form action="http://localhost:2990/jira/plugins/servlet/test"; method="post"> ... </form>

Bob Jones May 30, 2015

Thank you very much for your instructions Gabor! They were very helpful! I was able to write the servlet. Also, for others that may view this page in the future, I found this link very helpful. It discusses one of the Atlassian scripts included in the SDK that generates the servlet java class and adds the appropriate content to the xml files: https://developer.atlassian.com/jiradev/jira-architecture/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/servlet-plugin-module

TAGS
AUG Leaders

Atlassian Community Events