Avoiding f:convertDateTime/af:convertDateTime override

Hi,
According to http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3/state/content/navId.4/navSetId._/vtTopicFile.jsf_apps%7Cadfcreate%7Caf_aconvertdatetimetag~html/
ADF overrides the Date converter ID so calls to f:convertDateTime call af:convertDateTime instead. I want to undo this override because the ADF date/time converter throws up intrusive error popups if the item doesn't parse when all I really want is a tasteful error message displayed by the control. Stock JSF converters and validators do this, but ADF is forcing me to use its.
How can I do this?
Thanks

No. I'm using EJB3.0. I'm not sure what you mean by having a date format set at the entity object. How would I go about that?
I have a date format set in my selectInputDate, which works nicely, so when I select a date from the popup it will correctly enter say "01-JAN-07" into the box. But when I click submit, it gives me a date validation error, because it is validating against my locale (I think). I just need to know how to specify the date pattern to the validation routine. Do I need to write my own converter? This is my selectInputDate:
<af:selectInputDate value="#{bindings.dateRequired.inputValue}"
label="#{field_labels[\'HardwareRequest.dateRequired\']}"
required="#{bindings.dateRequired.mandatory}"
columns="#{bindings.dateRequired.displayWidth}"
binding="#{backing_app_smurf_HardwareRequestNew.inputText4}"
id="inputText4">
<af:validator binding="#{bindings.dateRequired.validator}"/>
<af:convertDateTime pattern="#{format.date}"/>
</af:selectInputDate>
Am I the only one that thinks using JDeveloper is like playing with Russian dolls?
R

Similar Messages

  • HashCode method execution

    Dear Members :
    I have custom hashCode method in conjunction with overriden equals method, in my program and have following doubts/observations :
    [1] In order to verify whether the hashCode method is executed, I put a println statement within method, but this doesn't output when the program is run.
    [2] The program is a simple equality testing of two dates and doesn't make use of any map. I want to know when and who gives (implicit ?) call to this hashCode method, when equals method is overriden, I mean the program flow.
    Since SUN suggests to override hashCode, whenever equals method is overriden, and my program is not making use of map, how and when the hashCode method gets called and if so why my test print is not executed ?
    Thanks in advance.
    Atanu

    uj_ wrote:
    jverd wrote:
    uj_ wrote:
    One way to graciously avoid the contract is to override hashCode and let it throw an exception (or assertion) stating "hashCode not implemented. This class is not intended for use in hash-based collections" or something.What would be the advantage of doing that over just taking the 5 minutes needed to implement it properly?Who are you to stipulate other people's design needs? Just because something takes just 5 minutes doesn't mean it's the right thing to do.
    You may want a class to have an equals relation based on content but you still may not want the class to be in a hash-based collection. The most compelling reason may be that it's not immutable.
    The equals/hashCode contract is mostly a Sun promise regarding "standard" classes. Everybody else design their classes the way they see fit.Calm down UJ. I have as much right to offer my opinion as you have to offer yours. I just asked a simple question.
    The requirement that a class not be used in a hash-based collection would be silly. It's up to the user of the class how to store instances. If the fields that go into determining hashCode are mutable, then that should be a documentation issue. There are good reasons to keep hashCode and equals in sync. The only reason not to do so would be the time it takes to write the code. Since that time is trivial for any well-designed class, it's an extremely weak reason.

  • Validating Dates in JSF using convertDateTime an overriding message format

    Have seen a way to validate dates with this kind of code snippet:
             <h:inputText id="departDate"
                value="#{flight.departDate}">
               <f:convertDateTime pattern="dd/MM/yy"/>
             </h:inputText>
             <h:message for="departDate"/>-----
    This results in an ugly default error message when things go wrong like so:
    j_id_jsp_1447383442_1:departDate: 'a' could not be understood as a date. Example: 28/02/08
    Is there a way I can override this by using some sort of message placeholder, so I get a message like:
    *"Depart Date 's' is invalid"*
    So placeholder message would be *"[0} {1} is invalid"*, where parm *0* would be *"Depart Date"* and parm *1* would be value *"#{flight.departDate}"*.
    I know you can resort to a full blown custom converter class, but I was wondering if I could put a message formatted with placeholders directly into the code snippet.
    Is this feasible?

    After several more iterations of testing, I discovered the problem is actually due to using the trinidad rendering kit. Part of my migration to 1.2 involved experimenting with the use of the trinidad components. I thought I had removed all the trinidad stuff from my application during testing of this date problem, but I discovered that I had left the following in:
    web-app library:    trinidad-1.2.10
    faces-config.xml entry:
        <default-render-kit-id>
                org.apache.myfaces.trinidad.core
        </default-render-kit-id>once these items were removed, the application worked as expected. So it looks like the problem is with the trinidad rendering kit/library.
    Edited by: emprice26 on Aug 11, 2009 6:02 PM

  • F:convertDateTime - how to define two valid date formats?

    I have an input field that accepts a date. There are two valid date formats allowed: yyyyMMdd & yyyyMMM
    I am currently doing this ...
    <h:inputText ...>
    <f:convertDateTime pattern="yyyyMMdd" />
    <f:convertDateTime pattern="yyyyMMM" />
    </h:inputText>
    ... but only the second date format is being accepted as valid.
    How can I specify two valid date formats for the input?
    Thanks,
    rh
    Edited by: user13328234 on Oct 27, 2010 12:47 PM

    user13328234 wrote:
    Thanks for the suggestion. I was actually using it for validation, so I implemented a custom validator so I'm good now.
    But, for some reason I expected it to work with two converters specified, and I'm a little disappointed it didn't work.
    Thanks again,
    rhExpecting = assuming. Its getting old and annoying now, but it remains a very bad idea.
    The fact of the matter is that you have a very specific need. There is only one way to tailor to specific needs in a generic API: allow to override default behavior. The other option is to create a bloated API that tries to incorporate so many bells and whistles that it becomes unusable. So in my opinion, JSF is designed exactly the way it is supposed to be in this respect.

  • How to add af:convertDateTime pattern="dd/MM/yyyy"/ tag in java

    Hi,
    I am adding a date component in my screen from my backing bean. I want to set date pattern for this af:inputDate component, so how do I add
    <af:convertDateTime pattern="dd/MM/yyyy"/> to my inputDate component in my backing bean. Or is there any other way in which I can set date format on my inputDate component.
    Regards,
    Vipin V B

    try this<br><br>
    Format(DateValue(yourDateString), "dd/MM/yy")
    <br><br>
    the MM must be upper case

  • Problems with f:convertDateTime and f:convertNumber

    Hi,
    My code is as follows.
         <h:outputText value=" #{orderBean.order.dateTimeOfOrder}" style= "font-size: 1.0em">
         <f:convertDateTime type="date" pattern="dd.MM.yyyy HH:mm"  />
         <h:outputText value=" #{orderBean.order.totalCostIncGST}" style= "font-size: 1.0em">
                     <f:convertNumber pattern="###0,00%"/>But it ignores the conversion completely. The dateTimeOfOrder is Java Date object. I tried giving different dateStyle, but no use.
    Any help appreciated.

    Thans for your reply.
    Pls ignore my previous message.
    This is my code
    <h:outputText value="#{order.date}">
    <f:convertDateTime dateStyle="short"/>
    </h:outputText>In order.date, I have a method to get the today's date using new Date(). When I dont use <f:convertDateTime dateStyle="short"/> in the above code, it displays the today's date and time correctly. But when I use the line <f:convertDateTime dateStyle="short"/>, it displays the time by adding 2 hours to the current time.
    I want to display the order.date (which is today's date and current time as in the following format. That's what I'm trying to do. Also it ignores the AM/PM indicator.
    2/2/09 6:20 PM
    (dont' need the seconds)

  • ConvertDateTime: problems with year conversion

    In my application I want the user to enter a date into an input field following the pattern "d.MM.yyyy". Here's my code (where myDate is of type java.util.Date):
    <h:inputText value="#{contentHandler.myDate}">
    <f:convertDateTime type="date" pattern="d.MM.yyyy" />
    </h:inputText>
    Everything works fine until someone enters a date with a two-digit year, for example "12.08.05". This input is converted to "12.08.0005" but I'd rather have it converted to "12.08.2005". Any ideas or suggestions?

    use d.MM.yy
    It can accept 12.08.2005 n 12.08.05
    and the year it will be 2005 for both

  • Extending af:convertDateTime (and binding property)

    Hello,
    I have an <af:convertDateTime> in the page:
    <af:inputDate id="IDATE" value="#{row.bindings.Date.inputValue}">
        <af:convertDateTime pattern="#{bindings.TABLE.hints.Date.format}"/>
    </af:inputDate>I want to customize the converter, but there is no "binding" property as with other components.
    From our tests, the method "format" in the bean pointed by "pattern" seems to return a null String.
    By googling we discovered that the class behind the converter is oracle.adf.rich.DateTime.
    My question are:
    1. Is it true that, in the case of a null String returned by "format", the converter acts internally by checking the current locale and providing a coherent format for the locale?
    2. Why is not oracle.adf.rich.DateTime availble publicly and why is there no binding property?
    3. What is the best approach to extend the converter?
    Thanks.

    Thanks for your answer, but I'll try to be more precise about my problem.
    What we would really like to know is how that af:convertDateTime works internally and extend it's behaviour by custom providing a bean to "pattern" which behaves the following way, depending on the situation:
    1. either return the same pattern String the converter would use internally by default
    2. or return a custom String
    but again, why isn't oracle.adf.rich.Date available?

  • ConvertDateTime problem in MyFaces

    Hi All.
    I have used the <f:convertDateTime> to covert the date in input text field and its always displays one day back if time part of date is 00:00:00.
    While i update the date in DB i converted the date using the DateFormat, to get the date field only. Because i am using DB2 and it accepts dates only with the time part of date is 00:00:00.
    So when it comes to display ,it displays one day back . your swift response on this is highly apprceiated.
    regards
    Sivakumar,

    For JSF 1.2 based frameworks you need el-api.jar and el-ri.jar.

  • af:convertDateTime pattern="#{nls.datepattern}"/ not working

    Hi friends;
    Some pages selectInputdate items <af:convertDateTime pattern="#{nls.datepattern}"/> property is working but some pages it isnt working.
    I want to use datepattern same in all pages like dd/MM/yyyy but some pages date fields value came to bean yyyy-MM-dd format, in some pages dd/MM/yyyy.
    Many bean I use
    Date dateilk =
    new SimpleDateFormat("dd/MM/yyyy").parse(dateilktarih);
    String formatilktarih =
    new SimpleDateFormat("dd/MM/yyyy").format(dateilk);
    but this code not effective.
    What can I do about date patterns????
    I use jdeveloper 10.1.3.1 with jheadstart 10.1.3.1 Thanks ....

    I cannot reproduce this issue. May be this is caused by custom code that you have added? If you create a new project from scratch, without custom code, does it work correctly then?
    Steven Davelaar,
    JHeadstart team.

  • "Conversion error occurred." at f:convertDateTime pattern="dd/MMM/yyyy" /

    This is my jsf code.
    <h:inputText id="myDatePicker" value="#{backingBean.user.birthDate}">
    <f:convertDateTime pattern="dd/MMM/yyyy" />
                        <hx:inputHelperDatePicker />
         <hx:inputHelperAssist promptCharacter="x"/>                    <hx:validateDateTimeRange maximum="#{now}" />
                   </h:inputText>
    When I click the button to call action backing bean, I get the "Conversion error occurred".
    I've already instantiate the birthDate in constructor of User class.
    I just wonder this tag apply for Date only? Because the type of birthDate attribute is Timestamp.
    Thank you for you reply and any suggestion.

    I use the date picker of WebSphere product.
    <%@ taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    I try to remove value from this but it still not work.
    Can anyone help me or need me to give more information ?
    Thank you!!

  • ConvertDateTime with selectOneMenu

    I'm attempting to populate a drop down box with date values. I'd like to use the convertDateTime feature but I'm having trouble. I have a method in a bean MyBean which is called to populate the selection items. I also have an instance variable that is a Date type that I would like to be set when the user makes a selection from the drop down. My assumption was that I could use the convert feature to go back and forth, parse and format between String and Date types.
    @ManagedBean
    public class MyBean {
         private Date date;
         public void setDate( String value ) {
              System.out.println("Setting date as String value is " + value);
         public void setDate(Date value) {
              System.out.println("Setting date as " + value.toString());
              this.date = value;
         public Date getDate() {
              if ( date == null ) return new Date();
              else return date;
         public List<SelectItem> getDateList() {
              Calendar calendar = Calendar.getInstance();
              List<SelectItem> options = new ArrayList<SelectItem>();
              for( int i = 0; i < 4; i++ ) {
                   calendar.set(Calendar.MONTH, i);
                   options.add( new SelectItem( calendar.getTime(), calendar.getTime().toString()));
              return options;
         public String getSomething() {
              System.out.println("Get Something - Date starts as " + this.date);
    <h:selectOneMenu id="selectionDay" value="#{myBean.date}" required="true" requiredMessage="* Required">
         <f:selectItems value="#{myBean.dateList}" />
         <f:convertDateTime type="date" dateStyle="long" />
         <f:ajax render="@form" execute="#{myBean.something}" />
    </h:selectOneMenu>I see that the drop down is populated with four values of dates and that they appear in the standard toString format. But when I make a selection I see a validation error - j_idt41:selectionDay: Validation Error: Value is not valid
    Can anyone advise as to what I should use the converter for or am I just to rely upon SimpleDateFormat in my bean? Thanks for any help.
    ETA -
    Just found a related discussion here...
    http://www.thatsjava.com/java-web-tier-apis/18216/
    I tried to use the code provided but I'm still seeing the validation error on the JSF page. The solution offered isn't working for me. I tried using the exact code offered there.
    Edited by: nantucket on Jun 20, 2011 10:36 AM

    Based upon the feedback I found here..
    http://seamframework.org/Community/ValueIsNotValidWhenUsingSselectItemsAndHselectOneMenu
    I managed to resolve this by including type="both" with the conversion tag.

  • Facing issue regarding convertDateTime

    hi friends,
    i am using jdeveloper 11.1.1.6.0 . i am using convertDateTime for calender . it is accepting MM/DD/YYYY this format only(ex 3/18/2013) but if user is putting something like this MAR-18-2013 , it is throwing an error invalid date format. but the problem is that system not allowing the user to navigate to other screen. every time it's throwing same the error .
    thank you.

    Did you visit any of these?
    Using af:calendar component in adf
    http://docs.oracle.com/cd/E23943_01/web.1111/b31973/af_calendar.htm
    http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_calendar.html
    http://www.oracle.com/technetwork/developer-tools/jdev/calendar-091799.html
    Alternatively you can try this.
    <af:inputDate value="#{bindings.MyDateField.inputValue}"
    label="#{bindings.MyDateField.hints.label}"
    required="#{bindings.MyDateField.hints.mandatory}"
    shortDesc="#{bindings.MyDateField.hints.tooltip}"
    id="id1">
    <f:validator binding="#{bindings.MyDateField.validator}"/>
    <af:convertDateTime pattern="#{bindings.MyDateField.format}"/>
    </af:inputDate>
    MyDateField is an attribute in entity based view object in model/BC project.

  • ConvertDateTime pattern

    Hai friends...
    I am using <f:convertDateTime pattern/>  to format the date ...
    <h:outputText value="#{employee.startDate}">
         <f:convertDateTime pattern="*MM-dd-yyyy*" />
    </h:outputText>
    When i am trying to display the values it diplays : *07-02-2008*
    But value in the database is : *07-03-2008*
    How to format date in jsf ....
    Please help me..
    shashi
    Edited by: shashikumar on Jul 21, 2008 1:59 AM

    I am setting the date from the java program.. employee.startDate(new Date())
    In database it saves value in this format : 2008-07-02
    While reterving form database it gets.. this format :2008-07-02
    But whil printing it prints ... in this format : 2008-07-01
    that is one day less than the data from database....
    help me..
    shashi

  • Af:ConvertDateTime how to control the year to start with 19xx or 20xx

    Hi,
    I am facing an issue. I have a af:inputDate component with af:convertDateTime with pattern MM/dd/yyyy and secondary pattern= MMddyyyy.
    The issue is when the date is entered as 101147 the date gets converted to 10/11/2047 but the user wants it to be converted to 10/11/1947
    Th requirement is if the two digits entered for year(yy) is less than the last two digits current year(2011) the year should be 20yy else it should be 19yy
    example: if entered date is 052104 it should get converted to 05/21/2004
    if entered date is 062198 it should get converted to06/21/1998
    if the entered date is 07132009 it should be 07/13/2009 (no conversion here)
    if the entered date is 07131986 it should be 07/13/1986 (no conversion here)
    Kindly reply

    This one is a tricky problem - a side-effect of JSF doing a lot of things automatically is that sometimes it does too much.
    I don't have a great solution, but here's a couple of ideas:
    (1) Try using multiple <h:form>s on your page (not nested one inside the other, but separate). Data will only get updated in the form that contains the button that got pressed.
    (2) Use an intermediate model layer, and discard updates as appropriate.
    Neither of these are beautiful solutions - the second is way ugly - but they might help. Long-range, I'd love to see something like "subforms" supported in JSF that can provide finer grained control over what gets processed (validations, model pushes, etc.) and what doesn't without resorting to the blunt hammer of multiple HTML forms.
    I'm a little confused about "the model is updated with the value of the components whenever the form is submitted, and regardless of whether the value of the components has changed or not.", because JSF is checking the old value and using ".equals()" to see if its changed. Note, however, that it's not caching the old value across the request, but simply going back to the model on the subsequent request, which may (or may not) explain the behavior you're seeing.
    -- Adam Winer (EG member)

Maybe you are looking for

  • ...Fade to black

    Hi, anybody else having problems adding transitions. I'm working on a show reel at the moment and when I try to add a fade or mix it tells me the clip length it too short, which is fine. Only the clips aren't to short. The message seems to be telling

  • CompileCommand for Weblogic 6.0

              My JSP pages are failing Weblogic 6.0 with the error           Couldn't find init param: compileCommand           Any ideas why?           

  • Why does my connection seem throttled at times?

    I have an unlimited data plan. I've noticed that it is hard to get a 3g/4gLTE connection after a period of using my 3g or 4gLTE connection. Is there a way to stop the annoying throttling? Thanks!

  • Extensions for the savvy designer

    Hi guys, Im looking at buying some extensions to help expediate my web application development and ive got 2 quick questions - 1.) Are there any extensions that pro developers consider essential in helping them quickly develop sites, if so which comp

  • Error Creating Oracle Text Index giving DRG-50857: oracle error in drvxtab

    Hello, I'm trying to create an Oracle text indexd as follows: Create index tt.idx_emp on tt.emp(emp_name) Indextype is ctxsys.context Parameters(' Datastore idx_emp_dst Filter idx_emp_fil Section group idx_emp_sgp Lexer idx_emp_lex Wordlist idx_emp_w