Forums

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

how to transfer data entered from the keyboard by the user from velocity to java

Александр_Бузин
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 26, 2019

Hi! I have a problem, I try to pass the field entered by the user through <input> to the java class, but when I try to do this, I get an error that this method is not defined, but if I remove the parameters from the java method, then it sees this method and works, connection with this question, how to transfer the values ​​from the input field to the java class Thanks for the future answers!

MyAction.java

public class MyAction extends JiraWebActionSupport {

private Project project;
private static String name;
private static String test;

@Override
public String execute() throws Exception {
project = getSelectedProjectObject();

return super.execute();
}

public String doAdd() throws Exception {


return getRedirect("action.jspa");

}

public Project getProject() {
return project;
}

public static String getTest() {
return test;
}

public static void setTest(String test) {
MyAction.test = test;
}

public static String getName() {
return name;
}

public static void setName(String name) {
MyAction.name = name;
}
}

success.vm

<!DOCTYPE HTML>
<html>
<head>
<title>MyTestPage</title>
<meta name="decorator" content="atl.admin"/>
<meta name="projectKey" content="$project.getKey()"/>
<meta name="projectId" content="$project.getId()"/>
<meta name="admin.active.tab" content="my_item_link"/>
<meta name="admin.active.section" content="atl.jira.proj.config"/>
$webResourceManager.requireResourcesForContext("my-resources")
</head>
<body>
<form action="action!add.jspa">
<input type="text" name="test"/>
<input type="submit" value="OK"/>
</form>
<table>
<thead>
<th>test</th>
<th>name</th>
</thead>
<tbody>
<tr>
#set($helper=$action.getHelper())
#set($test = $name)
<td>$test</td>
<td>$helper.getPage().id</td>
</tr>
</tbody>
</table>
</body>
</html>

atlassian-plugin.xml

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<webwork1 key="actions" name="MyActions">
<actions>
<action name="com.atlassian.plugin.reportPlugin.action.MyAction" alias="action" roles-required="admin">
<view name="success">/myaction/success.vm</view>
</action>
<command name="doAdd" alias="add">
<view name="success">/myaction/success.vm</view>
</command>
</actions>
</webwork1>


<web-section key="my_section" name="MySection" i18n-name-key="my-section.name" location="atl.jira.proj.config" weight="1000">
<description key="my-section.description">The mySection Plugin</description>
<label key="my-section.label"/>
</web-section>

<web-item key="my_item_link" name="MyTab" section="atl.jira.proj.config/my_section" i18n-name-key="my-item.name" weight="1000">
<label key="MyLink" />
<link linkId="my_item_link">/secure/action.jspa</link>
</web-item>

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="reportPlugin"/>

<!-- add our web resources -->
<web-resource key="my-resources">
<dependency>com.atlassian.jira.jira-project-config-plugin:project-config-global</dependency>
<context>my-resources</context>
</web-resource>

<web-resource key="reportPlugin-resources" name="reportPlugin Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="reportPlugin.css" location="/css/reportPlugin.css"/>
<resource type="download" name="reportPlugin.js" location="/js/reportPlugin.js"/>
<resource type="download" name="images/" location="/images"/>

<context>reportPlugin</context>
</web-resource>

</atlassian-plugin>

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, aafp, jira migration, marketing collaboration, end siloed work, streamline workflows, kerrie gottschalk, jira cloud admins, unified marketing, process visibility, team efficiency, cross-team collaboration

How Kerrie Gottschalk unified AAFP’s marketing team with Jira

At the American Academy of Family Physicians, siloed marketing teams faced delays and duplicate work. Kerrie Gottschalk shook things up by moving the department to Jira, streamlining processes, boosting visibility, and sparking stronger collaboration.

Read the story
AUG Leaders

Atlassian Community Events