You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Firas A." <ta...@idigna.com> on 2006/07/04 10:48:48 UTC
ClassCastException when using intValidator
Hello,
I get ClassCastException (org.apache.tapestry.valid.IntValidator) when
trying to validate a field. Below is the code I'm using.
Page class:
@Bean
public abstract ValidationDelegate getValidationDelegate();
Page spec:
<component id="AddToCartForm" type="Form">
...
<binding name="delegate" value="beans.validationDelegate" />
</component>
<component id="QuantityField" type="TextField">
<binding name="displayName" value="message:Quantity" />
<binding name="value" value="ognl:quantity" /> <!-- this property is int -->
<binding name="translator" value="translator:number" />
<binding name="validators" value="validator:int, required, maximum=5" />
</component>
Thnaks for your time!
</Firas>
Re: Generic application wide formats
Posted by Murray Collingwood <mu...@focus-computing.com.au>.
As you say... not pretty.
mc
On 17 Jul 2006 at 14:59, Shing Hing Man wrote:
> It is not very pretty. You could try the following.
>
> <component id="dateField" type="Insert">
> <binding name="value" value="myclass.mydate"/>
>
> <binding name="format">
> ognl:new
> java.text.SimpleDateFormat(getMessages().getMessage('format_date'))
> </binding>
>
> </component>
>
> Shing
> --- Murray Collingwood <mu...@focus-computing.com.au>
> wrote:
>
> > Hi all
> >
> > I'm a little new to Tapestry so I may be missing
> > something, happy for anybody to point me in
> > the right direction. I'm currently running Tapestry
> > 4.0.2
> >
> > I want to standardise my date format for the entire
> > application to dd/MM/yyyy. I decided that
> > the best place to do this while allowing for
> > internationalisation is to add it to my
> > app.properties
> > file. I added a few other formats while I was
> > there, so I had something like the following:
> >
> > # Generic formats
> > format_date=dd/MM/yyyy
> > format_time=HH:mm
> > format_pct0=##0%
> > format_pct2=##0.##%
> > format_currency=$#,###,##0.00
> >
> > Then I found that in order to display a date in this
> > format I was writing 7 lines of java code for
> > each page where a date was displayed (most of
> > them)...along with 1 more line in the .page
> > file for each date to be displayed.
> >
> > When I wanted to edit a date again using this format
> > I had 4 lines per page and 1 line per
> > field.
> >
> > This only provides the most basic of editing (I
> > haven't allowed for any error processing yet)
> > and while the number of lines is not large it did
> > seem to me that there were different methods
> > being employed to format the date for display and
> > others for edit and validation.
> >
> > As I began, I may have missed something but it does
> > seem a little messy at the moment.
> > Does anybody have a better method of achieving this
> > generic formating?
> >
> > Wouldn't it be nice if....I could specify formats in
> > my message catalogue and then simply
> > apply them to my components with a single line of
> > code? eg
> >
> > a) displaying a date value:
> >
> > <component id="dateField" type="Insert">
> > <binding name="value" value="myclass.mydate"/>
> > <binding name="format"
> > value="message:format_date"/>
> > </component>
> >
> > b) editing a date value:
> >
> > <component id="dateField" type="DatePicker">
> > <binding name="displayName"
> > value="message:mydate_label"/>
> > <binding name="value"
> > value="myclass.mydate"/>
> > <binding name="format"
> > value="message:format_date"/>
> > <binding name="validators"
> > value="validators:required"/>
> > </component>
> >
> >
> > Is this possible?
> >
> >
> > FOCUS Computing - web design
> > Mob: 0415 24 26 24
> > murray@focus-computing.com.au
> > http://www.focus-computing.com.au
> >
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.1.394 / Virus Database: 268.10.1/389 -
> > Release Date: 14/07/2006
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> >
> >
>
>
> Home page :
> http://uk.geocities.com/matmsh/index.html
>
>
>
>
>
> ___________________________________________________________
> All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
> http://uk.docs.yahoo.com/nowyoucan.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
FOCUS Computing - web design
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 14/07/2006
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: Re: Generic application wide formats
Posted by Murray Collingwood <mu...@focus-computing.com.au>.
What you have suggested is in fact what I am already doing for the date entry / update. I'm
also having to use a special method in my .java file to retrieve the format whenever I want to
display a date in this format.
My problem is that this is a significant amount of coding required on each page for something
that should be generic across my app. Do you agree?
Cheers
mc
On 17 Jul 2006 at 16:21, Kristian Marinkovic wrote:
> this could help:
> http://www.nabble.com/Dynamic-translators-tf1229928.html#a3255867
>
> define your formatter as a bean and define the pattern using
> message:date_pattern
>
> greetings,
> kris
>
>
>
> Shing Hing Man
> <matmsh@yahoo.com
> > An
> Tapestry users
> 17.07.2006 15:59 <us...@tapestry.apache.org>
> Kopie
>
> Bitte antworten Thema
> an Re: Generic application wide
> "Tapestry users" formats
> <users@tapestry.a
> pache.org>
>
>
>
>
>
>
>
>
> It is not very pretty. You could try the following.
>
> <component id="dateField" type="Insert">
> <binding name="value" value="myclass.mydate"/>
>
> <binding name="format">
> ognl:new
> java.text.SimpleDateFormat(getMessages().getMessage('format_date'))
> </binding>
>
> </component>
>
> Shing
> --- Murray Collingwood <mu...@focus-computing.com.au>
> wrote:
>
> > Hi all
> >
> > I'm a little new to Tapestry so I may be missing
> > something, happy for anybody to point me in
> > the right direction. I'm currently running Tapestry
> > 4.0.2
> >
> > I want to standardise my date format for the entire
> > application to dd/MM/yyyy. I decided that
> > the best place to do this while allowing for
> > internationalisation is to add it to my
> > app.properties
> > file. I added a few other formats while I was
> > there, so I had something like the following:
> >
> > # Generic formats
> > format_date=dd/MM/yyyy
> > format_time=HH:mm
> > format_pct0=##0%
> > format_pct2=##0.##%
> > format_currency=$#,###,##0.00
> >
> > Then I found that in order to display a date in this
> > format I was writing 7 lines of java code for
> > each page where a date was displayed (most of
> > them)...along with 1 more line in the .page
> > file for each date to be displayed.
> >
> > When I wanted to edit a date again using this format
> > I had 4 lines per page and 1 line per
> > field.
> >
> > This only provides the most basic of editing (I
> > haven't allowed for any error processing yet)
> > and while the number of lines is not large it did
> > seem to me that there were different methods
> > being employed to format the date for display and
> > others for edit and validation.
> >
> > As I began, I may have missed something but it does
> > seem a little messy at the moment.
> > Does anybody have a better method of achieving this
> > generic formating?
> >
> > Wouldn't it be nice if....I could specify formats in
> > my message catalogue and then simply
> > apply them to my components with a single line of
> > code? eg
> >
> > a) displaying a date value:
> >
> > <component id="dateField" type="Insert">
> > <binding name="value" value="myclass.mydate"/>
> > <binding name="format"
> > value="message:format_date"/>
> > </component>
> >
> > b) editing a date value:
> >
> > <component id="dateField" type="DatePicker">
> > <binding name="displayName"
> > value="message:mydate_label"/>
> > <binding name="value"
> > value="myclass.mydate"/>
> > <binding name="format"
> > value="message:format_date"/>
> > <binding name="validators"
> > value="validators:required"/>
> > </component>
> >
> >
> > Is this possible?
> >
> >
> > FOCUS Computing - web design
> > Mob: 0415 24 26 24
> > murray@focus-computing.com.au
> > http://www.focus-computing.com.au
> >
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.1.394 / Virus Database: 268.10.1/389 -
> > Release Date: 14/07/2006
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> >
> >
>
>
> Home page :
> http://uk.geocities.com/matmsh/index.html
>
>
>
>
>
> ___________________________________________________________
> All new Yahoo! Mail "The new Interface is stunning in its simplicity and
> ease of use." - PC Magazine
> http://uk.docs.yahoo.com/nowyoucan.html
>
> ---------------------------------------------------------------------
> 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
>
FOCUS Computing - web design
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date: 17/07/2006
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: Re: Generic application wide formats
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
this could help:
http://www.nabble.com/Dynamic-translators-tf1229928.html#a3255867
define your formatter as a bean and define the pattern using
message:date_pattern
greetings,
kris
Shing Hing Man
<matmsh@yahoo.com
> An
Tapestry users
17.07.2006 15:59 <us...@tapestry.apache.org>
Kopie
Bitte antworten Thema
an Re: Generic application wide
"Tapestry users" formats
<users@tapestry.a
pache.org>
It is not very pretty. You could try the following.
<component id="dateField" type="Insert">
<binding name="value" value="myclass.mydate"/>
<binding name="format">
ognl:new
java.text.SimpleDateFormat(getMessages().getMessage('format_date'))
</binding>
</component>
Shing
--- Murray Collingwood <mu...@focus-computing.com.au>
wrote:
> Hi all
>
> I'm a little new to Tapestry so I may be missing
> something, happy for anybody to point me in
> the right direction. I'm currently running Tapestry
> 4.0.2
>
> I want to standardise my date format for the entire
> application to dd/MM/yyyy. I decided that
> the best place to do this while allowing for
> internationalisation is to add it to my
> app.properties
> file. I added a few other formats while I was
> there, so I had something like the following:
>
> # Generic formats
> format_date=dd/MM/yyyy
> format_time=HH:mm
> format_pct0=##0%
> format_pct2=##0.##%
> format_currency=$#,###,##0.00
>
> Then I found that in order to display a date in this
> format I was writing 7 lines of java code for
> each page where a date was displayed (most of
> them)...along with 1 more line in the .page
> file for each date to be displayed.
>
> When I wanted to edit a date again using this format
> I had 4 lines per page and 1 line per
> field.
>
> This only provides the most basic of editing (I
> haven't allowed for any error processing yet)
> and while the number of lines is not large it did
> seem to me that there were different methods
> being employed to format the date for display and
> others for edit and validation.
>
> As I began, I may have missed something but it does
> seem a little messy at the moment.
> Does anybody have a better method of achieving this
> generic formating?
>
> Wouldn't it be nice if....I could specify formats in
> my message catalogue and then simply
> apply them to my components with a single line of
> code? eg
>
> a) displaying a date value:
>
> <component id="dateField" type="Insert">
> <binding name="value" value="myclass.mydate"/>
> <binding name="format"
> value="message:format_date"/>
> </component>
>
> b) editing a date value:
>
> <component id="dateField" type="DatePicker">
> <binding name="displayName"
> value="message:mydate_label"/>
> <binding name="value"
> value="myclass.mydate"/>
> <binding name="format"
> value="message:format_date"/>
> <binding name="validators"
> value="validators:required"/>
> </component>
>
>
> Is this possible?
>
>
> FOCUS Computing - web design
> Mob: 0415 24 26 24
> murray@focus-computing.com.au
> http://www.focus-computing.com.au
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.10.1/389 -
> Release Date: 14/07/2006
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
>
>
Home page :
http://uk.geocities.com/matmsh/index.html
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and
ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html
---------------------------------------------------------------------
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: Generic application wide formats
Posted by Shing Hing Man <ma...@yahoo.com>.
It is not very pretty. You could try the following.
<component id="dateField" type="Insert">
<binding name="value" value="myclass.mydate"/>
<binding name="format">
ognl:new
java.text.SimpleDateFormat(getMessages().getMessage('format_date'))
</binding>
</component>
Shing
--- Murray Collingwood <mu...@focus-computing.com.au>
wrote:
> Hi all
>
> I'm a little new to Tapestry so I may be missing
> something, happy for anybody to point me in
> the right direction. I'm currently running Tapestry
> 4.0.2
>
> I want to standardise my date format for the entire
> application to dd/MM/yyyy. I decided that
> the best place to do this while allowing for
> internationalisation is to add it to my
> app.properties
> file. I added a few other formats while I was
> there, so I had something like the following:
>
> # Generic formats
> format_date=dd/MM/yyyy
> format_time=HH:mm
> format_pct0=##0%
> format_pct2=##0.##%
> format_currency=$#,###,##0.00
>
> Then I found that in order to display a date in this
> format I was writing 7 lines of java code for
> each page where a date was displayed (most of
> them)...along with 1 more line in the .page
> file for each date to be displayed.
>
> When I wanted to edit a date again using this format
> I had 4 lines per page and 1 line per
> field.
>
> This only provides the most basic of editing (I
> haven't allowed for any error processing yet)
> and while the number of lines is not large it did
> seem to me that there were different methods
> being employed to format the date for display and
> others for edit and validation.
>
> As I began, I may have missed something but it does
> seem a little messy at the moment.
> Does anybody have a better method of achieving this
> generic formating?
>
> Wouldn't it be nice if....I could specify formats in
> my message catalogue and then simply
> apply them to my components with a single line of
> code? eg
>
> a) displaying a date value:
>
> <component id="dateField" type="Insert">
> <binding name="value" value="myclass.mydate"/>
> <binding name="format"
> value="message:format_date"/>
> </component>
>
> b) editing a date value:
>
> <component id="dateField" type="DatePicker">
> <binding name="displayName"
> value="message:mydate_label"/>
> <binding name="value"
> value="myclass.mydate"/>
> <binding name="format"
> value="message:format_date"/>
> <binding name="validators"
> value="validators:required"/>
> </component>
>
>
> Is this possible?
>
>
> FOCUS Computing - web design
> Mob: 0415 24 26 24
> murray@focus-computing.com.au
> http://www.focus-computing.com.au
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.10.1/389 -
> Release Date: 14/07/2006
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
>
>
Home page :
http://uk.geocities.com/matmsh/index.html
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Generic application wide formats
Posted by Murray Collingwood <mu...@focus-computing.com.au>.
Hi all
I'm a little new to Tapestry so I may be missing something, happy for anybody to point me in
the right direction. I'm currently running Tapestry 4.0.2
I want to standardise my date format for the entire application to dd/MM/yyyy. I decided that
the best place to do this while allowing for internationalisation is to add it to my app.properties
file. I added a few other formats while I was there, so I had something like the following:
# Generic formats
format_date=dd/MM/yyyy
format_time=HH:mm
format_pct0=##0%
format_pct2=##0.##%
format_currency=$#,###,##0.00
Then I found that in order to display a date in this format I was writing 7 lines of java code for
each page where a date was displayed (most of them)...along with 1 more line in the .page
file for each date to be displayed.
When I wanted to edit a date again using this format I had 4 lines per page and 1 line per
field.
This only provides the most basic of editing (I haven't allowed for any error processing yet)
and while the number of lines is not large it did seem to me that there were different methods
being employed to format the date for display and others for edit and validation.
As I began, I may have missed something but it does seem a little messy at the moment.
Does anybody have a better method of achieving this generic formating?
Wouldn't it be nice if....I could specify formats in my message catalogue and then simply
apply them to my components with a single line of code? eg
a) displaying a date value:
<component id="dateField" type="Insert">
<binding name="value" value="myclass.mydate"/>
<binding name="format" value="message:format_date"/>
</component>
b) editing a date value:
<component id="dateField" type="DatePicker">
<binding name="displayName" value="message:mydate_label"/>
<binding name="value" value="myclass.mydate"/>
<binding name="format" value="message:format_date"/>
<binding name="validators" value="validators:required"/>
</component>
Is this possible?
FOCUS Computing - web design
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 14/07/2006
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: ClassCastException when using intValidator
Posted by D&J Gredler <dj...@gmail.com>.
Slightly related... does anyone know why the IntValidator wasn't ported to
the new (4.x) validation framework?
On 7/5/06, Firas A. <ta...@idigna.com> wrote:
>
> Your suggestion helped me get pass the exception. I had to do other
> adjustments too, like this:
> <binding name="validators" value="validators:required, max" />
>
> Note: removed the 'int' and changed 'maximum' to max.
>
> Thanks Shing!
>
> </Firas>
>
RE: ClassCastException when using intValidator
Posted by "Firas A." <ta...@idigna.com>.
Your suggestion helped me get pass the exception. I had to do other
adjustments too, like this:
<binding name="validators" value="validators:required, max" />
Note: removed the 'int' and changed 'maximum' to max.
Thanks Shing!
</Firas>
-----Original Message-----
From: Shing Hing Man [ <ma...@yahoo.com> mailto:matmsh@yahoo.com]
Sent: den 4 juli 2006 12:39
To: Tapestry users
Subject: Re: ClassCastException when using intValidator
><binding name="validators" value="validator:int, required, maximum=5"
>/>
Please try replacing validator by validators.
validator is for ValidField.
Shing
Re: ClassCastException when using intValidator
Posted by Shing Hing Man <ma...@yahoo.com>.
><binding name="validators" value="validator:int,
> required, maximum=5" />
Please try replacing validator by validators.
validator is for ValidField.
Shing
--- "Firas A." <ta...@idigna.com> wrote:
> Hello,
>
> I get ClassCastException
> (org.apache.tapestry.valid.IntValidator) when
> trying to validate a field. Below is the code I'm
> using.
>
> Page class:
> @Bean
> public abstract ValidationDelegate
> getValidationDelegate();
>
> Page spec:
> <component id="AddToCartForm" type="Form">
> ...
> <binding name="delegate"
> value="beans.validationDelegate" />
> </component>
>
> <component id="QuantityField" type="TextField">
> <binding name="displayName" value="message:Quantity"
> />
> <binding name="value" value="ognl:quantity" /> <!--
> this property is int -->
> <binding name="translator" value="translator:number"
> />
> <binding name="validators" value="validator:int,
> required, maximum=5" />
> </component>
>
> Thnaks for your time!
>
> </Firas>
>
Home page :
http://uk.geocities.com/matmsh/index.html
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org