JSF 1.0 validation : f:validateLength minimum="13"/

The following example was taken from the book "core JAVA SERVER FACES" by David Geary and Cay Horstmann.
<h:inputText id="card" value="#{payment.card}">
<f:validateLength minimum="13"/>
</h:inputText>
(This is on page 217)
Below this example is a NOTE stating that JSF 1.0 does not explicitly support client-side validation. All validation occurs on the server...
My question: Does this mean that the <f:validateLength minimum="13"/> does NOTHING in JSF 1.0 or just that that validation will not happen right away but it WILL eventually be executed on the server side?
I'm wondering because it seems to be having no effect on my page.
Thanks much.

Thanks for your response...
I did it with JavaScript and it works fine...
Thanks again
Phil

Similar Messages

  • JSF and Database Validation

    I would like to perform validation that seems to be a little involved with JSF and I was curious as to the best practice. I need to perform validation on a summary screen where the user can highlight a row and click an Edit button that takes them to another screen. However, I need to query the database when they click edit to check to see if the item they selected is able to be edited (these rules are part of our business logic). What is the best way to perform database-side validation using JSF? If I query the DB in the action event of the command button, how can I then inform the JSP if the item fails validation and then display a message from messages. properties? Keep in mind that an item can fail validation for a number of reasons, so the message could be different each time the validation is performed.

    You have two choices:
    a) Don't let the user edit the line, by don't allowing the he to have an action on that row.
    b) If you have a global command, then perform the validation on the action method.
    In the a) case, you only have to put some flags to tell the page to not put the command on the row. This flags came with the query or whatsoever that you like more.
    In the b) case you can perform the validation by calling the business logic, and in case of failiure, you can add a message to the FacesMessage tellong the user the reason of not allowing he to edit.
    Example (on the bean):
    FacesContext.getCurrentInstance().addMessage(componentId,
    new FacesMessage(FacesMessage.SEVERITY_ERROR,
    errorMessage,
    errorMessage));
    The componentId can be null or of not, the id of a component on the page.

  • ADF Email Validation using Regular Expression

    Hi,
    Wanted to add Email Validation VO search.
    It is working if i put
    <af:validateRegExp pattern="[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}"
                                             messageDetailNoMatch="The value {1} is not a valid email address:"/>However this requires email id to be entered in Capital Letters.
    Tried with below option is not working.
                   <af:inputText value="#{bindings.xxEmail.inputValue}" label="Email"
                                          required="#{bindings.xxEmail.hints.mandatory}"
                                          columns="#{bindings.xxEmail.hints.displayWidth}"
                                          maximumLength="#{bindings.xxEmail.hints.precision}"
                                          shortDesc="#{bindings.xxEmail.hints.tooltip}" id="it5">
                                <f:validator binding="#{bindings.xxEmail.validator}"/>
                                <f:validateLength minimum="6"/>             
                                <af:validateRegExp pattern="[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"
                                             messageDetailNoMatch="The value {1} is not a valid email address:"/>
                            </af:inputText>I got above info from
    ADF Email Validation using Regular Expression
    User don't enter email id Without @ .
    Kindly suggest pattern to achive this.
    Thanks,
    jit
    Edited by: appsjit on Jan 25, 2013 7:08 PM

    The RegEx to check EMail after RFC2822
    [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?There are still some missing parts in the check as not all suffix combinations are allowed, but this is pretty good.
    Timo

  • Problem with h:message and ajax

    Hello,
    I noticed a strange problem occurring with my richfaces application. It is as follows:
    I have a contact form with "real-time" validation of each field. When a valid submission of the form occurs, the form is reRendered and strangely, the first field shows a validation passed status even though it is empty.
    Here is my jsp:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rest="http://restfaces.dev.java.net"
         xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
    <body>
    <ui:composition template="/template.xhtml">
         <ui:define name="title">
              <title><h:outputText value="todo: accueil" /></title>
         </ui:define>
         <ui:define name="body">
              <a4j:outputPanel id="wrapper" layout="block" styleClass="wrapper">
                   <rest:link value="contactAction" hreflang="fr" lang="fr">
                        <f:param name="language" value="fr" />
                        <h:outputText value="#{msg['langue.francais.libelle']}" />
                   </rest:link>
                   <rest:link value="contactAction" hreflang="en" lang="en">
                        <f:param name="language" value="en" />
                        <h:outputText value="#{msg['langue.anglais.libelle']}" />
                   </rest:link>
                   <br />
                   <br />
                   <a4j:outputPanel rendered="#{contactView.envoiReussi}" ajaxRendered="true">
                        <h:outputText value="envoi reussi todo"/>
                   </a4j:outputPanel>
                   <a4j:form id="formulaireContact" reRender="wrapper">
                        <h:panelGrid columns="3" columnClasses="libellesColonne,champsColonne,validiteColonne">
                             <f:facet name="header">
                                  <a4j:outputPanel layout="block" styleClass="formulaireContactHeader">
                                       <h:outputText value="todo header" />
                                  </a4j:outputPanel>
                             </f:facet>
                             <h:outputText value="#{msg['message.from.email']}" />
                             <a4j:outputPanel id="fromEmail">
                                  <a4j:region id="fromEmailRegion">
                                       <h:inputText id="emailI" value="#{contactView.message.email}" required="true"
                                            requiredMessage="#{msg['message.valeurRequise.email']}" validatorMessage="#{msg['message.erreur.email']}" binding="#{contactView.bb.emailI}">
                                            <a4j:support  id="emailS" event="onblur" reRender="fromEmail, emailMP" ajaxSingle="true" actionListener="#{contactView.valider}" limitToList="true" ignoreDupResponses="true" />
                                            <f:validator validatorId="adresseEmailValidator" />
                                       </h:inputText>
                                       <a4j:status>
                                            <f:facet name="start">
                                                 <h:graphicImage value="#{img['ajax-loader']}" />
                                            </f:facet>
                                       </a4j:status>
                                  </a4j:region>
                             </a4j:outputPanel>
                             <a4j:outputPanel id="emailMP">
                                  <h:message for="emailI" infoClass="champValide" />
                             </a4j:outputPanel>
                             <h:outputText value="#{msg['message.from.nom']}" />
                             <a4j:outputPanel id="nom">
                                  <a4j:region id="nomRegion">
                                       <h:inputText id="nomI" value="#{contactView.message.nom}" required="true"
                                            requiredMessage="#{msg['message.valeurRequise.nom']}" validatorMessage="todo: nom non valide" binding="#{contactView.bb.nomI}">
                                            <a4j:support id="nomS" event="onblur" reRender="nom, nomMP" ajaxSingle="true" actionListener="#{contactView.valider}" limitToList="true" />
                                            <f:validateLength minimum="2" />
                                       </h:inputText>
                                       <a4j:status>
                                            <f:facet name="start">
                                                 <h:graphicImage value="#{img['ajax-loader']}" />
                                            </f:facet>
                                       </a4j:status>
                                  </a4j:region>
                             </a4j:outputPanel>
                             <a4j:outputPanel id="nomMP">
                                  <h:message for="nomI" infoClass="champValide" />
                             </a4j:outputPanel>
                             <h:outputText value="#{msg['message.sujet']}" />
                             <a4j:outputPanel id="sujet">
                                  <a4j:region id="sujetRegion">
                                       <h:inputText id="sujetI" value="#{contactView.message.sujetMessage}" required="true"
                                            requiredMessage="#{msg['message.valeurRequise.sujet']}" validatorMessage="#{msg['message.erreur.sujet']}" binding="#{contactView.bb.sujetI}">
                                            <a4j:support id="sujetS" event="onblur" reRender="sujet, sujetMP" ajaxSingle="true" actionListener="#{contactView.valider}" limitToList="true"/>
                                            <f:validateLength minimum="2" />
                                       </h:inputText>
                                       <a4j:status>
                                            <f:facet name="start">
                                                 <h:graphicImage value="#{img['ajax-loader']}" />
                                            </f:facet>
                                       </a4j:status>
                                  </a4j:region>
                             </a4j:outputPanel>
                             <a4j:outputPanel id="sujetMP">
                                  <h:message for="sujetI" infoClass="champValide" />
                             </a4j:outputPanel>
                             <h:outputText value="#{msg['message.corps']}" />
                             <a4j:outputPanel id="corps">
                                  <a4j:region>
                                       <h:inputTextarea id="corpsI" value="#{contactView.message.corpsMessage}" cols="20" rows="5" required="true"
                                            requiredMessage="#{msg['message.valeurRequise.corps']}" validatorMessage="#{msg['message.erreur.corps']}" binding="#{contactView.bb.corpsI}">
                                            <a4j:support id="corpsS" event="onblur" reRender="corps, corpsMP" ajaxSingle="true" actionListener="#{contactView.valider}" />
                                            <f:validateLength minimum="20" />
                                       </h:inputTextarea>
                                       <a4j:status>
                                            <f:facet name="start">
                                                 <h:graphicImage value="#{img['ajax-loader']}" />
                                            </f:facet>
                                       </a4j:status>
                                  </a4j:region>
                             </a4j:outputPanel>
                             <a4j:outputPanel id="corpsMP">
                                  <h:message for="corpsI" infoClass="champValide" style="vertical-align: top" />
                             </a4j:outputPanel>
                             <a4j:outputPanel/>
                             <a4j:outputPanel>
                                  <rich:paint2D id="captcha" width="#{contactView.captchaWidth}" height="#{contactView.captchaHeight}" format="jpeg"
                                       paint="#{contactView.paintCaptcha}">
                                       <f:attribute name="alt" value="todo" />
                                  </rich:paint2D>
                             </a4j:outputPanel>
                             <a4j:outputPanel />
                             <a4j:outputPanel>
                                  <h:outputText value="todo Text on Image:" />
                             </a4j:outputPanel>
                             <a4j:outputPanel id="secureText">
                                  <h:inputText id="secureTextI" value="#{contactView.secureText}" size="20" required="true" binding="#{contactView.bb.secureTextI}">
                                       <f:validator validatorId="captchaValidator" />
                                  </h:inputText>
                             </a4j:outputPanel>
                             <a4j:outputPanel id="secureTextMP">
                                  <h:message for="secureTextI" />
                             </a4j:outputPanel>
                             <f:facet name="footer">
                                  <a4j:outputPanel layout="block" styleClass="formulaireContactFooter">
                                       <a4j:commandButton value="#{msg['message.envoyer']}" action="#{contactView.envoyer}"/>
                                  </a4j:outputPanel>
                             </f:facet>
                        </h:panelGrid>
                   </a4j:form>
                   <a4j:outputPanel layout="block" styleClass="push" />
                   <a4j:log popup="false" level="ALL" style="width: 800px; height: 600px;"></a4j:log>
              </a4j:outputPanel>
         </ui:define>
    </ui:composition>
    </body>
    </html>Here is the managed bean method upon which submission is performed:
        public String envoyer() {
            log.debug("envoyer");
            service.envoyerMessage(this.message);
            try {
                service.envoyerSms(this.message);
            } catch (MalformedURLException ex) {
                log.debug(ex.fillInStackTrace());//todo
            } catch (IOException ex) {
                log.debug(ex.fillInStackTrace());//todo
            this.bb.setLocalValuesSet(false);
            this.bb.setSubmittedValues(null);
            this.bb.setValues("");
            this.envoiReussi = true;
            return null;
        }Can anyone tell me why the first h:message located within the following panel: (emailMP) displays this strange behavior?
    Thanks in advance,
    Julien.

    see subject line...

  • [BUG] af:validateLength breaks when only minimum length is specified

    Hi,
    here's a bug I just found using JDev 11.1.1.0.2.
    The following validated input field:
    <af:inputText id="inputName"
                  binding="#{backingBeanScope.MyBean.inputName}">
        <af:validateLength minimum="8"/>
    </af:inputText>using only a minimum value as threshold and no maximum, behaves erratically.
    When the entered value is shorter than 8 chars, it prints MessageDetailNotInRange instead of MessageDetailMinimum on the popup.
    In other words, what you get is "you need to enter a value with length between 8 and 0" instead of "longer than 8 chars" (not sure what the exact English text should be, but I guess you got the picture)
    Overriding the default MessageDetailMinimum string doesn't change behaviour, the component just picks the wrong string in the case you only give a minimum.
    Note that the other 2 cases (maximum-only and range) seem to work OK.
    Can anyone confirm this?
    RickyS

    Hi,
    no, I've not yet logged a SR for that (I can't file bugs, I have to open a SR and wait weeks before the guy opens a bug for me), was hoping for some confirmation...
    I was very surprised such a bug could exist in a production release, since it breaks 1/3 of af:validateLength's visible functionality and in fact I met it within my first 2 minutes of use of the component, so I just thought I'd ask if someone has ever met it before. Might be my machine, or me doing something stupid, or something.
    Not to sound harsh, but if this is confirmed then the question "is someone over at Oracle actually doing basic testing of ADF 11's components before labelling it production-ready?" comes to mind immediately, and is quite of concern for us.
    Paying money to Oracle to do beta-testing on behalf of Oracle ain't our thing, to be fully honest.
    The more we dig into ADF 11, the more we find bugs, bugs and bugs. And all the help we get is one-liners like "did you open a bug?" on this forum - assuming someone actually replies at all, half of my threads have 0 replies - or some guy on support which takes ages just to write down a couple lines with a precompiled answer to a Service Request ("there appears to be a bug in the component, will open a bug"), let alone opening the bug itself.
    regards,
    RickyS

  • JSF Validation failure causes input values disappear

    I am using a custom validator in my application by creating a class that implements javax.faces.validator.Validator. I use this validator for some input fields. When the validation fails the values that the user has entered are lost. Is their any way that we can keep these values? These input fields are in DataTable.
    - Sandeep.
    Edited by: sgatl2 on Mar 24, 2010 10:41 AM

    If you see the JSF lifecycle, the validation phase comes before the update values phase.
    So if your custome validator fails, the model will not change.
    I would suggest you try with client side validation without a page refresh/server call.

  • JSF keeps displaying old values after Validation Phase fails

    Hi all,
    I would like to ask some help in understanding a particular behaviour that JSF shows when Validation Phase fails.
    I'm using:
    - Tomcat 7.0.2
    - JSF 1.2_12
    - RichFaces 3.3.3
    Problem description.
    I wrote a form with 4 input fields: an inputText and 3 selectOneMenu. The inputText is required while the selectOneMenus don't require any validation.
    Attached to the first selectOneMenu (row 32), is an a4j:support tag so that, whenever the change event is fired, the list of items of the second
    and the third selectOneMenu (row 44 and 58) are correctly filled (note that the mandatory of the inputText is ignored thanks to the ajaxSingle attribute).
    In particular, after loading the two lists of items, the actionListener forces the value of the second and the third selectOneMenu to null.
    This mechanism seems to work fine until I submit the whole form without filling the input text: as expected, JSF validation fails but if I change the value of
    the first selectOneMenu again (causing a new submit), the page keeps displaying the values specified before JSF validation failed for the second and the third
    selectOneMenu (note that the actionListener is still called and the values of the second and the third selectOneMenu are still forced to null).
    Since I'm using a simple PhaseListener, I noticed the following: before JSF validation fails, every time I change the value of the first selectOneMenu, JSF life
    cycle always calls the get method for the second and the third selectOneMenu during the Render Response Phase. In this way, JSF is able to "see" that
    those values have been set to null during the Invoke Application Phase.
    After validation fails, JSF stops calling those getters when I change the value of the first selectOneMenu.
    I hope my explanation was clear enough, thanks a lot for your help.
    Regards,
    Nico
    Web Page
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich">
    <head>
      <title>Prove Rich</title>
    </head>
    <body>
      <h2>Prove Rich</h2>
      <f:view>
      <a4j:outputPanel ajaxRendered="true">
        <h:messages style="color:red" />
      </a4j:outputPanel>
      <h:form>
      <p>
         Input required: <h:inputText value="#{provaProbReplyBean.inputRequired}" required="true" />
      </p>
      <p>
           <h:outputText value="Scegli il canale:" />
           <h:selectOneMenu value="#{provaProbReplyBean.canale}">
            <f:selectItem itemLabel="--" itemValue="" />
            <f:selectItem itemLabel="Profamily" itemValue="Profamily" />
            <f:selectItem itemLabel="Captive" itemValue="Captive" />
            <a4j:support event="onchange" action="#{provaProbReplyBean.caricaProcBanche}"
                                  ajaxSingle="true" reRender="procedure, banche" />
         </h:selectOneMenu>
      </p>
      <p>
           <h:outputText value="Scegli la procedura:" />
           <h:selectOneMenu id="procedure" value="#{provaProbReplyBean.procedura}">
            <f:selectItem itemLabel="--" itemValue="" />
            <f:selectItems value="#{provaProbReplyBean.procedureList}" />
            <!-- immediately save the current value -->
            <a4j:support event="onchange" ajaxSingle="true" />
         </h:selectOneMenu>
      </p>
      <p>
           <h:outputText value="Scegli la banca:" />
           <h:selectOneMenu id="banche" value="#{provaProbReplyBean.banca}">
            <f:selectItem itemLabel="--" itemValue="" />
            <f:selectItems value="#{provaProbReplyBean.bancheList}" />
            <!-- immediately save the current value -->
            <a4j:support event="onchange" ajaxSingle="true" />
         </h:selectOneMenu>
      </p>
      <p><h:commandButton value="Submit" /></p>
      </h:form>
      </f:view>
    </body>
    </html>
    Bean
    public class ProvaProbReply {
         private String inputRequired;
         private String canale;
         private String procedura;
         private String banca;
         private Map<String, List<SelectItem>> canaliProc = new HashMap<String, List<SelectItem>>();
         private Map<String, List<SelectItem>> canaliBanche = new HashMap<String, List<SelectItem>>();
         private List<SelectItem> procedureList = new ArrayList<SelectItem>();
         private List<SelectItem> bancheList = new ArrayList<SelectItem>();
         public ProvaProbReply() {
              List<SelectItem> l = new ArrayList<SelectItem>();
              l.add(new SelectItem("Cessione del quinto"));
              l.add(new SelectItem("Credito al consumo"));
              l.add(new SelectItem("Mutui"));
              canaliProc.put("Profamily", l);
              l = new ArrayList<SelectItem>();
              l.add(new SelectItem("Credito al consumo"));
              canaliProc.put("Captive", l);
              l = new ArrayList<SelectItem>();
              canaliBanche.put("Profamily", l);
              l = new ArrayList<SelectItem>();
              l.add(new SelectItem("BDL"));
              l.add(new SelectItem("BM"));
              l.add(new SelectItem("BPM"));
              l.add(new SelectItem("CRA"));
              canaliBanche.put("Captive", l);
         public String getInputRequired() {
              return inputRequired;
         public void setInputRequired(String ir) {
              inputRequired = ir;
         public String getCanale() {
              return canale;
         public void setCanale(String c) {
              canale = c;
         public String getProcedura() {
              System.out.println("\ngetProcedura called\n");
              return procedura;
         public void setProcedura(String p) {
              procedura = p;
         public String getBanca() {
              System.out.println("\ngetBanca called\n");
              return banca;
         public void setBanca(String b) {
              banca = b;
         public List<SelectItem> getProcedureList() {
              return procedureList;
         public List<SelectItem> getBancheList() {
              return bancheList;
         public String caricaProcBanche() {
              System.out.println("\nListener called\n");
              procedureList.clear();
              bancheList.clear();
              if(canale != null && !canale.equals("")) {
                   procedureList.addAll(canaliProc.get(canale));
                   bancheList.addAll(canaliBanche.get(canale));
              System.out.println("BEFORE setting:\n");
              System.out.println("\nProcedura: "+procedura+"\n");
              System.out.println("Banca: "+banca+"\n");
              procedura = null;
              banca = null;
              System.out.println("\n\n\nAFTER setting:\n");
              System.out.println("\nProcedura: "+procedura+"\n");
              System.out.println("Banca: "+banca+"\n");
              return "";
    }Edited by: 869000 on 28-giu-2011 14.05

    I'm thinking this has to do with the fact that the UIComponents use the localValue after validation fails. This prevents the values from being overwritten when re-rendering the page, i.e. the inputs keep the value set by the user.
    The solution is to manipulate the components directly during the AJAX request when the first pull down is changed. Use the binding attribute to place them into your bean and clear the value directly. That way it will not matter that the expression is not evaluated.

  • JSF RI 1.2 Duplicate component ID step2Form:j_id9 found in view.

    Hi im using JSF RI 1.2 with Facelets
    The problem shows when i create a back button :
    let say we have pages : step1 and step2 and when im in step2 and click the back button
    <h:commandButton action="back" value="#{msg.back}" immediate="true"/>
    Then When I TRY to reSubmit the first page (step1) i get this error
    maybe becouse the forms are allready added.
    i Change the scope of all bean to session the problem is the same
    when i submit if the id of the form is allready added i get the exception.
    Can i make it more Struts like ? i mean if the id is alrleady created okei grab and get the content of this which is created and put the values in the new one .. dont show me crazy errors ? : )
    can i do it ?
    The Full Error :
    java.lang.IllegalStateException: Duplicate component ID step2Form:j_id9 found in view.
         at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:334)
         at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:327)
         at com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:195)
         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:601)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:243)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    Hmm Somethink New :
    I have binded the <h:form with a fields of type HtmlForm in the backingBeans NOW the result is different
    when the 3th time the form will be showed then throws the same exception .
    example :
    from step 1 go to step2 with next.
    go back to step1 - lol it works ( this dont works early )
    from step1 go to step 2 it works
    now from step2 go back to step1 - exception
    you can download the example from here :
    http://isy-dc.com/~naiden/Wizzard.rar
    the Valid data to be added for the first page is :
    first feld : 3-8 symbols
    secound field 3-8 sumbols
    3th field : 8310282400
    4 and 5th field must be the same 3-8 symbols
    Message was edited by:
    JOKe
    Message was edited by:
    JOKe

    I dont know what is the problem but this is the source code :
    The Version is :
    Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
    Specification-Title: JavaServer Faces
    Specification-Version: 1.2
    Implementation-Title: Sun Microsystems JavaServer Faces Implementation
    Implementation-Version: 1.2_01-NIGHTLY_20060603
    The Template :
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">
                 <f:loadBundle basename="resources" var="msg" />
              <head>
              <title><ui:insert name="pageTitle">Page Title</ui:insert></title>
              <style type="text/css">
                   body {
                          font-family: Verdana, Arial, Helvetica, sans-serif;
                          font-size: 14px;
                   .header {
                          font-family: Verdana, Arial, Helvetica, sans-serif;
                          font-size: 18px;
                   .bottom {
                          font-family: Verdana, Arial, Helvetica, sans-serif;
                          font-size: 9px;
                          text-align: center;
                          vertical-align: middle;
                          color: #8E969D;
              </style>
              </head>
    <body bgcolor="#ffffff">
    <table style="border:1px solid #CAD6E0"  align="center" cellpadding="0" cellspacing="0" border="0" width="800">
    <tbody>
         <tr>
              <td class="header" height="42" align="center" valign="middle" width="100%" bgcolor="#E4EBEB">
                   <ui:insert name="pageHeader">Page Header</ui:insert>
              </td>
         </tr>
         <tr>
              <td height="1" width="100%" bgcolor="#CAD6E0"></td>
         </tr>     
         <tr>
              <td width="100%"  colspan="2">
                   <table width="100%" style="height:150px" align="left" cellpadding="0" cellspacing="0" border="0">
                   <tbody>
                        <tr>
                             <td align="center" width="100%" valign="middle">
                             <ui:insert name="body">Page Body</ui:insert>
                             </td>
                        </tr>
                   </tbody>
                   </table>
              </td>
         </tr>     
         <tr>
              <td colspan="2"  valign="bottom" height="1" width="100%" bgcolor="#CAD6E0"></td>
         </tr>
    </tbody>
    </table>
    </body>
    </html>Step1 :
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:c="http://java.sun.com/jstl/core">
    <f:loadBundle basename="resources" var="msg" />
    <ui:composition template="/templates/common.xhtml">
         <ui:define name="pageTitle">JSF 1.2 and Facelets under Tomcat. KickStart Application</ui:define>
         <ui:define name="pageHeader">JSF 1.2 Registration Application</ui:define>
         <ui:define name="body">
              <h:messages />
              <p />
              <h:form id="step1Form" binding="#{person.form1}">
              <table width="100%">
                   <tr>
                        <td align="right">${msg.prompt}</td>
                        <td><h:inputText label="Name" required="true"
                             id="name" value="#{person.name}" /></td>
                        <td align="left"><h:message showSummary="true"
                             showDetail="false" style="color: red; font-weight: bold;"
                             for="name" /></td>
                   </tr>
                   <tr>
                        <td align="right">${msg.username}</td>
                        <td><h:inputText binding="#{person.inputText}" id="username"
                             label="Username" required="true">
                             <f:validateLength maximum="8" minimum="3" />
                        </h:inputText></td>
                        <td align="left"><h:message for="username" /></td>
                   </tr>
                   <tr>
                        <td align="right">${msg.egn}</td>
                        <td><h:inputText label="Egn" validator="#{person.validateEgn}"
                             id="egn" binding="#{person.inputEgn}"/></td>
                        <td align="left"><h:message for="egn"></h:message></td>
                   </tr>
                   <tr>
                        <td align="right">${msg.password}</td>
                        <td>
                        <h:inputSecret id="pass" label="Password" required="true" binding="#{person.inputPassword}">
                        <f:validateLength minimum="3" maximum="6"/>
                        </h:inputSecret>
                        </td>
                        <td>
                             <h:message for="pass"></h:message>
                        </td>
                   </tr>
                   <tr>
                        <td align="right">${msg.confirm_password}</td>
                        <td>
                        <h:inputSecret id="cpass" label="Confirm Password" required="true" binding="#{person.inputCPassword}">
                        <f:validateLength minimum="3" maximum="6"/>
                        </h:inputSecret>
                        </td>
                        <td>
                             <h:message for="cpass"></h:message>
                        </td>
                   </tr>
                   <tr>
                        <td colspan="3" align="center"><h:commandButton type="submit"
                             id="submit" action="${person.submit}"
                             value="#{msg.next}"/></td>
                   </tr>
              </table>
              </h:form>
         </ui:define>
    </ui:composition>
    </html>Step 2 :
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core">
    <f:loadBundle basename="resources" var="msg" />
    <ui:composition template="/templates/common.xhtml">
         <ui:define name="pageTitle">JSF 1.2 and Facelets under Tomcat. KickStart Application</ui:define>
         <ui:define name="pageHeader">Step 2 </ui:define>
         <ui:define name="body">
              <h:form id="step2Form" binding="#{step2.form2}">
                        #{msg.step2} #{person.name}!
                        <table>
                        <tr>
                             <td align="right">${msg.gender}</td>
                             <td align="left"><h:selectOneRadio
                                  binding="#{step2.genderMenu}">
                                  <f:selectItem itemValue="M" itemLabel="#{msg.gender_male}" />
                                  <f:selectItem itemValue="F" itemLabel="#{msg.gender_female}" />
                             </h:selectOneRadio></td>
                        </tr>
                        <tr>
                             <td align="right">${msg.education}</td>
                             <td align="left"><h:selectManyListbox
                                  binding="#{step2.educationList}">
                                  <f:selectItem itemValue="1" itemLabel="#{msg.education_level1}" />
                                  <f:selectItem itemValue="2" itemLabel="#{msg.education_level2}" />
                                  <f:selectItem itemValue="3" itemLabel="#{msg.education_level3}" />
                                  <f:selectItem itemValue="4" itemLabel="#{msg.education_level4}" />
                             </h:selectManyListbox></td>
                        </tr>
                        <tr>
                             <td align="right">
    <!--                     <h:commandLink value="#{msg.back}" action="back"></h:commandLink> -->     
                             <h:commandButton action="back" value="#{msg.back}" id="back"/>
                             </td>
                             <td align="left"><h:commandButton action="#{step2.submit}"
                                  value="#{msg.next}" id="submit2" /></td>
                        </tr>
                   </table>
              </h:form>
         </ui:define>
    </ui:composition>
    </html>Step 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">
         <f:loadBundle basename="resources" var="msg"/>
         <ui:composition template="/templates/common.xhtml">
                   <ui:define name="pageTitle">JSF 1.2 and Facelets under Tomcat. KickStart Application</ui:define>
                   <ui:define name="pageHeader">Final Page</ui:define>
                   <ui:define name="body">
                        #{msg.final} 
                        <h:form id="finalForm" binding="#{registration.form3}">
                        <h:outputText value="#{registration.regResult}"/>
                        <h:commandButton action="#{registration.save}" value="Save to Database" id="save"/>
                        <br/>
                        <h:commandButton action="back" value="#{msg.back}" immediate="true" id="back3"/>
                        </h:form>
                   </ui:define>
         </ui:composition>
    </html>

  • Strange validation behaviour

    Hi!
    I've just set up a very simple JSF-demo-project
    where one can enter a name in a JSP.
    There is an input field with a      <f:validateLength minimum="5" />.
    If I provoke a validation error, (e.g. input a name with just 2 chars and
    press a save-button) the validation error is displayed correctly,
    but the input field is filled with the original content out of the
    managed-bean, though it should contain the wrong input of 2 chars.
    Any idea?
    Herb

    Here is the situation
    1. I have an entity named 'PersonInfo'. It contains an attribute named 'TaxNo'
    2. I defined a custom validation rule and the error message 'Invalid TaxNo':
    public boolean validateTaxNo(String data) {
         if (data.equals("1"))
              return true;
         else
              return false;
    3. I generate a view 'PersonInfoView' that uses the entity 'PersonInfo'
    4. In AppModule I create a function:
    public void setPersonTaxNo()
         ViewObject vo= this.findViewObject("PersonInfoView1");
         Row row = vo.createRow();
         row.setAttribute("TaxNo", "@@invalidValue");
         vo.insertRow(row);
    5. In the backing bean that handles action navigation to a 'PersonInfoView' edit page, I call the function:
         am.setPersonTaxNo();
    6. The navigation completes and page 'PersonInfoView' edit page appears. The input text that should show the value of TaxNo appears empty. No error is displayed.
    7. I don't type any value to that field and I press the commit button.
    8. The response now shows the value "@@invalidValue" in the field and the error message 'Invalid TaxNo'.
    With debugger, I found out that setInternalAttribute throws an AttrSetValException because of validation failure and that the attribute in the entity has a null value.
    But then why no error message appears at the page?
    And where does ADF store the invalid value and displays it in the second page?
    Is there a way to force ADF to set an invalid value into an attribute? For example a magic function setEnableValidations(false) ? :)

  • Validator issue

    Hi Gurus,
    I have a list which has say 2 elements say 'X', 'Y'.
    When i select X i display input component iinp1, inp2 - both are marked as required
    When i select Y i display input component int3,inp4 - both are marked as required
    I have a save button.
    Scenario :
    I select Element X from the list. My page shows input 1, inp2.
    Now i don't enter anything and select Y from the list.
    Issue: Elements don't change as jsf validator fires. So i have to enter value in inp1,inp2 then only they r hidden and inp3, inp4 are shown
    How to handle this scenario ?
    thns

    @Nikhil Gokhale : Tried using your code .. FacesContext.getCurrentInstance().renderResponse(); skips PPR so nothing happens
    btw my code is as asked
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core">
      <af:panelHeader text="Party" id="ph1">
        <f:facet name="toolbar">
          <af:toolbar id="t2">
            <af:commandToolbarButton text="Save and Create Activity" id="ctb1"
                                     action="#{PartyAndOpportunityPageBean.saveAndCreateActivityListener}"
                                     rendered="false"/>
            <af:commandToolbarButton text="Save and Close" id="ctb3"
                                     action="#{PartyAndOpportunityPageBean.saveAndCloseListener}"/>
            <af:commandToolbarButton text="Cancel" id="ctb2" action="close"
                                     immediate="true"/>
          </af:toolbar>
        </f:facet>
        <af:panelGroupLayout id="pgl1" inlineStyle="width:992px;"
                             layout="horizontal" valign="top">
          <af:showDetailHeader text="Party" disclosed="true" id="sdh1"
                               inlineStyle="height:340px;">
            <af:panelFormLayout id="pfl2" partialTriggers="partyTypeId">
              <af:selectOneChoice value="#{bindings.PartyType.inputValue}"
                                  label="#{bindings.PartyType.label}"
                                  required="#{bindings.PartyType.hints.mandatory}"
                                  shortDesc="#{bindings.PartyType.hints.tooltip}"
                                  id="partyTypeId" autoSubmit="true"
                                  immediate="true" valuePassThru="true"
                                  readOnly="#{pageFlowScope.partyId!=null}"
                                  valueChangeListener="#{PartyAndOpportunityPageBean.changePartyType}">
                <f:selectItems value="#{bindings.PartyType.items}" id="si4"/>
              </af:selectOneChoice>
              <af:inputText value="#{bindings.PartyName.inputValue}"
                            label="#{bindings.PartyName.hints.label}"
                            columns="#{bindings.PartyName.hints.displayWidth}"
                            maximumLength="#{bindings.PartyName.hints.precision}"
                            shortDesc="#{bindings.PartyName.hints.tooltip}" id="it3"
                            rendered="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                            partialTriggers="partyTypeId"
                            readOnly="#{pageFlowScope.partyId!=null}"
                            required="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}">
                <f:validator binding="#{bindings.PartyName.validator}"/>
              </af:inputText>
              <af:selectOneChoice value="#{bindings.PersonPreNameAdjunct.inputValue}"
                                  label="#{bindings.PersonPreNameAdjunct.label}"
                                  required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                  shortDesc="#{bindings.PersonPreNameAdjunct.hints.tooltip}"
                                  id="personPreNameAdjunctId"
                                  rendered="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                  readOnly="#{pageFlowScope.partyId!=null}">
                <f:selectItems value="#{bindings.PersonPreNameAdjunct.items}"
                               id="si5"/>
              </af:selectOneChoice>
              <af:inputText value="#{bindings.PersonFirstName.inputValue}"
                            label="#{bindings.PersonFirstName.hints.label}"
                            required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                            columns="#{bindings.PersonFirstName.hints.displayWidth}"
                            maximumLength="#{bindings.PersonFirstName.hints.precision}"
                            shortDesc="#{bindings.PersonFirstName.hints.tooltip}"
                            id="it4"
                            rendered="#{bindings.PartyType1.inputValue == 'PERSON'}"
                            readOnly="#{pageFlowScope.partyId!=null}">
                <f:validator binding="#{bindings.PersonFirstName.validator}"/>
              </af:inputText>
              <af:inputText value="#{bindings.PersonLastName.inputValue}"
                            label="#{bindings.PersonLastName.hints.label}"
                            required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                            columns="#{bindings.PersonLastName.hints.displayWidth}"
                            maximumLength="#{bindings.PersonLastName.hints.precision}"
                            shortDesc="#{bindings.PersonLastName.hints.tooltip}"
                            id="it5"
                            rendered="#{bindings.PartyType1.inputValue == 'PERSON'}"
                            readOnly="#{pageFlowScope.partyId!=null}">
                <f:validator binding="#{bindings.PersonLastName.validator}"/>
              </af:inputText>
              <af:panelLabelAndMessage label="Land Line" id="plam1"
                                       rendered="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                                       showRequired="true">
                <af:panelGroupLayout id="pgl4" layout="horizontal">
                  <af:selectOneChoice value="#{bindings.FixCountryCode.inputValue}"
                                      label="#{bindings.FixCountryCode.label}"
                                      required="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                                      shortDesc="#{bindings.FixCountryCode.hints.tooltip}"
                                      id="soc9" simple="true">
                    <f:selectItems value="#{bindings.FixCountryCode.items}"
                                   id="si15"/>
                  </af:selectOneChoice>
                  <af:selectOneChoice value="#{bindings.FixAreaCode.inputValue}"
                                      label="#{bindings.FixAreaCode.label}"
                                      required="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                                      shortDesc="#{bindings.FixAreaCode.hints.tooltip}"
                                      id="soc10" simple="true">
                    <f:selectItems value="#{bindings.FixAreaCode.items}" id="si16"/>
                  </af:selectOneChoice>
                  <af:inputText value="#{bindings.FixPhoneNumber.inputValue}"
                                label="#{bindings.FixPhoneNumber.hints.label}"
                                required="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                                columns="7" maximumLength="7"
                                shortDesc="#{bindings.FixPhoneNumber.hints.tooltip}"
                                id="it17" simple="true">
                    <f:validateLength minimum="7" maximum="7"/>
                    <f:validator binding="#{bindings.FixPhoneNumber.validator}"
                                 validatorId="javax.faces.Length"/>
                  </af:inputText>
                </af:panelGroupLayout>
              </af:panelLabelAndMessage>
              <af:panelLabelAndMessage label="Mobile" id="plam2"
                                       rendered="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                       showRequired="true">
                <af:panelGroupLayout id="pgl3" layout="horizontal"
                                     rendered="#{bindings.PartyType1.inputValue == 'PERSON'}">
                  <af:selectOneChoice value="#{bindings.PrimaryPhoneCountryCode.inputValue}"
                                      label="#{bindings.PrimaryPhoneCountryCode.label}"
                                      required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                      shortDesc="#{bindings.PrimaryPhoneCountryCode.hints.tooltip}"
                                      id="primaryPhoneCountryCodeId" simple="true"
                                      readOnly="#{pageFlowScope.partyId!=null}">
                    <f:selectItems value="#{bindings.PrimaryPhoneCountryCode.items}"
                                   id="si6"/>
                  </af:selectOneChoice>
                  <af:selectOneChoice value="#{bindings.PrimaryPhoneAreaCode.inputValue}"
                                      label="#{bindings.PrimaryPhoneAreaCode.label}"
                                      required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                      shortDesc="#{bindings.PrimaryPhoneAreaCode.hints.tooltip}"
                                      id="primaryPhoneAreaCodeId" simple="true"
                                      readOnly="#{pageFlowScope.partyId!=null}">
                    <f:selectItems value="#{bindings.PrimaryPhoneAreaCode.items}"
                                   id="si7"/>
                  </af:selectOneChoice>
                  <af:inputText value="#{bindings.PrimaryPhoneNumber.inputValue}"
                                label="#{bindings.PrimaryPhoneNumber.hints.label}"
                                required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                columns="7" maximumLength="7"
                                shortDesc="#{bindings.PrimaryPhoneNumber.hints.tooltip}"
                                id="it6" simple="true"
                                readOnly="#{pageFlowScope.partyId!=null}">
                                <f:validateLength minimum="7" maximum="7"/>
                    <f:validator binding="#{bindings.PrimaryPhoneNumber.validator}"/>
                  </af:inputText>
                </af:panelGroupLayout>
              </af:panelLabelAndMessage>
              <af:inputText value="#{bindings.EmailAddress.inputValue}"
                            label="#{bindings.EmailAddress.hints.label}"
                            columns="#{bindings.EmailAddress.hints.displayWidth}"
                            maximumLength="#{bindings.EmailAddress.hints.precision}"
                            shortDesc="#{bindings.EmailAddress.hints.tooltip}"
                            id="it7" readOnly="#{pageFlowScope.partyId!=null}"
                            required="#{bindings.PartyType1.inputValue == 'PERSON' or bindings.PartyType1.inputValue == 'ORGANIZATION'}">
                <f:validator binding="#{bindings.EmailAddress.validator}"/>
              </af:inputText>
              <af:inputText value="#{bindings.Address1.inputValue}"
                            label="#{bindings.Address1.hints.label}"
                            columns="#{bindings.Address1.hints.displayWidth}"
                            maximumLength="#{bindings.Address1.hints.precision}"
                            shortDesc="#{bindings.Address1.hints.tooltip}" id="it8"
                            readOnly="#{pageFlowScope.partyId!=null}"
                            required="#{bindings.PartyType1.inputValue == 'PERSON' or bindings.PartyType1.inputValue == 'ORGANIZATION'}">
                <f:validator binding="#{bindings.Address1.validator}"/>
              </af:inputText>
              <af:inputText value="#{bindings.PostalCode.inputValue}"
                            label="#{bindings.PostalCode.hints.label}"
                            columns="#{bindings.PostalCode.hints.displayWidth}"
                            maximumLength="#{bindings.PostalCode.hints.precision}"
                            shortDesc="#{bindings.PostalCode.hints.tooltip}"
                            id="it22" readOnly="#{pageFlowScope.partyId!=null}"
                            required="#{bindings.PartyType1.inputValue == 'PERSON' or bindings.PartyType1.inputValue == 'ORGANIZATION'}">
                  <f:validateLength minimum="3" maximum="5"/>
                <f:validator binding="#{bindings.PostalCode.validator}"/>
              </af:inputText>
              <af:selectOneChoice value="#{bindings.Country.inputValue}"
                                  label="#{bindings.Country.label}"
                                  shortDesc="#{bindings.Country.hints.tooltip}"
                                  id="countryId"
                                  readOnly="#{pageFlowScope.partyId!=null}"
                                  required="#{bindings.PartyType1.inputValue == 'PERSON' or bindings.PartyType1.inputValue == 'ORGANIZATION'}">
                <f:selectItems value="#{bindings.Country.items}" id="si8"/>
              </af:selectOneChoice>
            </af:panelFormLayout>
          </af:showDetailHeader>
          <af:spacer width="10" height="10" id="s1"/>
          <af:showDetailHeader text="Opportunity" disclosed="true" id="sdh2">
            <af:panelFormLayout id="pfl4" partialTriggers="partyTypeId">
              <af:inputText value="#{bindings.OpportunityName.inputValue}"
                            label="#{bindings.OpportunityName.hints.label}"
                            required="#{bindings.PartyType1.inputValue == 'PERSON' or bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                            columns="#{bindings.OpportunityName.hints.displayWidth}"
                            maximumLength="#{bindings.OpportunityName.hints.precision}"
                            shortDesc="#{bindings.OpportunityName.hints.tooltip}"
                            id="it1">
                <f:validator binding="#{bindings.OpportunityName.validator}"/>
              </af:inputText>
              <af:selectOneChoice value="#{bindings.ExistingCar1.inputValue}"
                                  label="#{bindings.ExistingCar1.label}"
                                  required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                  shortDesc="#{bindings.ExistingCar1.hints.tooltip}"
                                  id="soc3"
                                  rendered="#{bindings.PartyType1.inputValue == 'PERSON'}">
                <f:selectItems value="#{bindings.ExistingCar1.items}" id="si3"/>
              </af:selectOneChoice>
              <af:selectOneChoice value="#{bindings.MediaName.inputValue}"
                                  label="#{bindings.MediaName.label}"
                                  required="#{bindings.PartyType1.inputValue == 'PERSON' or bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                                  shortDesc="#{bindings.MediaName.hints.tooltip}"
                                  id="soc1">
                <f:selectItems value="#{bindings.MediaName.items}" id="si1"/>
              </af:selectOneChoice>
              <af:selectOneChoice value="#{bindings.PurchaseType.inputValue}"
                                  label="#{bindings.PurchaseType.label}"
                                  shortDesc="#{bindings.PurchaseType.hints.tooltip}"
                                  id="soc2" required="true">
                <f:selectItems value="#{bindings.PurchaseType.items}" id="si2"/>
              </af:selectOneChoice>
              <af:selectOneChoice value="#{bindings.CustomerCategory.inputValue}"
                                  label="#{bindings.CustomerCategory.label}"
                                  required="#{bindings.PartyType1.inputValue == 'PERSON'}"
                                  shortDesc="#{bindings.CustomerCategory.hints.tooltip}"
                                  id="customerCategoryId"
                                  rendered="#{bindings.PartyType1.inputValue == 'PERSON'}">
                <f:selectItems value="#{bindings.CustomerCategory.items}" id="si9"/>
              </af:selectOneChoice>
              <af:panelLabelAndMessage id="plam3" label="Contact Person"
                                       rendered="#{bindings.PartyType1.inputValue == 'ORGANIZATION'}"
                                       showRequired="true">
                <af:panelGroupLayout id="pgl2" layout="horizontal">
                  <af:selectOneChoice label="Contact Person" id="soc8"
                                      simple="true">
                    <f:selectItems value="" id="si14"/>
                  </af:selectOneChoice>
                  <af:commandButton text="New Contact" id="cb1"
                                    actionListener="#{bindings.CreateInsertContact.execute}">
                    <af:showPopupBehavior popupId="newContact" triggerType="action"
                                          align="endAfter"/>
                  </af:commandButton>
                </af:panelGroupLayout>
              </af:panelLabelAndMessage>
            </af:panelFormLayout>
            <af:spacer width="10" height="10" id="s2"/>
            <af:popup id="newContact" contentDelivery="immediate">
              <af:dialog id="d1"
                         dialogListener="#{PartyAndOpportunityPageBean.onDialogAction}">
                <af:panelFormLayout id="pfl1">
                  <af:selectOneChoice value="#{bindings.PersonTitle.inputValue}"
                                      label="#{bindings.PersonTitle.label}"
                                      required="#{bindings.PersonTitle.hints.mandatory}"
                                      shortDesc="#{bindings.PersonTitle.hints.tooltip}"
                                      id="soc6">
                    <f:selectItems value="#{bindings.PersonTitle.items}" id="si13"/>
                  </af:selectOneChoice>
                  <af:inputText value="#{bindings.PersonFirstName1.inputValue}"
                                label="#{bindings.PersonFirstName1.hints.label}"
                                required="#{bindings.PersonFirstName1.hints.mandatory}"
                                columns="#{bindings.PersonFirstName1.hints.displayWidth}"
                                maximumLength="#{bindings.PersonFirstName1.hints.precision}"
                                shortDesc="#{bindings.PersonFirstName1.hints.tooltip}"
                                id="it10">
                    <f:validator binding="#{bindings.PersonFirstName1.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.PersonLastName1.inputValue}"
                                label="#{bindings.PersonLastName1.hints.label}"
                                required="#{bindings.PersonLastName1.hints.mandatory}"
                                columns="#{bindings.PersonLastName1.hints.displayWidth}"
                                maximumLength="#{bindings.PersonLastName1.hints.precision}"
                                shortDesc="#{bindings.PersonLastName1.hints.tooltip}"
                                id="it11">
                    <f:validator binding="#{bindings.PersonLastName1.validator}"/>
                  </af:inputText>
                  <af:selectOneChoice value="#{bindings.CountryCode.inputValue}"
                                      label="#{bindings.CountryCode.label}"
                                      required="#{bindings.CountryCode.hints.mandatory}"
                                      shortDesc="#{bindings.CountryCode.hints.tooltip}"
                                      id="soc4">
                    <f:selectItems value="#{bindings.CountryCode.items}" id="si10"/>
                  </af:selectOneChoice>
                  <af:selectOneChoice value="#{bindings.AreaCode.inputValue}"
                                      label="#{bindings.AreaCode.label}"
                                      required="#{bindings.AreaCode.hints.mandatory}"
                                      shortDesc="#{bindings.AreaCode.hints.tooltip}"
                                      id="soc5">
                    <f:selectItems value="#{bindings.AreaCode.items}" id="si11"/>
                  </af:selectOneChoice>
                  <af:inputText value="#{bindings.PhoneNumber.inputValue}"
                                label="#{bindings.PhoneNumber.hints.label}"
                                required="#{bindings.PhoneNumber.hints.mandatory}"
                                columns="#{bindings.PhoneNumber.hints.displayWidth}"
                                maximumLength="#{bindings.PhoneNumber.hints.precision}"
                                shortDesc="#{bindings.PhoneNumber.hints.tooltip}"
                                id="it14">
                    <f:validator binding="#{bindings.PhoneNumber.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.EmailAddress1.inputValue}"
                                label="#{bindings.EmailAddress1.hints.label}"
                                required="#{bindings.EmailAddress1.hints.mandatory}"
                                columns="#{bindings.EmailAddress1.hints.displayWidth}"
                                maximumLength="#{bindings.EmailAddress1.hints.precision}"
                                shortDesc="#{bindings.EmailAddress1.hints.tooltip}"
                                id="it9">
                    <f:validator binding="#{bindings.EmailAddress1.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.Address.inputValue}"
                                label="#{bindings.Address.hints.label}"
                                required="#{bindings.Address.hints.mandatory}"
                                columns="#{bindings.Address.hints.displayWidth}"
                                maximumLength="#{bindings.Address.hints.precision}"
                                shortDesc="#{bindings.Address.hints.tooltip}"
                                id="it13">
                    <f:validator binding="#{bindings.Address.validator}"/>
                  </af:inputText>
                  <af:inputText value="#{bindings.PostalCode1.inputValue}"
                                label="#{bindings.PostalCode1.hints.label}"
                                required="#{bindings.PostalCode1.hints.mandatory}"
                                columns="#{bindings.PostalCode1.hints.displayWidth}"
                                maximumLength="#{bindings.PostalCode1.hints.precision}"
                                shortDesc="#{bindings.PostalCode1.hints.tooltip}"
                                id="it12">
                    <f:validator binding="#{bindings.PostalCode1.validator}"/>
                  </af:inputText>
                  <af:selectOneChoice value="#{bindings.Emirate.inputValue}"
                                      label="#{bindings.Emirate.label}"
                                      required="#{bindings.Emirate.hints.mandatory}"
                                      shortDesc="#{bindings.Emirate.hints.tooltip}"
                                      id="soc7">
                    <f:selectItems value="#{bindings.Emirate.items}" id="si12"/>
                  </af:selectOneChoice>
                </af:panelFormLayout>
              </af:dialog>
            </af:popup>
            <af:showDetailHeader text="Interested Models" disclosed="true"
                                 id="sdh3">
              <af:panelCollection id="pc1">
                <af:table value="#{bindings.InterestedModel1.collectionModel}"
                          var="row" rows="#{bindings.InterestedModel1.rangeSize}"
                          emptyText="#{bindings.InterestedModel1.viewable ? 'No data to display.' : 'Access Denied.'}"
                          fetchSize="#{bindings.InterestedModel1.rangeSize}"
                          rowBandingInterval="0"
                          filterModel="#{bindings.InterestedModel1Query.queryDescriptor}"
                          queryListener="#{bindings.InterestedModel1Query.processQuery}"
                          filterVisible="true" varStatus="vs"
                          selectionListener="#{bindings.InterestedModel1.collectionModel.makeCurrent}"
                          id="t1" columnStretching="column:c2"
                          partialTriggers=":::partyTypeId :::ctb3"
                          rowSelection="multiple" contentDelivery="immediate">
                  <af:column id="c5" width="12" rowHeader="true"/>
                  <af:column sortProperty="Selected" sortable="true"
                             headerText="#{bindings.InterestedModel1.hints.Selected.label}"
                             id="c3" rendered="false">
                    <af:selectBooleanCheckbox value="#{row.bindings.Selected.inputValue}"
                                              label="#{row.bindings.Selected.label}"
                                              shortDesc="#{bindings.InterestedModel1.hints.Selected.tooltip}"
                                              id="sbc1"/>
                  </af:column>
                  <af:column sortProperty="RangeDescription" filterable="true"
                             sortable="true"
                             headerText="#{bindings.InterestedModel1.hints.RangeDescription.label}"
                             id="c2">
                    <af:inputText value="#{row.bindings.RangeDescription.inputValue}"
                                  label="#{bindings.InterestedModel1.hints.RangeDescription.label}"
                                  required="#{bindings.InterestedModel1.hints.RangeDescription.mandatory}"
                                  columns="#{bindings.InterestedModel1.hints.RangeDescription.displayWidth}"
                                  maximumLength="#{bindings.InterestedModel1.hints.RangeDescription.precision}"
                                  shortDesc="#{bindings.InterestedModel1.hints.RangeDescription.tooltip}"
                                  id="it15">
                      <f:validator binding="#{row.bindings.RangeDescription.validator}"/>
                    </af:inputText>
                  </af:column>
                  <af:column sortProperty="RangeCode" filterable="true"
                             sortable="true"
                             headerText="#{bindings.InterestedModel1.hints.RangeCode.label}"
                             id="c4">
                    <af:inputText value="#{row.bindings.RangeCode.inputValue}"
                                  label="#{bindings.InterestedModel1.hints.RangeCode.label}"
                                  required="#{bindings.InterestedModel1.hints.RangeCode.mandatory}"
                                  columns="#{bindings.InterestedModel1.hints.RangeCode.displayWidth}"
                                  maximumLength="#{bindings.InterestedModel1.hints.RangeCode.precision}"
                                  shortDesc="#{bindings.InterestedModel1.hints.RangeCode.tooltip}"
                                  id="it16">
                      <f:validator binding="#{row.bindings.RangeCode.validator}"/>
                    </af:inputText>
                  </af:column>
                  <af:column sortProperty="Quantity" filterable="true"
                             sortable="true"
                             headerText="#{bindings.InterestedModel1.hints.Quantity.label}"
                             id="c1">
                    <af:inputText value="#{row.bindings.Quantity.inputValue}"
                                  label="#{bindings.InterestedModel1.hints.Quantity.label}"
                                  required="#{bindings.InterestedModel1.hints.Quantity.mandatory}"
                                  columns="#{bindings.InterestedModel1.hints.Quantity.displayWidth}"
                                  maximumLength="#{bindings.InterestedModel1.hints.Quantity.precision}"
                                  shortDesc="#{bindings.InterestedModel1.hints.Quantity.tooltip}"
                                  id="it2" autoSubmit="true">
                      <f:validator binding="#{row.bindings.Quantity.validator}"/>
                      <af:convertNumber groupingUsed="false"
                                        pattern="#{bindings.InterestedModel1.hints.Quantity.format}"/>
                    </af:inputText>
                  </af:column>
                </af:table>
              </af:panelCollection>
            </af:showDetailHeader>
          </af:showDetailHeader>
        </af:panelGroupLayout>
      </af:panelHeader>
    </jsp:root>

  • JSF I18N

    I know a bean is available with resource bundle for I18N, like Messages_ja.properties...
    Is anyone working JSF I18N for messages? Not yet?
    For instances, the following tag shows the message with invalid length:
    <f:validateLength minimum="2" maximum="10"/>
    Validation Error: Value is required.

    You can provide your own localized text for all standard messages in bundles with the base name declared by the <message-bundle> element in the faces-config.xml file:
      <faces-config>
        <application>
          <message-bundle>myMessages</message-bundle>
        </application>
      </faces-config>Then put your localized bundes in WEB-INF/classes, e.g., WEB-INF/classes/myMessages_ja.properties, and use the keys for the standard messages defined in section 2.5.2.4 of the spec, e.g.,:
    javax.faces.component.UIInput.REQUIRED=Input missing
    javax.faces.component.UIInput.REQUIRED_detail=You must enter a value
    javax.faces.validator.LengthValidator.MINIMUM=Enter a value that is at least {0} characterswith the messages in the appropriate language, of course.

  • Catch the Excep while clicking on a button and display the msg in JSF UI

    Hi,
    I am facing a issue like i have a add button in my JSF page which will add Partner code, Partner name,etc..,
    If i give the same partner code and partner name second time it is throwing the duplicate key exception
    org.apache.myfaces.component.html.ext.HtmlSelectOneMenu@319e5b
    Calling Save Method.............
    Record Saved..............
    (util.JDBCExceptionReporter 71 ) SQL Error: 1062, SQLState: 23000
    (util.JDBCExceptionReporter 72 ) Duplicate entry 'T1-test1' for key 1
    (def.AbstractFlushingEventListener 299 ) Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
         at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
         at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
         at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)
         at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:496)
         at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:469)
         at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:266)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy31.save(Unknown Source)
         at com.finnair.pba.handler.PartnerMastCtrl.addAction(PartnerMastCtrl.java:110)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
         at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
         at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
         at javax.faces.component.UICommand.broadcast(UICommand.java:106)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
         at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.sql.BatchUpdateException: Duplicate entry 'T1-test1' for key 1
         at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
         at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
         at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
         ... 51 more
    I am using JSF,Spring and Hibernate.
    I would like to catch this exception and throw it in the JSF UI near partner code field as a message.
    Is this possible to do.
    My JSF:
    <tr>
    <td width="30%" align="right" ><b><h:outputText id="pPartnerCode" value="Partner Code" /></b><span style="color:red">*</span></td>
    <td width="60%">:
    <h:inputText id="partnerCode" value="#{partnerMast.partnerCode}" required="true">     
    <t:validateRegExpr pattern="^[a-z||A-Z||0-9||_||\s||/]+$" />
    <f:validateLength minimum="1" maximum="3" />     
    </h:inputText>          
    <h:message for="partnerCode" showDetail="true" style="color:red" /></td>
    </tr>
    <tr>
    <td width="40%" align="right"><b><h:outputText id="pPartnerName" value="Partner Name" /><span style="color:red">*</span></b></td>
    <td width="60%" align="left">:               
    <h:inputText id="partnerName" value="#{partnerMast.partnerName}" required="true" >     
    <t:validateRegExpr pattern="^[a-z||A-Z||0-9||_||\s||/]+$" />
    <f:validateLength minimum="1" maximum="50"/>     
    </h:inputText>
    <h:message for="partnerName" showDetail="true" style="color:red" />
    </td>
    </tr>
    <h:commandButton id="addUser" value="Save" action="#{partnerMastCtrl.addAction}" styleClass="style10"/>
    My controller:
    public String addAction()
    try
    partnerMast = (PartnerMast)context.getExternalContext().getSessionMap().get("partnerMast");
    partnerHostingMast = (PartnerHostingMast) context.getExternalContext().getSessionMap().get("partnerHostingMast");
    this.getService();
    if(partnerHostingMast != null && partnerHostingMast.getHostingPartner() != null && partnerMast.getPartnerType().equalsIgnoreCase("Airline"))
    partnerHostingMast.setPartnerCode(partnerMast.getPartnerCode());
    partnerMastService.save(partnerMast);     /* To be noted */
    partnerHostingMastService.saveOrUpdate(partnerHostingMast);
    ret_stat = "Success";
    context.getExternalContext().getSessionMap().put("partnerMast", null);
    } else {
    partnerMastService.save(partnerMast);
    ret_stat = "Success";
    }catch(Exception e){
    ret_stat = "Error";
    FacesMessage message = new FacesMessage("Application facing some problem - Please contact administrator");
    context.addMessage("error", message);
    return ret_stat;
    My Dao :
    public PartnerMast save(PartnerMast entity){
    try{
         System.out.println("Calling Save Method.............");
         entity.setIsActive("Y");
         getHibernateTemplate().save(entity);
         System.out.println("Record Saved..............");
    catch(ConstraintViolationException e){
         System.out.println("Exception ..................."+e);
    return entity;
    I hope u got my question. Is there is any solution for this.
    Pls Anyone help me out.
    Thanks,
    Ambika&#9786;

    Hi,
    I am able to catch the exception, how would i able to display the message in the JSF UI.
    My Controller:
    public String addAction() throws Exception
    try{               
    partnerMast = (PartnerMast)context.getExternalContext().getSessionMap().get("partnerMast");
    partnerHostingMast = (PartnerHostingMast) context.getExternalContext().getSessionMap().get("partnerHostingMast");
    this.getService();
    if(partnerHostingMast != null && partnerHostingMast.getHostingPartner() != null && partnerMast.getPartnerType().equalsIgnoreCase("Airline"))
    partnerHostingMast.setPartnerCode(partnerMast.getPartnerCode());
    partnerMastService.save(partnerMast);     
    partnerHostingMastService.saveOrUpdate(partnerHostingMast);
    ret_stat = "Success";
    context.getExternalContext().getSessionMap().put("partnerMast", null);
    else {
    partnerMastService.save(partnerMast);
    ret_stat = "Success";
    catch(Exception e) {
         ret_stat = "Error";
         FacesMessage message = new FacesMessage("Application facing some problem - Please contact administrator");
         context.addMessage("error", message);
           if(causedByBatchUpdateException(e)) {
                  System.out.println("Yes Exception.........");
                  FacesMessage message1 = new FacesMessage("Duplicate Entry...........");
              context.addMessage("error", message1);
                            //ret_sta="NO";
                     } else {
                             throw e;
              System.out.println("Before returning.............");
              return ret_stat;
              //return ret_sta;
    }It is displaying the message saying "Yes Exception" in the console but not displaying the "Duplicate Entry" in the JSF UI.
    Pls Anyone help me out.
    Thanks,
    Ambika&#9786;

  • How to Validate the Text Field in JSF

    Hi,
    I am facing a issue to validate the text field where the below code accepts (space' ',underscore'_',pipe'|') symbol as a first character and last character.Where by it can accept in the middle.
    It should not accept special characters also. Below code is working properly for special characters.
    <tr>
    <td width="30%" align="right"><b><h:outputText id="aAccrualType" value="Accrual Type" /> </b> <span style="color:red">*</span></td>
    <td width="50%">: <h:inputText id="accrualType" value="#{accrualTypeMast.accrualType}" required="true" >          
    <t:validateRegExpr pattern="^[(a-z)||(A-Z)||(0-9)||(_)||(\s)||(/)]+$" />     
    <f:validateLength minimum="1" maximum="50"/>     
    </h:inputText>
    <h:message for="accrualType" showDetail="true" style="color:red" />
    </td>
    </tr>
    The thing is i dont have much knowledge in regular expression.
    Is there any other way to do this.
    Could anyone help me in this.
    Thanks,
    Ambika&#9786;

    This has nothing to do with JSF.
    I suggest you to read the Pattern API documentation [1]. You can easily create a small Java Application and test the regexp using String#matches() as it uses the same regexp guidelines.
    public static void main(String[] args) {
        String regexp = "^[a-z]+$";
        String value = "foo";
        boolean match = value.matches(regexp);
        System.out.println(value + " matches " + regexp + ": " + match);
    }[1] http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • Help with f:validateLength ... /

    Hi,
    I'm using the <f:validateLength minimum="6" maximum="45"/> tag in a login form to make sure there is something in a username field before looking up a database.
    The problem is if I don't type anything in the input field <h:inputText id="username" value="#{userBean.username}"> then the validation never give back an error message.
    On the other hand if there is 1 character then there will be a message saying that there must be at least 6 characters.
    Why is it necessary to type at least one character?
    Regards.

    Forget about it. I found the problem.
    I changed from:
    <h:inputText id="username" value="#{userBean.username}">
    to:
    <h:inputText id="username" value="#{userBean.username}" required="true">
    and it is now picking up the fact that the input field is blank.
    Regards.

  • JSF2.0 Ajax validation Problem

    Hello everyone,I'm learning ajax validation of JSF2.0
    <h:form>
    <h:inputText id="name" value="#{user.name}" validator="#{user.validateName}">
    <f:ajax event="keyup" render="nameError"/>
    </h:inputText>
    <h:message for="name" id="nameError" style="color:red"/>
    </h:form>
    and user.validateName:
    public void validateName(FacesContext fc, UIComponent c, Object value) {
    if ( ((String)value).contains("_") )
    throw new ValidatorException(new FacesMessage("Name cannot contain underscores"));
    and it worked fine before I change the validator to JSF standard length validator:
    <h:form>
    <h:inputText id="name" value="#{user.name}">
    <f:validateLength minmum="5" maxmum="10"/>
    <f:ajax event="keyup" render="nameError"/>
    </h:inputText>
    <h:message for="name" id="nameError" style="color:red"/>
    </h:form>
    it didn't work then,when I typee in username shorter then 5 or longer then 10 it didn't show any error...
    any reply will help me,TKS!

    FoxInSky wrote:
    Hi all:
    Could Anybody told me the reason? Why the Ajax button send and receive more data than the traditionally button? Or if there is anything wrong the way I use its internal Ajax library?Perhaps because it sends more information? Why would you care?
    >
    Another question is: When I clicked the AjaxButton quickly and continually,the page will become unresponsive,and the result from HttpWatch shows Aborted,and sometimes "Abored exception" will be printed out in the console window.If you press the button like that, more and more ajax requests will be done. You could block that by disabling the button after pressing it.
    As for "it not working", what about the receiving end of the ajax call? Is the backing bean action actually being run?

Maybe you are looking for

  • How to find non selling products in a departmental store

    hi experts, for example: how to find non selling products in a departmental store at end of the month in reporting. is it possible to find, if it is, pl give me the procedure. thanks & regards sairam

  • Making calculations in QueryDesigner using only two decimals

    Hi, I need to make a calculation in a bex analyzer query, using only two decimals. Ex. A = 10 B = 3 C = 1000 D is a variable. In a query, the following calculation: A/B = D | D*1000 Results in the following: 3333 But if D only had two decimals, the r

  • ALV BLOCK LIST Dump

    Hello All, I'm using the FM REUSE_ALV_BLOCK_LIST_DISPLAY. I'm getting the Output from the Block List FMs as intended. But when I'm performing any action on user-command the program is going for a dump saying : Field symbol has not yet been assigned.

  • Export without "transcoding"? (h264 Eos .mov files)

    Hy! My question is: Is it possible to export from the original footage without transcoding bits that dont need to? I am using a Canon Eos 550d which produces h264 .mov files with 49mbit/sec. As I believe mercury-playback-engine acts as a frameserver

  • External links in MCM Newsletters

    Good morning, I am trying to create a Newsletter customize to the cq page launching the process. For that I have a Template Alert that by code is copied to tmp folder and fill out some attributes with the value of the page. Then is called the buildNe