You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gricker <ri...@gmail.com> on 2012/08/09 20:46:57 UTC

ActivationRequestParameter question


In the java code  I have :

@Property
 @ActivationRequestParameter
private Date startDate;

In the .tml file I have:
<t:datefield t:id="startDate"  />

In url I will see something like:
http://localhost:8080/ccccc/tttt/startDate=Thu%20Aug%2009%2000:00:00%20EDT%202012

If I reload the page I will get 
org.apache.tapestry5.ioc.internal.OperationException: Could not find a
coercion from type java.lang.String to type java.util.Date.

If I change "Date" to string and adjust the .tml accordingly it works. Most
of the examples I have seen using @ActivationRequestParameter are with
Strings.

what I am doing wrong?

Thanks,

Greg




--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-question-tp5715201.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: ActivationRequestParameter question

Posted by gricker <ri...@gmail.com>.
I created  a new TypeCoercer and it works fine.

Thanks,

Greg



--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-question-tp5715201p5715233.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: ActivationRequestParameter question

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 10 Aug 2012 15:43:48 -0300, Howard Lewis Ship <hl...@gmail.com>  
wrote:

> That looks like another bug to me; for anything that goes into a URL
> (as path or query parameter) the code should be using a ValueEncoder.

By the way, sometimes I miss having separate encoders for fields and URLs.  
What is good for fields may be ugly for URLs. Of course, this value  
encoder for URLs could use the regular ValueEncoder as a fallback when no  
specific one for the type is found.

-- 
Thiago H. de Paula Figueiredo

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


Re: ActivationRequestParameter question

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Fri, Aug 10, 2012 at 7:58 AM, Thiago H de Paula Figueiredo
<th...@gmail.com> wrote:
> On Fri, 10 Aug 2012 10:36:21 -0300, gricker <ri...@gmail.com> wrote:
>
>> I tried creating my own ValueEncoder but it seems like the error is
>> occurring before my code is called.
>
>
> I guess because the annotation handler uses TypeCoercer, not ValueEncoder
> for that.

That looks like another bug to me; for anything that goes into a URL
(as path or query parameter) the code should be using a ValueEncoder.

>
> --
> Thiago H. de Paula Figueiredo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: ActivationRequestParameter question

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 10 Aug 2012 10:36:21 -0300, gricker <ri...@gmail.com> wrote:

> I tried creating my own ValueEncoder but it seems like the error is
> occurring before my code is called.

I guess because the annotation handler uses TypeCoercer, not ValueEncoder  
for that.

-- 
Thiago H. de Paula Figueiredo

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


Re: ActivationRequestParameter question

Posted by gricker <ri...@gmail.com>.
I tried creating my own ValueEncoder but it seems like the error is
occurring before my code is called. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-question-tp5715201p5715222.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: ActivationRequestParameter question

Posted by Howard Lewis Ship <hl...@gmail.com>.
Seems like a missing feature; Tapestry should have a built-in
ValueEncoder for the Date type, to encode a Date into a more
reasonable string, and decode it back when converting the parameter
back into a field value.

On Thu, Aug 9, 2012 at 11:46 AM, gricker <ri...@gmail.com> wrote:
>
>
> In the java code  I have :
>
> @Property
>  @ActivationRequestParameter
> private Date startDate;
>
> In the .tml file I have:
> <t:datefield t:id="startDate"  />
>
> In url I will see something like:
> http://localhost:8080/ccccc/tttt/startDate=Thu%20Aug%2009%2000:00:00%20EDT%202012
>
> If I reload the page I will get
> org.apache.tapestry5.ioc.internal.OperationException: Could not find a
> coercion from type java.lang.String to type java.util.Date.
>
> If I change "Date" to string and adjust the .tml accordingly it works. Most
> of the examples I have seen using @ActivationRequestParameter are with
> Strings.
>
> what I am doing wrong?
>
> Thanks,
>
> Greg
>
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/ActivationRequestParameter-question-tp5715201.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
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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