Hi Thiago

I wasn't sure where I should post, sorry :)


So, now, in the correct mailing list, with the code :)


on my tml I have:

<select class="input" t:id="keySets" t:type="ck/BeanSelect"
t:list="listaKeySets" t:zone="result" t:value="keyset"
 t:labelField="literal:contextmark" t:valueField="literal:keysetid"
t:blankLabel="Seleccione" t:required="true"
 t:blankOption="literal:AUTO">
</select>

<div t:type="zone" t:id="result" id="result" class="section result"
t:inPlace="true">

...

</div>

on the java side, I have:

public Object onValueChangedFromKeySets(Object sel2) {

this.setSelectedTypes(new HashSet<String>());
 if (sel2 == null) {
this.eid = null;
this.keyset = null;
 } else {
Keyset ks = (Keyset) sel2;
this.eid = ks.getElement().getEid();
 this.keyset = ks;
}
return result.getBody();
 }


This code uses the BeanSelect from chenillekit.
When the session is OK, the encoder is not null. It only becomes null when
the session has expired (eg timeout) and the user tries to change the
selected value.



Abraço :)
Paulo Ricardo



---------- Forwarded message ----------
From: Thiago H. de Paula Figueiredo <thiag...@gmail.com>
Date: Tue, Jan 17, 2012 at 11:35 AM
Subject: Re: Select throws NullPointerException
To: Tapestry development <d...@tapestry.apache.org>, Paulo Ricardo Ribeiro <
paulo.rica...@gmail.com>


On Tue, 17 Jan 2012 08:47:11 -0200, Paulo Ricardo Ribeiro <
paulo.rica...@gmail.com> wrote:

 Hello,
>

Bão? :)


 I'm using tapestry 5.3.1.
>
> Using a select with the zone parameter, if the session timeout has been
> reached and the user changed the selected value, I was getting a
> NullPointerException, so, I've downloaded the source, and looked at the
> Select.java (tapestry-core) and noticed that the "this.encoder" on the
> following method, was null:
>  protected Object toValue(String submittedValue)
>    {
>        return InternalUtils.isBlank(**submittedValue) ? null :
> this.encoder.toValue(**submittedValue);
>    }
>

You seem to be providing a null value to the encode parameter, which would
be an error. As always, please post the code, otherwise we can't know
what's really going on.

By the way, please post in the users mailing list first before posting in
dev, as you didn't know yet if it was an user or Tapestry error. ;)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

Reply via email to