Gary, I am using latest code from CVS 1.1.0-SNAPSHOT. In the comments it says that this fixed in 1.1.0-SNAPSHOT.
Problem is with the late binding in <val:validatorVar name="mask" value="#'{ bu.ALPHAONLY}" /> -Sanjay On 3/15/07, Gary VanMatre <[EMAIL PROTECTED]> wrote:
Please try the nightly build [1] This one was reported and should be fix [2]. [1] http://people.apache.org/builds/shale/nightly/ [2] https://issues.apache.org/struts/browse/SHALE-413 Gary -------------- Original message -------------- From: "Sanjay Choudhary" <[EMAIL PROTECTED]> > Hi Hermod, > > > for the following > > scenerio 1 > > value="#{BrokerRepresentative.companyName}" size="20"> > > maxlength="30" server="true" /> > > server="true" > client="false" message="#{bu.ALPHAONLY}"> > > > > if I input companyname = 123456 I see the message displayed that maps to > bu.ALPHAONLY but now when I change the above to > > scenerio 2 > > value="#{BrokerRepresentative.companyName}" size="20"> > > maxlength="30" server="true" /> > > server="true" > client="false" message="#{bu.ALPHAONLY}"> > > /> ------------------> changed here > > > > I get the null pointer exception. On further looking at the code I found > that following method returns null > > > /** > * Evaluate the expression. If it's a value reference, > * get the reference's value. > * Otherwise, return the expression. > * > * @param expression The expression > */ > public Object eval(String expression) { > if (expression == null) { > return null; > } > if (isValueReference(expression)) { > FacesContext context = FacesContext.getCurrentInstance(); > Application app = context.getApplication(); > return > app.createValueBinding(expression).getValue(context); ---------------> > this returns null. > } else { > return expression; > } > } > > Thing I don't understand is why will it return null in scenerio 2 whereas it > is successful in finding the same in scenerio 1. > > Also I there anyother way /solution to use the global masks. FYI, I am now > using 1.1.0-SNAPSHOT version > > -Sanjay > > On 3/15/07, Hermod Opstvedt wrote: > > > > Hi > > > > Since I use Clay, I solve this with symbols. Clay really makes life simple > > in these cases. Try using the validators "message" attribute along with > > the > > resourcebundle lookup. > > > > Hermod > > > > > > -----Opprinnelig melding----- > > Fra: Sanjay Choudhary [mailto:[EMAIL PROTECTED] > > Sendt: 15. mars 2007 16:45 > > Til: user@shale.apache.org > > Emne: Re: Defining mask globally > > > > Hi Hermod, > > > > I will try this. I have another question regards to the mask - Is it > > possible to display different message for each mask validation? Is there > > a > > way I can pass the message to each of the mask validation? > > > > > > For example - For this validation I may like to display "Only Alpha chars > > are allowed" > > > > server="true" > > client="false"> > > > > value="#'{bu.ALPHAONLY}'" > > /> > > > > > > and for this validation I may want to display - "Only numbers are allowed" > > > > server="true" > > client="false"> > > > > value="#'{bu.INTONLY}'" > > /> > > > > > > Thanks, > > Sanjay > > > > On 3/15/07, [EMAIL PROTECTED] wrote: > > > > > > Hi > > > > > > Haven't had a look at the code yet, but could you > > try: > > > name="mask" value="#{globalmask['name']}" /> > > > > > > Hermod > > > > > > -----Original Message----- > > > From: Sanjay Choudhary [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, March 14, 2007 11:03 PM > > > To: user@shale.apache.org; [EMAIL PROTECTED] > > > Subject: Re: Defining mask globally > > > > > > > > > Hi Hermod, > > > > > > I am using version 1.0.4 of shale-validator. > > > > > > Is this the right approach to manage the regex for the mask? > > > > > > I also double checked about typo error, that error was in email message > > > but > > > not in the code. > > > > > > Thanks > > > > > > > > > > > > > > > On 3/14/07, Hermod Opstvedt wrote: > > > > > > > > Hi > > > > > > > > Another question: Which version is this of shale-validator? The > > > > linenumbers > > > > don't match up with the current. > > > > > > > > Hermod > > > > > > > > > > > > -----Opprinnelig melding----- > > > > Fra: Sanjay Choudhary [mailto:[EMAIL PROTECTED] > > > > Sendt: 14. mars 2007 21:33 > > > > Til: user@shale.apache.org > > > > Emne: Defining mask globally > > > > > > > > hi > > > > > > > > I wish to define the global regex for masks in a common file. For > > > example > > > > , > > > > name field mask will be like ^[a-zA-Z]+$. > > > > > > > > > > > > value="#{BrokerRepresentative.name}" size="20"> > > > > > > > > server="true" > > > > client="false"> > > > > > > > value="^[a-zA-Z]+$" > > > > /> > > > > > > > > > > > > > > > > I wish to replace this with something like > > > > > > > > > > > > > > > > > > > > value="#{BrokerRepresentative.name}" size="20"> > > > > > > > > server="true" > > > > client="false"> > > > > > > > > > > > > > > > > > > > > This will enable me to validate the name field in a uniform way > > through > > > > out > > > > my application. Also if any change is need in regex then it needs to > > > > applied > > > > in one place. When I tried this solution I got > > > > > > > > > > > > java.lang.NullPointerException > > > > > > > > org.apache.shale.validator.CommonsValidator.convert( > > > CommonsValidator.java > > > > :95 > > > > 4) > > > > > > > > org.apache.shale.validator.CommonsValidator.loadMethodParamValues > > > > (CommonsVal > > > > idator.java:715) > > > > > > > > org.apache.shale.validator.CommonsValidator.validate( > > > CommonsValidator.java > > > > :7 > > > > 93) > > > > javax.faces.component.UIInput.validateValue(UIInput.java:781) > > > > javax.faces.component.UIInput.validate(UIInput.java:645) > > > > javax.faces.component.UIInput.executeValidate(UIInput.java > > :849) > > > > javax.faces.component.UIInput.processValidators(UIInput.java > > > :412) > > > > > > > > javax.faces.component.UIComponentBase.processValidators( > > > > UIComponentBase.java > > > > :912) > > > > javax.faces.component.UIForm.processValidators(UIForm.java > > :170) > > > > > > > > javax.faces.component.UIComponentBase.processValidators( > > > > UIComponentBase.java > > > > :912) > > > > > > > > javax.faces.component.UIComponentBase.processValidators( > > > > UIComponentBase.java > > > > :912) > > > > > > > > javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java > > :342) > > > > > > > > com.sun.faces.lifecycle.ProcessValidationsPhase.execute > > > > (ProcessValidationsPh > > > > ase.java:78) > > > > com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java > > > > :200) > > > > com.sun.faces.lifecycle.LifecycleImpl.execute( > > LifecycleImpl.java > > > > :90) > > > > javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) > > > > > > > > > > > > > > > > Any help /commens/ pointers appreciated to resolve this problem. I > > open > > > > to > > > > different solution too. > > > > > > > > > > > > Thanks, > > > > sanjay > > > > > > > > > > > > > > > > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > > * > > > * > > > > > > This email with attachments is solely for the use of the individual or > > > entity to whom it is addressed. Please also be aware that DnB NOR cannot > > > accept any payment orders or other legally binding correspondence with > > > customers as a part of an email. > > > > > > This email message has been virus checked by the anti virus programs > > used > > > in the DnB NOR Group. > > > > > > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > > * > > > * > > > > > > > > > >