aspose file tools*
The moose likes Struts and the fly likes validation problem for cost : struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validation problem for cost : struts2" Watch "validation problem for cost : struts2" New topic
Author

validation problem for cost : struts2

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi good morning,
in my application i had to do validation for cost i m doing server-side validations..i used regex for cost..but im not getting validated can any one help me out..here is the code
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
any help regarding my post
kranthi chamarthi
Ranch Hand

Joined: May 08, 2007
Posts: 95
It will be helpful if you provide us with what values your "field to be validated" can take and what values it shouldn't.
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
if i enter numbers it should take and also take decimal numbers such as '5,5.0,0.50' and if i enter alpha-numeric it should not take i had done the code change as follows

errors.number---enter only number
can you suggest me how to change my code according to my need..
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
i need is if i kept blank it should not throw error and also if i enter any thing other than numbers it should throw an error can any one suggest me how to do...
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
How about this?

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
i tried what you suggested but im not getting validated..here is my jsp code and validation.xml file

Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
I meant just the regex part of the expression. Try



Any regex must start with ^ and end with a $.
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
i didnt got your point..i tried using js..its working if i implement in struts2 in <field-validatio> im not getting.....i had done the same in reg ^[0-9]*\.?[0-9]+$
here is the code
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
any help regarding my post..i m not getting validated and if i left blank it should not throw an error..any help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validation problem for cost : struts2