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="min">0</param>
<param name="max">3</param>
<message>Weight 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

Reply via email to