hey,
i have created a bamboo plugin. its a task that sends mails. Now we want to view and edit the mailserver settings in bamboo. I have added a section and a item.
When clicking on the item, the page with the information and a edit-button should appear on the rigth side. But i dont know how to do this. would it be a web-panel or a servlet? I tried both but it didn't work.
<servlet key="admin-servlet" class="com.atlassian.bamboo2.printOut.ExampleServlet"> <url-pattern>/mailserver</url-pattern> </servlet> <web-section key="mailServerConfig" name="Mailserver Configuration" location="system.admin" weight="110" application="bamboo"> <label key="Mailserver Configuration" /> </web-section> <web-item key="bamboo-menu-item" name="XProduct Admin" section="system.admin/mailServerConfig" weight="10" application="bamboo"> <label key="XProduct Admin" /> <link linkId="my-web-item-link">plugins/servlet/mailserver</link> </web-item>
Edit:
i found out that i have to use xwork modul.
<xwork key="mailServerAction" name="mailServerAction"> <package name="mailserver" extends="default"> <action name="mailserver" class="com.atlassian.bamboo2.printOut.MyAction"> <result name="success" type="velocity">/templates/admin.vm</result> </action> </package> </xwork>
But when i click the item this error occurs:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/templates/admin.vm' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:458) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:341) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:831) at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:491) at com.opensymphony.webwork.dispatcher.VelocityResult.getTemplate(VelocityResult.java:183) at com.opensymphony.webwork.dispatcher.VelocityResult.doExecute(VelocityResult.java:112) at com.atlassian.xwork.results.ProfiledVelocityResult.doExecute(ProfiledVelocityResult.java:21) at com.opensymphony.webwork.dispatcher.WebWorkResultSupport.execute(WebWorkResultSupport.java:143) at com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:313)
Files:
- src/main/java/package/MyAction.java
- src/main/resources/templates/admin.vm
- src/main/resources/atlassian-plugin.xml
I've tried to change die package "extends", added a "namespace" and a lot of slashes evreywhere, but the error still occurs.
What am I missing?
EDIT:
a result tag type freemarker and a .ftl file opens the page.. but why?
-> because in bamboo you cannot use any vm files, rigth? -.-
Thanks!
Solution
atlassian-plugin.xml
<web-section key="sectionKey" name="sectionName" location="system.admin" weight="110" application="bamboo"> <label key="sectionLabelKey" /> </web-section> <web-item key="itemKey" name="itemName" section="system.admin/sectionKey" weight="10" application="bamboo"> <label key="itemLabelKey" /> <link linkId="actionKey">/packageName/actionName.action</link> </web-item> <xwork key="actionKey" name="actionName"> <package name="packageName" extends="admin"> <action name="actionName" class="PathToActionClass" method="execute"> <result name="success" type="freemarker">/FileName.ftl</result> </action> </package> </xwork>
ftl file:
<html> <head> [@ui.header pageKey="Header" title=true /] <meta name="decorator" content="adminpage"> </head> <body> ... </body> </html>
Can you post your src/main/java/package/MyAction.js file content? That would be great! Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.