You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Malik, Usman" <UM...@RGIS.com> on 2008/05/06 20:22:07 UTC

Custom error messages for Tomahawk inputCalendar

I am using Tomahawk 1.1.6 with JDeveloper 11g-3 and running into a
slight problem customizing the inputCalendar control's conversion/error
messages. I have successfully followed the i18n type approach (example @
http://www.jsf-faq.com/faqs/faces-messages.html, #126) to get custom
error messages for simple controls like input boxes. However, I tried to
use the same approach with the inputCalendar but it continues to give me
a default conversion/error message instead of my own.

Here are the steps I have taken so far ...

1. Created & registered a custom class that implements the Converter
class with its getAsObject and getAsString methods.
2. Added a converter attribute for the calendar control in my JSP page,
pointing to the above custom class.
3. Created & registered a message bundle file (per i18n approach) and
added custom conversion/error messages for the calendar.

The first 2 steps are included because I also wanted to limit what
formats the user can enter in the date field. From what I understand,
these 2 steps will determine if the conversion succeeds or fails, but to
actually change the error message that is displayed, I have to correctly
implement the 3rd step. Since I can see the first 2 steps executing
properly during debugging, my guess is that the problem is in the 3rd
step ... more specifically I think maybe I am not putting the correct
key/value pair in message bundle file? I have listed the contents of my
message bundle file below ... I know that most of these entries are
probably not correct but I was just shooting in the dark and trying out
all variations that I thought might work!

#--- message bundle file: start ---

javax.faces.convert.ConverterException.CONVERSION=Java Conversion
message1
javax.faces.convert.ConverterException.CONVERSION_detail=Java Conversion
message1

javax.faces.convert.DateTimeConverter.CONVERSION=Java Conversion
message2
javax.faces.convert.DateTimeConverter.CONVERSION_detail=Java Conversion
message2

org.apache.myfaces.calendar.CONVERSION=Apache Conversion message1
org.apache.myfaces.calendar.CONVERSION_detail=Apache Conversion message1

org.apache.myfaces.custom.calendar.CONVERSION=Apache Conversion message2
org.apache.myfaces.custom.calendar.CONVERSION_detail=Apache Conversion
message2

org.apache.myfaces.custom.calendar.HtmlInputCalendar.CONVERSION=Apache
Conversion message3
org.apache.myfaces.custom.calendar.HtmlInputCalendar.CONVERSION_detail=A
pache Conversion message3

#--- message bundle file: stop ---

A similar question was posted in this list in June 2007 but its answer
did not resolve my issue. If somebody knows the correct key/value pair
to use in my situation, or thinks that something else is the issue,
please let me know. Thanks!

Regards,
Usman



NOTE: The information in this email may be confidential and legally
privileged. If you are not the intended recipient, you must not
read, use or disseminate the information; please advise the sender
immediately by reply email and delete this message and any
attachments without retaining a copy. Although this email and any
attachments are believed to be free of any virus or other defect
that may affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by RGIS, LLC for
any loss or damage arising in any way from its use.

Re: Custom error messages for Tomahawk inputCalendar

Posted by HelgeT <he...@tesgaard.dk>.
Hi,

It works for me if i add the following two lines to my custom message
bundle:
#Note! this message overrides the default message in:
myfaces-impl-1.2.0.jar!\javax\faces\Messages.properties. This only works if
the line "org.apache.myfaces.Date.INVALID=Validation Error" is also present
in the bundle  
org.apache.myfaces.Date.INVALID=Validation Error  
org.apache.myfaces.Date.INVALID_detail=The given value ({0}) is not a
correct date. Remember specifying the time. E.g.: 13:00

So the conclusion must be that the component looks for the key
"org.apache.myfaces.Date.INVALID" in the message bundle before switching to
the default message bundle

Regards
Helge



Malik, Usman wrote:
> 
> I am using Tomahawk 1.1.6 with JDeveloper 11g-3 and running into a
> slight problem customizing the inputCalendar control's conversion/error
> messages. I have successfully followed the i18n type approach (example @
> http://www.jsf-faq.com/faqs/faces-messages.html, #126) to get custom
> error messages for simple controls like input boxes. However, I tried to
> use the same approach with the inputCalendar but it continues to give me
> a default conversion/error message instead of my own.
> 
> Here are the steps I have taken so far ...
> 
> 1. Created & registered a custom class that implements the Converter
> class with its getAsObject and getAsString methods.
> 2. Added a converter attribute for the calendar control in my JSP page,
> pointing to the above custom class.
> 3. Created & registered a message bundle file (per i18n approach) and
> added custom conversion/error messages for the calendar.
> 
> The first 2 steps are included because I also wanted to limit what
> formats the user can enter in the date field. From what I understand,
> these 2 steps will determine if the conversion succeeds or fails, but to
> actually change the error message that is displayed, I have to correctly
> implement the 3rd step. Since I can see the first 2 steps executing
> properly during debugging, my guess is that the problem is in the 3rd
> step ... more specifically I think maybe I am not putting the correct
> key/value pair in message bundle file? I have listed the contents of my
> message bundle file below ... I know that most of these entries are
> probably not correct but I was just shooting in the dark and trying out
> all variations that I thought might work!
> 
> #--- message bundle file: start ---
> 
> javax.faces.convert.ConverterException.CONVERSION=Java Conversion
> message1
> javax.faces.convert.ConverterException.CONVERSION_detail=Java Conversion
> message1
> 
> javax.faces.convert.DateTimeConverter.CONVERSION=Java Conversion
> message2
> javax.faces.convert.DateTimeConverter.CONVERSION_detail=Java Conversion
> message2
> 
> org.apache.myfaces.calendar.CONVERSION=Apache Conversion message1
> org.apache.myfaces.calendar.CONVERSION_detail=Apache Conversion message1
> 
> org.apache.myfaces.custom.calendar.CONVERSION=Apache Conversion message2
> org.apache.myfaces.custom.calendar.CONVERSION_detail=Apache Conversion
> message2
> 
> org.apache.myfaces.custom.calendar.HtmlInputCalendar.CONVERSION=Apache
> Conversion message3
> org.apache.myfaces.custom.calendar.HtmlInputCalendar.CONVERSION_detail=A
> pache Conversion message3
> 
> #--- message bundle file: stop ---
> 
> A similar question was posted in this list in June 2007 but its answer
> did not resolve my issue. If somebody knows the correct key/value pair
> to use in my situation, or thinks that something else is the issue,
> please let me know. Thanks!
> 
> Regards,
> Usman
> 
> 
> 
> NOTE: The information in this email may be confidential and legally
> privileged. If you are not the intended recipient, you must not
> read, use or disseminate the information; please advise the sender
> immediately by reply email and delete this message and any
> attachments without retaining a copy. Although this email and any
> attachments are believed to be free of any virus or other defect
> that may affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by RGIS, LLC for
> any loss or damage arising in any way from its use.
> 

-- 
View this message in context: http://www.nabble.com/Using-links-inside-outputText-tag-tp17062596p17364163.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: Custom error messages for Tomahawk inputCalendar

Posted by "Malik, Usman" <UM...@RGIS.com>.
Does anybody have any ideas on what might be going in my situation?

________________________________

From: Malik, Usman [mailto:UMalik@RGIS.com] 
Sent: Tuesday, May 06, 2008 2:22 PM
To: MyFaces Discussion
Subject: Custom error messages for Tomahawk inputCalendar



I am using Tomahawk 1.1.6 with JDeveloper 11g-3 and running into a
slight problem customizing the inputCalendar control's conversion/error
messages. I have successfully followed the i18n type approach (example @
http://www.jsf-faq.com/faqs/faces-messages.html
<http://www.jsf-faq.com/faqs/faces-messages.html> , #126) to get custom
error messages for simple controls like input boxes. However, I tried to
use the same approach with the inputCalendar but it continues to give me
a default conversion/error message instead of my own.

Here are the steps I have taken so far ... 

1. Created & registered a custom class that implements the Converter
class with its getAsObject and getAsString methods.

2. Added a converter attribute for the calendar control in my JSP page,
pointing to the above custom class. 
3. Created & registered a message bundle file (per i18n approach) and
added custom conversion/error messages for the calendar.

The first 2 steps are included because I also wanted to limit what
formats the user can enter in the date field. From what I understand,
these 2 steps will determine if the conversion succeeds or fails, but to
actually change the error message that is displayed, I have to correctly
implement the 3rd step. Since I can see the first 2 steps executing
properly during debugging, my guess is that the problem is in the 3rd
step ... more specifically I think maybe I am not putting the correct
key/value pair in message bundle file? I have listed the contents of my
message bundle file below ... I know that most of these entries are
probably not correct but I was just shooting in the dark and trying out
all variations that I thought might work!

#--- message bundle file: start --- 

javax.faces.convert.ConverterException.CONVERSION=Java Conversion
message1 
javax.faces.convert.ConverterException.CONVERSION_detail=Java Conversion
message1 

javax.faces.convert.DateTimeConverter.CONVERSION=Java Conversion
message2 
javax.faces.convert.DateTimeConverter.CONVERSION_detail=Java Conversion
message2 

org.apache.myfaces.calendar.CONVERSION=Apache Conversion message1 
org.apache.myfaces.calendar.CONVERSION_detail=Apache Conversion message1


org.apache.myfaces.custom.calendar.CONVERSION=Apache Conversion message2

org.apache.myfaces.custom.calendar.CONVERSION_detail=Apache Conversion
message2 

org.apache.myfaces.custom.calendar.HtmlInputCalendar.CONVERSION=Apache
Conversion message3 
org.apache.myfaces.custom.calendar.HtmlInputCalendar.CONVERSION_detail=A
pache Conversion message3 

#--- message bundle file: stop --- 

A similar question was posted in this list in June 2007 but its answer
did not resolve my issue. If somebody knows the correct key/value pair
to use in my situation, or thinks that something else is the issue,
please let me know. Thanks!

Regards, 
Usman   



NOTE: The information in this email may be confidential and legally
privileged. If you are not the intended recipient, you must not
read, use or disseminate the information; please advise the sender
immediately by reply email and delete this message and any
attachments without retaining a copy. Although this email and any
attachments are believed to be free of any virus or other defect
that may affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by RGIS, LLC for
any loss or damage arising in any way from its use.