RE: validation
Yes, that was a copy-mistake of me. In my app it is 'be.shop.service.ProductActions -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: dinsdag 18 augustus 2009 17:47 Aan: Struts Users Mailing List Onderwerp: Re: validation In your package, you define 2 action action name=addProduct class=be.shop.service.TestActions method=addProduct and action name=goToProducts class=be.shop.service.ProductActions method=goToProducts If you want the validation for addProduct, then you should have TestActions-addProduct-validation.xml instead of ProductActions-addProduct.validation.xml Louis From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Tuesday, August 18, 2009 7:32:06 AM Subject: RE: validation Hi, This is my projectstructure and the files you asked. Hope you see something wrong.. Thx, Sandy Dir structure (as i see it in explorer): Shop -.settings -src -main -java -be -shop -data -dataAccess -service -ProductActions.java -ProductActions-addProduct.validation.xml -webapp -includes menu.jsp -WEB-INF -classes -struts.properties -struts.xml -struts-tags.tld -web.xml -products.jsp -adress.jsp -test -java -target -pom.xml -.project -.classpath web.xml: web-app id=starter version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-nameStruts 2 - Maven Archetype - Starter/display-name filter filter-nameaction2-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter -class /filter filter filter-nameaction2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-cla ss /filter filter-mapping filter-nameaction2-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-nameaction2/filter-name url-pattern/*/url-pattern /filter-mapping welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list /web-app Struts.xml: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts constant name=struts.enable.DynamicMethodInvocation value=false / package name=shop namespace=/service extends=struts-default action name=addProduct class=be.shop.service.TestActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action action name=goToProducts class=be.shop.service.ProductActions method=goToProducts result/products.jsp/result result name=error/products.jsp/result /action /package /struts ProductActions-addProduct-validation.xml: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=minInclusive0.0/param param name=maxInclusive3.0/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 18:38 Aan: Struts Users Mailing List Onderwerp: Re: validation what I can guess here is your setup problem rather then the double field validator problem. Can you post ur full struts.xml, validation.xml and your directory structure where u put your files. From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 2:09:45 PM Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To:
RE: validation
I extended ActionSupport -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: woensdag 19 augustus 2009 12:17 Aan: Struts Users Mailing List Onderwerp: Re: validation Hi, In your action did you extends ActionSupport or implement Validateable ? Louis From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Wednesday, August 19, 2009 7:16:08 AM Subject: RE: validation Yes, that was a copy-mistake of me. In my app it is 'be.shop.service.ProductActions -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: dinsdag 18 augustus 2009 17:47 Aan: Struts Users Mailing List Onderwerp: Re: validation In your package, you define 2 action action name=addProduct class=be.shop.service.TestActions method=addProduct and action name=goToProducts class=be.shop.service.ProductActions method=goToProducts If you want the validation for addProduct, then you should have TestActions-addProduct-validation.xml instead of ProductActions-addProduct.validation.xml Louis From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Tuesday, August 18, 2009 7:32:06 AM Subject: RE: validation Hi, This is my projectstructure and the files you asked. Hope you see something wrong.. Thx, Sandy Dir structure (as i see it in explorer): Shop -.settings -src -main -java -be -shop -data -dataAccess -service -ProductActions.java -ProductActions-addProduct.validation.xml -webapp -includes menu.jsp -WEB-INF -classes -struts.properties -struts.xml -struts-tags.tld -web.xml -products.jsp -adress.jsp -test -java -target -pom.xml -.project -.classpath web.xml: web-app id=starter version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-nameStruts 2 - Maven Archetype - Starter/display-name filter filter-nameaction2-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter -class /filter filter filter-nameaction2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-cla ss /filter filter-mapping filter-nameaction2-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-nameaction2/filter-name url-pattern/*/url-pattern /filter-mapping welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list /web-app Struts.xml: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts constant name=struts.enable.DynamicMethodInvocation value=false / package name=shop namespace=/service extends=struts-default action name=addProduct class=be.shop.service.TestActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action action name=goToProducts class=be.shop.service.ProductActions method=goToProducts result/products.jsp/result result name=error/products.jsp/result /action /package /struts ProductActions-addProduct-validation.xml: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=minInclusive0.0/param param name=maxInclusive3.0/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 18:38 Aan: Struts Users Mailing List Onderwerp: Re: validation what I can guess here is your setup problem rather then the double field validator problem. Can you post ur full struts.xml, validation.xml and your directory structure where u put your files. From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009
RE: validation
Hi, This is my projectstructure and the files you asked. Hope you see something wrong.. Thx, Sandy Dir structure (as i see it in explorer): Shop -.settings -src -main -java -be -shop -data -dataAccess -service -ProductActions.java -ProductActions-addProduct.validation.xml -webapp -includes menu.jsp -WEB-INF -classes -struts.properties -struts.xml -struts-tags.tld -web.xml -products.jsp -adress.jsp -test -java -target -pom.xml -.project -.classpath web.xml: web-app id=starter version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-nameStruts 2 - Maven Archetype - Starter/display-name filter filter-nameaction2-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter -class /filter filter filter-nameaction2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-cla ss /filter filter-mapping filter-nameaction2-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-nameaction2/filter-name url-pattern/*/url-pattern /filter-mapping welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list /web-app Struts.xml: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts constant name=struts.enable.DynamicMethodInvocation value=false / package name=shop namespace=/service extends=struts-default action name=addProduct class=be.shop.service.TestActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action action name=goToProducts class=be.shop.service.ProductActions method=goToProducts result/products.jsp/result result name=error/products.jsp/result /action /package /struts ProductActions-addProduct-validation.xml: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=minInclusive0.0/param param name=maxInclusive3.0/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 18:38 Aan: Struts Users Mailing List Onderwerp: Re: validation what I can guess here is your setup problem rather then the double field validator problem. Can you post ur full struts.xml, validation.xml and your directory structure where u put your files. From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 2:09:45 PM Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the
RE: struts 2.1.5 type conversion error
Dusty, The error only shows if i enter '0' or a negative number in my double-field.. Not with positive numbers. Is this normal? Regards, Sandy -Oorspronkelijk bericht- Van: dusty [mailto:dustin_pea...@yahoo.com] Verzonden: dinsdag 18 augustus 2009 6:37 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error The error/warning you are talking about happens when the conversion fails. Essentially, after it tries the conversion and can't do it then it tries to apply the setXXX(String xxx), but that really is not what you want at all. When you are using your own converters you want to be able to return a NULL for example when you get a and you are expecting an id to convert to some kind of object. newton.dave wrote: sandy.verfai...@roularta.be wrote: I've changed my original setter to setStockAmountInt(int stockAmount), and kept setStockAmount(String stockAmount) so it could be used by the default ognl conversion. Now I can work without errors, but it seems kind of strange to me that this is the normal way of working, is it? No; you shouldn't need to do that (and you're breaking JavaBean convention by doing so). The default type conversion should be converting the form values to int automatically. If it's not, something is very wrong, because this functionality has been working for a very long time. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/struts-2.1.5-type-conversion-error-tp24534638p2501 8347.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: struts 2.1.5 type conversion error
Thank you very much! -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: dinsdag 18 augustus 2009 16:00 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error That is because you are using Struts 2.1.5. There is a bug in the type conversion for doubles in XWork which is fixed in the current version (XWork 2.1.4). When you enter a zero it claims it is not a valid value. To use XWork 2.1.4 you need Struts 2.1.7. I have just sent the zips I promised and you will find since I used 2.1.7 that negative numbers and zero work. -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Tue, Aug 18, 2009 4:43 am Subject: RE: struts 2.1.5 type conversion error Dusty, The error only shows if i enter '0' or a negative number in my double-field.. Not with positive numbers. Is this normal? Regards, Sandy -Oorspronkelijk bericht- Van: dusty [mailto:dustin_pea...@yahoo.com] Verzonden: dinsdag 18 augustus 2009 6:37 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error The error/warning you are talking about happens when the conversion fails. Essentially, after it tries the conversion and can't do it then it tries to apply the setXXX(String xxx), but that really is not what you want at all. When you are using your own converters you want to be able to return a NULL for example when you get a and you are expecting an id to convert to some kind of object. newton.dave wrote: sandy.verfai...@roularta.be wrote: I've changed my original setter to setStockAmountInt(int stockAmount), and kept setStockAmount(String stockAmount) so it could be used by the default ognl conversion. Now I can work without errors, but it seems kind of strange to me that this is the normal way of working, is it? No; you shouldn't need to do that (and you're breaking JavaBean convention by doing so). The default type conversion should be converting the form values to int automatically. If it's not, something is very wrong, because this functionality has been working for a very long time. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/struts-2.1.5-type-conversion-error-tp24534638p2501 8347.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: struts 2.1.5 type conversion error
Martin, Then why are there validator xmls in which you can say what type your input should be? Shall I give all my int variables in my class a String-setter? Thx for the answer, Sandy -Oorspronkelijk bericht- Van: Martin Gainty [mailto:mgai...@hotmail.com] Verzonden: donderdag 13 augustus 2009 18:45 Aan: Struts Users Mailing List Onderwerp: RE: struts 2.1.5 type conversion error http transmits strings (not int,double,date or any other type of primitive) Martin Gainty je ne suis pas d'accord avec ce que vous dites. mais je défendrai à ma mort votre droite de la dire. - Voltaire __ Note de déni et de confidentialité Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: struts 2.1.5 type conversion error Date: Thu, 13 Aug 2009 16:11:55 +0200 From: sandy.verfai...@roularta.be To: user@struts.apache.org Lukasz, The type of 'price' is a double.. Thx for answering. Regards, sandy -Oorspronkelijk bericht- Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Verzonden: woensdag 22 juli 2009 9:50 Aan: Struts Users Mailing List Onderwerp: Re: struts 2.1.5 type conversion error 2009/7/17 sandy.verfai...@roularta.be: s:form action=addProduct method=post validate=true Name nls:textfield name=nameNl / prices:textfield name=price value=/ /s:form What type has price in action class? Regards -- Lukasz http://www.lenart.org.pl/ http://dailylog.lenart.org.pl/ Charles de Gaulle - The better I get to know men, the more I find myself loving dogs. - http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Get your vacation photos on your phone! http://windowsliveformobile.com/en-us/photos/default.aspx?OCID=0809TL-HM - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: struts 2.1.5 type conversion error
Eduard, I have in my class: private int stockAmount; public void setStockAmount(int stockAmount) { this.stockAmount = stockAmount; } public int getStockAmount() { return stockAmount; } public void setStockAmount(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } And in my jsp: s:form action=addProduct method=post validate=true namespace=/service Stockamounts:textfield name=stockAmount / /s:form When I enter a number in stockamount (above 0) it goes well, when i enter a letter it goes wrong, saying 'no such method error setStockAmount(java.lang.String) I have no conversion xml or class-name.properties file.. Regards, SAndy -Oorspronkelijk bericht- Van: Eduard Neuwirt [mailto:eduard.neuw...@googlemail.com] Verzonden: maandag 17 augustus 2009 9:38 Aan: Struts Users Mailing List Onderwerp: Re: struts 2.1.5 type conversion error Hi Sandy, please use additionally to the conversion xml the of the declaration corresponding member attributes as double, int etc. I think there are several examples for the class-name.properties files. Regards Eduard Neuwirt sandy.verfai...@roularta.be schrieb: Martin, Then why are there validator xmls in which you can say what type your input should be? Shall I give all my int variables in my class a String-setter? Thx for the answer, Sandy -Oorspronkelijk bericht- Van: Martin Gainty [mailto:mgai...@hotmail.com] Verzonden: donderdag 13 augustus 2009 18:45 Aan: Struts Users Mailing List Onderwerp: RE: struts 2.1.5 type conversion error http transmits strings (not int,double,date or any other type of primitive) Martin Gainty je ne suis pas d'accord avec ce que vous dites. mais je défendrai à ma mort votre droite de la dire. - Voltaire __ Note de déni et de confidentialité Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: struts 2.1.5 type conversion error Date: Thu, 13 Aug 2009 16:11:55 +0200 From: sandy.verfai...@roularta.be To: user@struts.apache.org Lukasz, The type of 'price' is a double.. Thx for answering. Regards, sandy -Oorspronkelijk bericht- Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Verzonden: woensdag 22 juli 2009 9:50 Aan: Struts Users Mailing List Onderwerp: Re: struts 2.1.5 type conversion error 2009/7/17 sandy.verfai...@roularta.be: s:form action=addProduct method=post validate=true Name nls:textfield name=nameNl / prices:textfield name=price value=/ /s:form What type has price in action class? Regards -- Lukasz http://www.lenart.org.pl/ http://dailylog.lenart.org.pl/ Charles de Gaulle - The better I get to know men, the more I find myself loving dogs. - http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Get your vacation photos on your phone! http://windowsliveformobile.com/en-us/photos/default.aspx?OCID=0809TL-HM - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
validation
Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy
RE: validation
Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: struts 2.1.5 type conversion error
Chris, I've changed my original setter to setStockAmountInt(int stockAmount), and kept setStockAmount(String stockAmount) so it could be used by the default ognl conversion. Now I can work without errors, but it seems kind of strange to me that this is the normal way of working, is it? Regards, sandy -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 11:53 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error OGNL properties are JavaBean properties. In your case you are trying to define the property stockAmount twice with two different types. Instead of overloading the setter give it a different name: public void setStockAmountStr(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } Now you have two properties even though the data is in one field. Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 4:26 am Subject: RE: struts 2.1.5 type conversion error Eduard, I have in my class: private int stockAmount; public void setStockAmount(int stockAmount) { this.stockAmount = stockAmount; } public int getStockAmount() { return stockAmount; } public void setStockAmount(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } And in my jsp: s:form action=addProduct method=post validate=true namespace=/service Stockamounts:textfield name=stockAmount / /s:form When I enter a number in stockamount (above 0) it goes well, when i enter a letter it goes wrong, saying 'no such method error setStockAmount(java.lang.String) I have no conversion xml or class-name.properties file.. Regards, SAndy -Oorspronkelijk bericht- Van: Eduard Neuwirt [mailto:eduard.neuw...@googlemail.com] Verzonden: maandag 17 augustus 2009 9:38 Aan: Struts Users Mailing List Onder werp: Re: struts 2.1.5 type conversion error Hi Sandy, please use additionally to the conversion xml the of the declaration corresponding member attributes as double, int etc. I think there are several examples for the class-name.properties files. Regards Eduard Neuwirt sandy.verfai...@roularta.be schrieb: Martin, Then why are there validator xmls in which you can say what type your input should be? Shall I give all my int variables in my class a String-setter? Thx for the answer, Sandy -Oorspronkelijk bericht- Van: Martin Gainty [mailto:mgai...@hotmail.com] Verzonden: donderdag 13 augustus 2009 18:45 Aan: Struts Users Mailing List Onderwerp: RE: struts 2.1.5 type conversion error http transmits strings (not int,double,date or any other type of primitive) Martin Gainty je ne suis pas d'accord avec ce que vous dites. mais je défendrai à ma mort votre droite de la dire. - Voltaire __ Note de déni et de confidentialité Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, no us ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: struts 2.1.5 type conversion error Date: Thu, 13 Aug 2009 16:11:55 +0200 From: sandy.verfai...@roularta.be To: user@struts.apache.org Lukasz, The type of 'price' is a double.. Thx for answering. Regards, sandy -Oorspronkelijk bericht- Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Verzonden: woensdag 22 juli 2009 9:50 Aan: Struts Users Mailing List Onderwerp: Re: struts 2.1.5 type conversion error 2009/7/17 sandy.verfai...@roularta.be: s:form action=addProduct method=post validate=true Name nls:textfield name=nameNl / prices:textfield name=price value=/ /s:form What type has price in action class? Regards -- Lukasz http://www.lenart.org.pl/ http://dailylog.lenart.org.pl/ Charles de Gaulle - The better I get to know men, the more I find myself loving dogs. - http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Get your vacation photos on your phone!
RE: validation
Thx, I chenged my validator to: field name=weight field-validator type=double param name=minInclusive0/param param name=maxInclusive3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field But the problem isn't solved.. Should I use some tags that show the output of my validation on my form? The fact that my debugger gets in the action, it means that my validationinterceptor isn't reached, right? -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 13:46 Aan: user@struts.apache.org Onderwerp: Re: validation The names of the params for double validator are different from those of int validator. Instead of max and min your choices are minInclusive maxInclusive minExclusive maxExclusive Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 7:26 am Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: validation
Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: validation
I have my package -be.shop.service Which contains ProductActions.java and ProductActions-addProduct-validation.xml In my struts.xml i have the package tag: package name=shop extends=struts-default namespace=/service In my jsp page i have the form tag: s:form action=addProduct method=post validate=true namespace=/service I assume that my packagedeclaration in struts.xml isn't right? I'm not sure what the difference is between name, namespace and package? -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 14:07 Aan: user@struts.apache.org Onderwerp: Re: validation In the products.jsp you assume the action? addProduct to be in the /service namespace but? shop package which contains the action is not in the /service namespace. Try package name=shop namespace=/service extends=struts-default -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 7:54 am Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: validation
Pawe, Yes addProduct is called in the ProductActions in be.shop.service It is unclear to me what I should use for 'name' and for 'namespace' in the package-tag. It should be called right away, the validationintercepter should be progressed first.; Sandy -Oorspronkelijk bericht- Van: Paweł Wielgus [mailto:poulw...@gmail.com] Verzonden: maandag 17 augustus 2009 14:35 Aan: Struts Users Mailing List Onderwerp: Re: validation Hi Sandy, is your addProduct method in ProductActions action being called? it is unclear for me how would it happen, because You are referencing addProduct action in /service namespace which would normally be some_base_actions_package.service.AddProductAction.java Is it done with REST? Best greetings, Paweł Wielgus. 2009/8/17 sandy.verfai...@roularta.be: I have my package -be.shop.service Which contains ProductActions.java and ProductActions-addProduct-validation.xml In my struts.xml i have the package tag: package name=shop extends=struts-default namespace=/service In my jsp page i have the form tag: s:form action=addProduct method=post validate=true namespace=/service I assume that my packagedeclaration in struts.xml isn't right? I'm not sure what the difference is between name, namespace and package? -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 14:07 Aan: user@struts.apache.org Onderwerp: Re: validation In the products.jsp you assume the action? addProduct to be in the /service namespace but? shop package which contains the action is not in the /service namespace. Try package name=shop namespace=/service extends=struts-default -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 7:54 am Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail:
RE: validation
Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: validation
Thx for the effort chris! Can you tell me what the outcome should be? I expect 'Weight has to be numeric and can't be less than 0. ' right next to the weight textfield? Right now i just get internal server error, but i'm working on it.. -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 15:28 Aan: user@struts.apache.org Onderwerp: Re: validation ok -- I used as much of your code as you have posted and put a working version at http://pastie.org/585837 Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 2:09 pm Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: validation
Martin, I changed my param values to double formatted values. But it doesn't help. Thx anyway. Sandy -Oorspronkelijk bericht- Van: Martin Gainty [mailto:mgai...@hotmail.com] Verzonden: maandag 17 augustus 2009 16:26 Aan: Struts Users Mailing List Onderwerp: RE: validation check if you are validating double formatted numerics (instead of ints) field name=percentage field-validator type=double param name=minExclusive0.1/param param name=maxExclusive10.1/param messagepercentage must be between ${minExclusive} and ${maxExclusive}/message /field-validator /field (notice the 99.9 format) Martin Gainty __ Note de déni et de confidentialité Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Subject: RE: validation Date: Mon, 17 Aug 2009 15:51:30 +0200 From: sandy.verfai...@roularta.be To: user@struts.apache.org Thx for the effort chris! Can you tell me what the outcome should be? I expect 'Weight has to be numeric and can't be less than 0. ' right next to the weight textfield? Right now i just get internal server error, but i'm working on it.. -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 15:28 Aan: user@struts.apache.org Onderwerp: Re: validation ok -- I used as much of your code as you have posted and put a working version at http://pastie.org/585837 Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 2:09 pm Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center
RE: validation
Chris, Your version doesn't work for me neither.. Maybe you can tell me the paths of each file you putted at pastie? Anyway, I can not pass a double value from my jsp file to my actionclass. Then I get the error 'no such method found for 'setPrice(java.lang.String)''. So I make a setter with a string and convert it. Assuming the value would be already parsed in the validation xml,so my conversion will work. Is this normal? Regards, Sandy -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 15:28 Aan: user@struts.apache.org Onderwerp: Re: validation ok -- I used as much of your code as you have posted and put a working version at http://pastie.org/585837 Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 2:09 pm Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: package name=shop extends=struts-default I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends=struts-default in your package? or may be just put this default-interceptor-ref name=defaultStack / in your package to check From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: sandy.verfai...@roularta.be sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... s:head/ /head ... s:fielderror / s:actionerror / s:form action=addProduct method=post validate=true namespace=/service weight: s:textfield name=weight / s:submit value=addProduct align=center cssClass=button / /s:form ... In struts.xml I have: action name=addProduct class=be.shop.service.ProductActions method=addProduct result name=input/products.jsp/result result/products.jsp/result result name=error/products.jsp/result /action In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=weight field-validator type=double param name=min0/param param name=max3/param messageWeight has to be numeric and can't be less than 0./message /field-validator /field /validators thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: struts 2.1.5 type conversion error
Lukasz, The type of 'price' is a double.. Thx for answering. Regards, sandy -Oorspronkelijk bericht- Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Verzonden: woensdag 22 juli 2009 9:50 Aan: Struts Users Mailing List Onderwerp: Re: struts 2.1.5 type conversion error 2009/7/17 sandy.verfai...@roularta.be: s:form action=addProduct method=post validate=true Name nls:textfield name=nameNl / prices:textfield name=price value=/ /s:form What type has price in action class? Regards -- Lukasz http://www.lenart.org.pl/ http://dailylog.lenart.org.pl/ Charles de Gaulle - The better I get to know men, the more I find myself loving dogs. - http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts 2.1.5 type conversion error
Hi, I have made a simple struts form s:form action=addProduct method=post validate=true Name nls:textfield name=nameNl / prices:textfield name=price value=/ /s:form And an action class with getters and setters for nameNl and price. When I submit my form, with a price 0, for example 3, everything goes well. When I enter 0 or a negative number, I get the following error: java.lang.NoSuchMethodException: setPrice([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.j ava:75) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectA ccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656) ... I know this has been posted a few times, but I can't find an answer anywhere.. Is this a bug? And how can I resolve it? I found something at: https://issues.apache.org/struts/browse/WW-2971?page=com.atlassian.jira. plugin.system.issuetabpanels%3Aall-tabpanel https://issues.apache.org/struts/browse/WW-2971?page=com.atlassian.jira .plugin.system.issuetabpanels%3Aall-tabpanelbut but I have no idea what I should do with that article, or with the zip in attchement on that article. Can anyone help me pls? Thx, Sandy
integer values in struts forms
Hi, I have made a struts form: s:form action=addProduct method=POST Name nls:textfield name=productNameNl / price: s:textfield name=productPrice value=/ /s:form and the mapped actionclassmethod addProduct with: public String addProduct(){ Product p = new Product(productNameNl, productPrice); ProductDA.getInstance().addProduct(p); return SUCCESS; } public void setProductNameNl(String productNameNl) { this.productNameNl = productNameNl; } public String getProductNameNl() { return productNameNl; } public void setProductPrice(double productPrice) { this.productPrice = productPrice; } public double getProductPrice() { return productPrice; } When I run my jsp with that form, everything goes well when I enter for example 3 or 5 in the pricebox. But when I enter 0 (not the letter O, but zero), 0,0 or a letter i get the error message: /-- Encapsulated exception \ java.lang.NoSuchMethodException: setProductPrice([Ljava.lang.String;) Why doesn't it recognize a zero as a double, but as a string? I think with a validation xml the problem with the letters will be solved? Any help would be appreciated! Thx, Sandy
checkboxlist
Hi, Can anyone tell me how I can make a checkboxlist on my jsp that knows which checkbox should be checked and which not. I have my list of objects with three strings. string1: name (label for the checkbox) string2: key (value that identifies which object is checked) string3: true or false (that says if that checkbox should already be checked) But for the checkboxlist tag I see only the listValue and listKey parameters that write a property of the object. All the other properties are not dependent on the object of the list.. Thx,
advanced dateTimePicker
Hi, Does someone knows an advanced dateTimePicker? For example: - An attribute 'available dates' of type list, that enables the dates in the list and disables others? - Coupling a struts action to when you click on one or more dates on the calendar. - Not in a dropdown, but simply a calendar on the jsp page - ... Thanks, Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org