You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sommeralex <al...@gmail.com> on 2012/08/26 12:22:54 UTC
@parameter Boolean not working?
Hello,
I have a component, which is taking a userId and (should) take a boolean. My
component is implemented and already working with the userID - but not with
the boolean. checking subscribed == true or checking with subscribed != null
is never true. (so the boolean is always null)
the component:
@Parameter
private Boolean subscribed;
@Parameter
private Long userId;
@Inject
private GroupService groupService;
@Property
private Group curGroup;
@Property(write = false)
private List<Group> groups;
public void setupRender() {
if (userId != null) {
if (subscribed == true){
this.groups = groupService.findBySubscriberId(userId);
}else{
this.groups = groupService.findByOwnerId(userId);
}
} else {
this.groups = groupService.getAllGroups();
}
}
the call from my tml page:
<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<t:group.listGroups userId="userId" subscribed="subscribed" />
</t:layout>
the java page:
public class ListSubscribedGroups {
@Property(write=false)
private Long userId;
@Property(write=false)
private Boolean subscribed = true;
public void onActivate(Long userId){
this.userId = userId;
}
}
--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-Boolean-not-working-tp5715807.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: @parameter Boolean not working?
Posted by sommeralex <al...@gmail.com>.
thanx, could solve it, had nothing to do with the @parameter - was a bug in
my code.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-Boolean-not-working-tp5715807p5715808.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: @parameter Boolean not working?
Posted by Bob Harner <bo...@gmail.com>.
Set subscribe = true in your page class' setupRender method, not in its
declaration.
On Aug 26, 2012 6:23 AM, "sommeralex" <al...@gmail.com> wrote:
> Hello,
>
> I have a component, which is taking a userId and (should) take a boolean.
> My
> component is implemented and already working with the userID - but not with
> the boolean. checking subscribed == true or checking with subscribed !=
> null
> is never true. (so the boolean is always null)
>
> the component:
>
> @Parameter
> private Boolean subscribed;
> @Parameter
> private Long userId;
> @Inject
> private GroupService groupService;
>
> @Property
> private Group curGroup;
> @Property(write = false)
> private List<Group> groups;
>
> public void setupRender() {
> if (userId != null) {
> if (subscribed == true){
> this.groups =
> groupService.findBySubscriberId(userId);
> }else{
> this.groups =
> groupService.findByOwnerId(userId);
> }
> } else {
> this.groups = groupService.getAllGroups();
> }
> }
>
> the call from my tml page:
>
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>
> <t:group.listGroups userId="userId" subscribed="subscribed" />
>
> </t:layout>
>
> the java page:
>
>
> public class ListSubscribedGroups {
>
> @Property(write=false)
> private Long userId;
>
> @Property(write=false)
> private Boolean subscribed = true;
>
> public void onActivate(Long userId){
> this.userId = userId;
> }
>
> }
>
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/parameter-Boolean-not-working-tp5715807.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>