hi,
i have created a web panel like so:
<web-panel key="myPanel" location="atl.userprofile" weight="200"> <resource name="view" type="velocity" location="/templates/user/viewmyskills.vm"/> </web-panel>
and now i would like to populate it dynamically with data from DB. Which is the best way to do it?
Thanks!!!
Community moderators have prevented the ability to post new answers.
I have solved this problem! I have added a new Context Provider to my Web Panel:
<web-panel key="myPanel" location="atl.userprofile" weight="200"> <context-provider class="de.twt.confluence.plugins.contextprovider.UserSkillPanelContextProvider" /> <resource name="view" type="velocity" location="/templates/user/viewmyskills.vm"/> </web-panel>
Java:
public class UserSkillPanelContextProvider implements ContextProvider{ private UserServiceImpl userService; public UserSkillPanelContextProvider(UserServiceImpl userService) { this.userService = userService; } @Override public void init(Map<String, String> params) throws PluginParseException { } @Override public Map<String, Object> getContextMap(Map<String, Object> context) { User user = AuthenticatedUserThreadLocal.getUser(); UserVO userVO = userService.fetchUserByEmail(user); context.put("userVO", userVO); return context; } }
*.vm Page:
<table style="width: 1000px;"> <caption style="text-align: left;" ><b>Qualifikationen Übersicht</b></caption> #foreach($!userSkill in $!userVO.userSkills) <tr> <td style="vertical-align: middle">$!userSkill.skillEntity.skillTitle</td> <td style="vertical-align: middle">$!userSkill.selfAssessment</td> </tr> #end </table>
is there a way to use com.atlassian.plugin.web.model.WebPanel? some example of getHtml(...) method usage?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There will be plenty of examples of using WebPanel.getHtml() within the Confluence source code - if you have a commercial licence for Confluence you should be able to login to my.atlassian.com and download it.
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.