[prev in list] [next in list] [prev in thread] [next in thread]
List: tapestry-user
Subject: Block question
From: Max Grigoriev <darkit () mail ! ru>
Date: 2003-09-29 16:18:38
[Download RAW message or body]
Hello tapestry-user,
I've got actions and content for this actions on a page.
Html:
<table width="100%" border="0" cellpadding="3" cellspacing="0" class="fbBGreenTable">
<tr>
<td width="20%">
<table width="20%" border="0" cellpadding="3" cellspacing="0">
<tr jwcid="@Foreach" source="ognl:bean.actions" \
value="ognl:bean.currentAction" element="tr"> <td>
<a jwcid="@DirectLink" listener="ognl:listeners.action" \
parameters="ognl:bean.currentAction">
<span jwcid="@Insert" value="ognl:bean.actionTitle">Add \
company</span></a> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="80%">
<span jwcid="@RenderBlock" block="ognl:components[bean.selectedAction]"/>
</td>
</tr>
</table>
Page spec:
<component id="AddCompany" type="AddCompany"/>
<component id="ShowStatistic" type="ShowStatistic"/>
Bean for page:
public class ActionBean {
public static final String[] ACTIONS = new String[] {
Constant.ADMIN_SHOW_STATISTIC, Constant.ADMIN_ADD_COMPANY,
Constant.ADMIN_EDIT_COPANY
};
public static final Map actionTitles = new HashMap();
static {
actionTitles.put(Constant.ADMIN_ADD_COMPANY, "Add");
actionTitles.put(Constant.ADMIN_EDIT_COPANY, "Edit");
}
//set and get
private String currentAction = Constant.ADMIN_SHOW_STATISTIC;
//et and get
private String selectedAction = Constant.ADMIN_SHOW_STATISTIC;
public String[] getActions() {
return ACTIONS;
}
public String getActionTitle() {
return (String) actionTitles.get(getCurrentAction());
}
}
One of action:
public class ShowStatistic extends Block {
public int getTotalOrganizations() throws MiddleException {
return OrganizationHome.getOrganizationsNumber(null);
}
public int getTotalUsers() {
return 0;
}
public void renderBody(IMarkupWriter iMarkupWriter, IRequestCycle iRequestCycle) {
System.out.println("***********************************");
super.renderBody(iMarkupWriter, iRequestCycle);
}
}
Html:
<span jwcid="$content$">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Total registered organization: <span jwcid="@Insert" \
value="ognl:totalOrganizations"/></td> </tr>
<tr>
<td><img src="/images/z.gif" width="1" height="10"/></td>
</tr>
<tr>
<td>Total users: <span jwcid="@Insert" value="ognl:totalUsers"/></td>
</tr>
</table>
</span>
Spec:
<component-specification \
class="com.clearview.feedback.web.component.admin.ShowStatistic" allow-body="yes" \
allow-informal-parameters="no"> <description>show statistic component</description>
</component-specification>
but action block component hasn't been rendered. I see that renderBody
method is invoked, but i don't get any output html from this
component.
Where am i wrong ?
Thank's
--
Best regards,
Max mailto:darkit@mail.ru
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic