The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to put Velocity parameters in WebWork action

grundic
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 Champions.
September 19, 2011

I've implemented custom WebWork action. For it I've supplied some velocity templates.

How can I add custom parameters to velocity? I didn'f find any such method :(

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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 Champions.
September 19, 2011

If you add private variables in the action and getter methods for them in the action class, they are accessible from the velocity template. Is this what you want?

grundic
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 Champions.
September 19, 2011

Yep, I think that's just it! Thanks a lot!

grundic
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 Champions.
September 19, 2011

One more question: if I have to add to velocity context standard jira components - for example, webResourceManager - should I write something like:

public WebResourceManager getWebResourceManager(){
return ComponentManager.getInstance().getWebResourceManager();
}


It looks like overhead :-/

Bahar Çağlar
Contributor
October 11, 2012

If you add private variables in the action and getter methods for them in the action class, they are accessible from the velocity template. Is this what you want?

Hi Jobin,

Can you give an example for this?

Thanks

Jobin Kuruvilla [Adaptavist]
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 Champions.
October 11, 2012

Example for getter/setters? If you have variable xyz and getter/setters for it, you can access it in velocity template as $xyz

Jobin Kuruvilla [Adaptavist]
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 Champions.
October 11, 2012

Are you missing 's'? Try

<p>size : $crman.relationSchemes.size() </p>

You can also use

<p>size : $crman.getRelationSchemes().size() </p>

Bahar Çağlar
Contributor
October 11, 2012

I can access with action like

#set ($crman = $action.relationManager)

then, I want to access its variables as folows:

<p>size : $crman.relationScheme.size() </p>

I have a getRelationSchemes() methods in it, but I am always getting zero. What is wrong with this?

TAGS
AUG Leaders

Atlassian Community Events