You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Huhn <am...@hslt-online.com> on 2008/04/11 10:15:46 UTC

[T5] enum/BeanEditForm issue

Hello,

I have what I thought was a fairly straightforward piece of code, but I
can't seem to get it working.

I have an enum defined as:

	public enum AgeRange {
		K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
	}

I reference this enum in one of my POJOs:

	public class CoOp extends Entity {
	    protected AgeRange ageRangeSrvd;

	    public AgeRange getAgeRangeSrvd()
		{ return ageRangeSrvd;    }

	    public void setAgeRangeSrvd( AgeRange ageRangeeSrvd ) 
		{ this.ageRangeSrvd = ageRangeSrvd; }
	}

And then I have a BeanEditForm to edit the POJO.

The BeanEditForm correctly displays a drop-down with the correct list of
values, but if I edit the drop-down and submit the form, it doesn't seem
to pick up the changed value.  It picks up null each time.

Any ideas?

If it's at all relevant, I used Gavin King's GenericEnumUserType to get
Hibernate to persist the enum (http://www.hibernate.org/272.html).  But
I can't see how my Hibernate configuration would affect Tapestry's
ability to encode/decode the enum value.

Thanks,
Andy


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] enum/BeanEditForm issue

Posted by Josh Canfield <jo...@thedailytube.com>.
:) If you don't have unused parameters warnings turned on in your IDE,
now would be the time!


On Fri, Apr 11, 2008 at 9:41 AM, Andy Huhn <am...@hrtc.net> wrote:
>
> Oh, brother.  If that's it, take my keyboard away from me.  :o)
>
> I'll check as soon as I get on tonight.  If that's it, sorry for troubling
> the list.
>
> Andy
>
> On Fri, 11 Apr 2008 11:20:43 -0400, "Peter Beshai" <pe...@gmail.com>
> wrote:
>
> > Unless there's a typo in your post:
> >
> > public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >                { this.ageRangeSrvd = ageRangeSrvd; }
> >
> > The parameter's name is 'ageRangeeSrvd'  not ageRangeSrvd, so you're not
> > setting it.
> >
> > e.g. You're doing:
> > private String _name;
> >
> > public void setName(String name)
> > {
> >     this._name = _name;
> > }
> >
> > Peter Beshai
> >
> > On Fri, Apr 11, 2008 at 10:06 AM, Filip S. Adamsen <fs...@fsadev.com>
> wrote:
> >
> >> That's odd.
> >>
> >> What does your page class/template look like?
> >>
> >> -Filip
> >>
> >>
> >> On 2008-04-11 10:15, Andy Huhn wrote:
> >>
> >> > Hello,
> >> >
> >> > I have what I thought was a fairly straightforward piece of code, but
> > I
> >> > can't seem to get it working.
> >> >
> >> > I have an enum defined as:
> >> >
> >> >        public enum AgeRange {
> >> >                K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
> >> >        }
> >> >
> >> > I reference this enum in one of my POJOs:
> >> >
> >> >        public class CoOp extends Entity {
> >> >            protected AgeRange ageRangeSrvd;
> >> >
> >> >            public AgeRange getAgeRangeSrvd()
> >> >                { return ageRangeSrvd;    }
> >> >
> >> >            public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >> >        { this.ageRangeSrvd = ageRangeSrvd; }
> >> >        }
> >> >
> >> > And then I have a BeanEditForm to edit the POJO.
> >> >
> >> > The BeanEditForm correctly displays a drop-down with the correct list
> > of
> >> > values, but if I edit the drop-down and submit the form, it doesn't
> > seem
> >> > to pick up the changed value.  It picks up null each time.
> >> >
> >> > Any ideas?
> >> >
> >> > If it's at all relevant, I used Gavin King's GenericEnumUserType to
> > get
> >> > Hibernate to persist the enum (http://www.hibernate.org/272.html).
> > But
> >> > I can't see how my Hibernate configuration would affect Tapestry's
> >> > ability to encode/decode the enum value.
> >> >
> >> > Thanks,
> >> > Andy
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] enum/BeanEditForm issue

Posted by Andy Huhn <am...@hslt-online.com>.
Well, fortunately and unfortunately, that was it.

Thanks again, Peter, for finding my mistake.  And sorry again for
cluttering up the list with my poor proofreading skills.

Andy

On Fri, 2008-04-11 at 12:41 -0400, Andy Huhn wrote:
> Oh, brother.  If that's it, take my keyboard away from me.  :o)
> 
> I'll check as soon as I get on tonight.  If that's it, sorry for troubling
> the list.
> 
> Andy
> 
> On Fri, 11 Apr 2008 11:20:43 -0400, "Peter Beshai" <pe...@gmail.com>
> wrote:
> > Unless there's a typo in your post:
> > 
> > public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >                { this.ageRangeSrvd = ageRangeSrvd; }
> > 
> > The parameter's name is 'ageRangeeSrvd'  not ageRangeSrvd, so you're not
> > setting it.
> > 
> > e.g. You're doing:
> > private String _name;
> > 
> > public void setName(String name)
> > {
> >     this._name = _name;
> > }
> > 
> > Peter Beshai
> > 
> > On Fri, Apr 11, 2008 at 10:06 AM, Filip S. Adamsen <fs...@fsadev.com>
> wrote:
> > 
> >> That's odd.
> >>
> >> What does your page class/template look like?
> >>
> >> -Filip
> >>
> >>
> >> On 2008-04-11 10:15, Andy Huhn wrote:
> >>
> >> > Hello,
> >> >
> >> > I have what I thought was a fairly straightforward piece of code, but
> > I
> >> > can't seem to get it working.
> >> >
> >> > I have an enum defined as:
> >> >
> >> >        public enum AgeRange {
> >> >                K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
> >> >        }
> >> >
> >> > I reference this enum in one of my POJOs:
> >> >
> >> >        public class CoOp extends Entity {
> >> >            protected AgeRange ageRangeSrvd;
> >> >
> >> >            public AgeRange getAgeRangeSrvd()
> >> >                { return ageRangeSrvd;    }
> >> >
> >> >            public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >> >        { this.ageRangeSrvd = ageRangeSrvd; }
> >> >        }
> >> >
> >> > And then I have a BeanEditForm to edit the POJO.
> >> >
> >> > The BeanEditForm correctly displays a drop-down with the correct list
> > of
> >> > values, but if I edit the drop-down and submit the form, it doesn't
> > seem
> >> > to pick up the changed value.  It picks up null each time.
> >> >
> >> > Any ideas?
> >> >
> >> > If it's at all relevant, I used Gavin King's GenericEnumUserType to
> > get
> >> > Hibernate to persist the enum (http://www.hibernate.org/272.html). 
> > But
> >> > I can't see how my Hibernate configuration would affect Tapestry's
> >> > ability to encode/decode the enum value.
> >> >
> >> > Thanks,
> >> > Andy
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] enum/BeanEditForm issue

Posted by Andy Huhn <am...@hrtc.net>.
Oh, brother.  If that's it, take my keyboard away from me.  :o)

I'll check as soon as I get on tonight.  If that's it, sorry for troubling
the list.

Andy

On Fri, 11 Apr 2008 11:20:43 -0400, "Peter Beshai" <pe...@gmail.com>
wrote:
> Unless there's a typo in your post:
> 
> public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
>                { this.ageRangeSrvd = ageRangeSrvd; }
> 
> The parameter's name is 'ageRangeeSrvd'  not ageRangeSrvd, so you're not
> setting it.
> 
> e.g. You're doing:
> private String _name;
> 
> public void setName(String name)
> {
>     this._name = _name;
> }
> 
> Peter Beshai
> 
> On Fri, Apr 11, 2008 at 10:06 AM, Filip S. Adamsen <fs...@fsadev.com>
wrote:
> 
>> That's odd.
>>
>> What does your page class/template look like?
>>
>> -Filip
>>
>>
>> On 2008-04-11 10:15, Andy Huhn wrote:
>>
>> > Hello,
>> >
>> > I have what I thought was a fairly straightforward piece of code, but
> I
>> > can't seem to get it working.
>> >
>> > I have an enum defined as:
>> >
>> >        public enum AgeRange {
>> >                K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
>> >        }
>> >
>> > I reference this enum in one of my POJOs:
>> >
>> >        public class CoOp extends Entity {
>> >            protected AgeRange ageRangeSrvd;
>> >
>> >            public AgeRange getAgeRangeSrvd()
>> >                { return ageRangeSrvd;    }
>> >
>> >            public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
>> >        { this.ageRangeSrvd = ageRangeSrvd; }
>> >        }
>> >
>> > And then I have a BeanEditForm to edit the POJO.
>> >
>> > The BeanEditForm correctly displays a drop-down with the correct list
> of
>> > values, but if I edit the drop-down and submit the form, it doesn't
> seem
>> > to pick up the changed value.  It picks up null each time.
>> >
>> > Any ideas?
>> >
>> > If it's at all relevant, I used Gavin King's GenericEnumUserType to
> get
>> > Hibernate to persist the enum (http://www.hibernate.org/272.html). 
> But
>> > I can't see how my Hibernate configuration would affect Tapestry's
>> > ability to encode/decode the enum value.
>> >
>> > Thanks,
>> > Andy
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] enum/BeanEditForm issue

Posted by Peter Beshai <pe...@gmail.com>.
Unless there's a typo in your post:

public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
               { this.ageRangeSrvd = ageRangeSrvd; }

The parameter's name is 'ageRangeeSrvd'  not ageRangeSrvd, so you're not
setting it.

e.g. You're doing:
private String _name;

public void setName(String name)
{
    this._name = _name;
}

Peter Beshai

On Fri, Apr 11, 2008 at 10:06 AM, Filip S. Adamsen <fs...@fsadev.com> wrote:

> That's odd.
>
> What does your page class/template look like?
>
> -Filip
>
>
> On 2008-04-11 10:15, Andy Huhn wrote:
>
> > Hello,
> >
> > I have what I thought was a fairly straightforward piece of code, but I
> > can't seem to get it working.
> >
> > I have an enum defined as:
> >
> >        public enum AgeRange {
> >                K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
> >        }
> >
> > I reference this enum in one of my POJOs:
> >
> >        public class CoOp extends Entity {
> >            protected AgeRange ageRangeSrvd;
> >
> >            public AgeRange getAgeRangeSrvd()
> >                { return ageRangeSrvd;    }
> >
> >            public void setAgeRangeSrvd( AgeRange ageRangeeSrvd )
> >        { this.ageRangeSrvd = ageRangeSrvd; }
> >        }
> >
> > And then I have a BeanEditForm to edit the POJO.
> >
> > The BeanEditForm correctly displays a drop-down with the correct list of
> > values, but if I edit the drop-down and submit the form, it doesn't seem
> > to pick up the changed value.  It picks up null each time.
> >
> > Any ideas?
> >
> > If it's at all relevant, I used Gavin King's GenericEnumUserType to get
> > Hibernate to persist the enum (http://www.hibernate.org/272.html).  But
> > I can't see how my Hibernate configuration would affect Tapestry's
> > ability to encode/decode the enum value.
> >
> > Thanks,
> > Andy
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5] enum/BeanEditForm issue

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
That's odd.

What does your page class/template look like?

-Filip

On 2008-04-11 10:15, Andy Huhn wrote:
> Hello,
> 
> I have what I thought was a fairly straightforward piece of code, but I
> can't seem to get it working.
> 
> I have an enum defined as:
> 
> 	public enum AgeRange {
> 		K6, MiddleSchool, HighSchool, K12, MiddleHighSchool
> 	}
> 
> I reference this enum in one of my POJOs:
> 
> 	public class CoOp extends Entity {
> 	    protected AgeRange ageRangeSrvd;
> 
> 	    public AgeRange getAgeRangeSrvd()
> 		{ return ageRangeSrvd;    }
> 
> 	    public void setAgeRangeSrvd( AgeRange ageRangeeSrvd ) 
> 		{ this.ageRangeSrvd = ageRangeSrvd; }
> 	}
> 
> And then I have a BeanEditForm to edit the POJO.
> 
> The BeanEditForm correctly displays a drop-down with the correct list of
> values, but if I edit the drop-down and submit the form, it doesn't seem
> to pick up the changed value.  It picks up null each time.
> 
> Any ideas?
> 
> If it's at all relevant, I used Gavin King's GenericEnumUserType to get
> Hibernate to persist the enum (http://www.hibernate.org/272.html).  But
> I can't see how my Hibernate configuration would affect Tapestry's
> ability to encode/decode the enum value.
> 
> Thanks,
> Andy
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org