Getting values in my Java class from velocity (Jira plugin webwork module )

2.3k views Asked by At

I am creating a Jira plugin which provides a version tab panel. In the velocity of this version tab panel i am providing a select list . the code of select list is as below

                    <form name="input" action="AddParent" method="post">
        <select name="parentVersion">
        <option value="-1">--select Parent--</option>
        #foreach($version in $versions )
            <option value="$version" selected="true">$version</option>
        <input type="submit" value="Add Parent"/>
        </form>

Now in my plugin i have included a webwork module to handle this action . when i click the "Add Parent" button nothing is happening. I need the value which i have selected in my java action class . I am surely missing something . can someone please help me with this ? Thanks in advance .

2

There are 2 answers

2
mdoar On BEST ANSWER

I'm not sure what's missing in your code, but the WebWork Sample Plugin has more information about this.

0
LeonardoX On

As an alternative, you can declare a local variable named same as your select list, create getter and setter and the variable will get the selected value. Also, yo can specify the form action as action="YourClass!yourMethod.jspa"

private String parentVersion;

public String getParentVersion() {
    return parentVersion;
}
public void setParentVersion(String parentVersion) {
    this.parentVersion = parentVersion;
}