9 Replies Latest reply on May 8, 2007 11:38 PM by tony.herstell1

    @Future being ignored

    tony.herstell1

      I am not having the @Future being honoured.
      Is this a valid annotation and is there anything wrong with this:

       @NotNull
       @Future
       @Basic
       @Temporal(TemporalType.DATE)
       public Date getStartDate() {
       return startDate;
       }
      




        • 1. Re: @Future being ignored
          tony.herstell1

          @CreditCardNumber is also not even known in Seam.

          Are all the Hibernate validations etc. supported?

          Can we drop in a new jar to catch up?

          http://www.hibernate.org/hib_docs/validator/reference/en/html/validator-defineconstraints.html

          • 2. Re: @Future being ignored
            toni

            It's probably because you did set the input field's required attribute to true.

            You need required="true" in your jsf view component too.

            • 3. Re: @Future being ignored
              toni

              I meant: It's probably because you did NOT set the input field's required attribute to true.

              • 4. Re: @Future being ignored
                tony.herstell1

                This is my .xhtml

                <h:inputText id="launchDate" value="#{launchDateStepController.workingObject.startDate}" required="true" title="#{messages.hint_launch_date}">
                 <s:convertDateTime pattern="dd/MM/yyyy" />
                </h:inputText>
                <s:selectDate for="launchDate" startYear="2007" dateFormat="dd/MM/yyyy">
                 <h:graphicImage url="#{basePath}/images/datepicker.gif" style="margin-left:5px;cursor:pointer" />
                </s:selectDate>
                


                Have i missed summat?



                • 5. Re: @Future being ignored
                  delphi'sghost

                  Do you have an <s:validate> tag around your control, or an <s:validateAll> tag around multiple controls?

                  From the reference guide :

                  The only thing here that is specific to Seam is the <s:validateAll> tag. This JSF component tells JSF to validate
                  all the contained input fields against the Hibernate Validator annotations specified on the entity bean.


                  • 6. Re: @Future being ignored
                    tony.herstell1

                    Yes, actually that's correct I did disable my Validate all (I forgot!!).

                    HOWEVER if I put it back on I get:

                    SEVERE: Error Rendering View[/pages/advertisingCampaign/wizard.xhtml]
                    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum
                    at org.jboss.seam.ui.EnumConverter.getAsString(EnumConverter.java:28)
                    at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:544)
                    at org.apache.myfaces.shared_impl.renderkit.html.HtmlRadioRendererBase.encodeEnd(HtmlRadioRendererBase.java:93)
                    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
                    at org.jboss.seam.ui.JSF.renderChild(JSF.java:180)
                    at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
                    at org.jboss.seam.ui.UIFragment.encodeChildren(UIFragment.java:29)
                    at org.jboss.seam.ui.JSF.renderChild(JSF.java:174)

                    I have a "mother of all pages" wizard..
                    it has a side bar that has 8 steps on it.
                    I allow the user to go to any step at any time and jump in between them.
                    This means I have end up pulling in over 27 .xhtml files for the page!! and it has two nested templates to boot!

                    Anyhow,

                    This bit works fine without validateAll

                    <td align="left">
                     <table>
                     <tr>
                     <td>
                     <h:selectOneRadio id="advertType" required="true"
                     value="#{adTypeStepController.workingObject.type}" layout="pageDirection">
                     <s:selectItems value="#{adTypeStepController.workingObject.advertTypes}"
                     var="advertType" label="#{messages[advertType.label]}" />
                     <s:convertEnum />
                     </h:selectOneRadio>
                     </td>
                     </tr>
                     </table>
                    </td>
                    


                    and fails with validateAll turned on.

                    :/

                    same code works elsewhere... so its a nasty bug hunt.

                    Sorry for wasting your time.


                    • 7. Re: @Future being ignored
                      tony.herstell1

                      The AdvertType is retreived from this

                       public enum AdvertType {
                       Lineage ("label_ad_type_lineage"),
                       BannerAd ("label_ad_type_banner_ad");
                       private final String label;
                       AdvertType(String label) {
                       this.label = label;
                       }
                       public String getLabel() { return label; }
                       }
                      


                      • 8. Re: @Future being ignored
                        delphi'sghost

                        I haven't really gotten into JSF selectors and enums so I don't have a clue.

                        Ye gads man, 27 pages in one. How about using a nice page flow and individual pages and save yourself some sanity (maybe)


                        • 9. Re: @Future being ignored
                          tony.herstell1

                          I wish....

                          I still have lots of other "simple" pages, but this was the mother of all pages... what really slows it down is that all the .xhtml, even the stuff shielded by s:fragment still gets elaborated... so had to set storage to server !!!

                          It really DID start as a simple page!

                          NOTE TO SELF... just cus you can "include" in facelets... don't!


                          Workround for above problem was to add validate to EVERY field apart from the field that causes the problem!

                          I will come back to it at some point... but deadlines are tight!