Forums

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

Java Object values inside of javascript

b
Contributor
April 15, 2012

Hi,

I want to display object variables values in dialog box.

function showSth(myObj) {
        	var dialog = new AJS.Dialog(860, 530);
			dialog.addPanel("Panel 1", "here I want to put object values", "panel-body");
			alert(myObj);
			dialog.show();
}

<input id="test-button" type="button" class="button" onclick="showSth($myObj);" value="Popup - Click Me">

As parameter I give java model object, that extends Entity interface, but after click on button nothing happens.

I would be appreciated for any code examples

1 answer

1 vote
JamieA
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.
April 15, 2012

I'd have a look at the REST tutorial. The "wrong" way to do it is have your javascript generated by a velocity template, which has access to the java objects.

The "right" way is to write a REST module, when your dialog is opened it makes an ajax request, receives JSON, and displays it as it needs to.

b
Contributor
April 16, 2012

Do you have any Java code examples, because examples in https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Version+2+Tutorial was in Python

JamieA
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.
April 16, 2012

I have been through this tutorial and found it helpful: https://developer.atlassian.com/display/DOCS/Incomplete+Plugin+Tutorial+-+Writing+REST+Services

Says incomplete but I got what I needed from it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events