RE: Validator not getting called and I can't see why [resolved]
I had a similar problem here. I used formdef to define the page attribute and didn't specify the type. When the cast was made inside of validator, it was unable to cast the value to an Integer. The field was a string containing the page number. Couldn't it use Integer.valueOf? -Original Message- From: Bart Busschots [mailto:[EMAIL PROTECTED] Sent: Sunday, August 06, 2006 3:33 PM To: Struts Users Mailing List Subject: Re: Validator not getting called and I can't see why [resolved] OK, I got all this figured out in the end. The validator was being called but because of problems with the page attribute in the form the validator appears to have been receiving a page value of zero and hence not validating the items on pages 1 or two because neither 1 nor 2 are less that or equal to zero! When I did get the validator to be called it still wasn't working right but I got that fixed too. Anyhow, I did up a blog post about it which can be found here: http://www.bartbusschots.ie/blog/?p=262 If people thing an edited version of this would be a useful addition to the Wiki work away, just credit me or link to the original blog post and I'll be more than happy. Cheers for your help guys, Bart. Bart Busschots wrote: > I'm either missing something stupid (which is always possible) or I've > managed to break the validator. I have an app that uses validator all > over the place and it's working fine in all my other actions but for > this one action it is simply not getting called. > > I can't see any difference between this action/form/validation and all > the other ones that are working. > > This is the form: > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > > > > This is the action: > > type="vtie.portal.mentor.CreateStudentGroupPrepareAction" > name="createStudentGroupForm" scope="session" validate="true" > input="/home/mentor/addStudentGroupForm.jsp"> >path="/do/mentor/createAnonymousStudentGroup" /> >path="/home/mentor/getStudentNamesForm.jsp" /> > > > > And this is the validation: > > > >mask^[a-zA-Z]+[\w\ > ]*$ > > > > > > > > > > > Can anyone see something obviously wrong there? > > Cheers, > > Bart. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator not getting called and I can't see why [resolved]
Romu wrote: U mean a javascript error ? No, I don't use clientside validation on my forms. It's going to the server anyhow so I don't see the point, just an extra layer for things to not work in. u need to define a message.properties file too which will define the error messa Good point, post edited. Bart. 2006/8/6, Bart Busschots <[EMAIL PROTECTED]>: OK, I got all this figured out in the end. The validator was being called but because of problems with the page attribute in the form the validator appears to have been receiving a page value of zero and hence not validating the items on pages 1 or two because neither 1 nor 2 are less that or equal to zero! When I did get the validator to be called it still wasn't working right but I got that fixed too. Anyhow, I did up a blog post about it which can be found here: http://www.bartbusschots.ie/blog/?p=262 If people thing an edited version of this would be a useful addition to the Wiki work away, just credit me or link to the original blog post and I'll be more than happy. Cheers for your help guys, Bart. Bart Busschots wrote: > I'm either missing something stupid (which is always possible) or I've > managed to break the validator. I have an app that uses validator all > over the place and it's working fine in all my other actions but for > this one action it is simply not getting called. > > I can't see any difference between this action/form/validation and all > the other ones that are working. > > This is the form: > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > > > > This is the action: > > type="vtie.portal.mentor.CreateStudentGroupPrepareAction" > name="createStudentGroupForm" scope="session" validate="true" > input="/home/mentor/addStudentGroupForm.jsp"> >path="/do/mentor/createAnonymousStudentGroup" /> >path="/home/mentor/getStudentNamesForm.jsp" /> > > > > And this is the validation: > > > >mask^[a-zA-Z]+[\w\ > ]*$ > > > > > > > > > > > Can anyone see something obviously wrong there? > > Cheers, > > Bart. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator not getting called and I can't see why [resolved]
for example : mentor.createStudentGroup .groupName.label = the Student Group Name 2006/8/7, Romu <[EMAIL PROTECTED]>: U mean a javascript error ? u need to define a message.properties file too which will define the error messa 2006/8/6, Bart Busschots < [EMAIL PROTECTED]>: > OK, I got all this figured out in the end. > > The validator was being called but because of problems with the page > attribute in the form the validator appears to have been receiving a > page value of zero and hence not validating the items on pages 1 or two > because neither 1 nor 2 are less that or equal to zero! When I did get > the validator to be called it still wasn't working right but I got that > fixed too. > > Anyhow, I did up a blog post about it which can be found here: > http://www.bartbusschots.ie/blog/?p=262 > > If people thing an edited version of this would be a useful addition to > the Wiki work away, just credit me or link to the original blog post and > I'll be more than happy. > > Cheers for your help guys, > > Bart. > > Bart Busschots wrote: > > I'm either missing something stupid (which is always possible) or I've > > managed to break the validator. I have an app that uses validator all > > over the place and it's working fine in all my other actions but for > > this one action it is simply not getting called. > > > > I can't see any difference between this action/form/validation and all > > the other ones that are working. > > > > This is the form: > > > > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > > > > > > > > > > > > This is the action: > > > > > type="vtie.portal.mentor.CreateStudentGroupPrepareAction" > > name="createStudentGroupForm" scope="session" validate="true" > > input="/home/mentor/addStudentGroupForm.jsp"> > >> path="/do/mentor/createAnonymousStudentGroup" /> > >> path="/home/mentor/getStudentNamesForm.jsp" /> > > > > > > > > And this is the validation: > > > > > > > >mask^[a-zA-Z]+[\w\ > > ]*$ > > > > > > > > > > > > > > > > > > > > > > Can anyone see something obviously wrong there? > > > > Cheers, > > > > Bart. > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Validator not getting called and I can't see why [resolved]
U mean a javascript error ? u need to define a message.properties file too which will define the error messa 2006/8/6, Bart Busschots <[EMAIL PROTECTED]>: OK, I got all this figured out in the end. The validator was being called but because of problems with the page attribute in the form the validator appears to have been receiving a page value of zero and hence not validating the items on pages 1 or two because neither 1 nor 2 are less that or equal to zero! When I did get the validator to be called it still wasn't working right but I got that fixed too. Anyhow, I did up a blog post about it which can be found here: http://www.bartbusschots.ie/blog/?p=262 If people thing an edited version of this would be a useful addition to the Wiki work away, just credit me or link to the original blog post and I'll be more than happy. Cheers for your help guys, Bart. Bart Busschots wrote: > I'm either missing something stupid (which is always possible) or I've > managed to break the validator. I have an app that uses validator all > over the place and it's working fine in all my other actions but for > this one action it is simply not getting called. > > I can't see any difference between this action/form/validation and all > the other ones that are working. > > This is the form: > > type="org.apache.struts.validator.DynaValidatorForm"> > > > > > > > > This is the action: > > type="vtie.portal.mentor.CreateStudentGroupPrepareAction" > name="createStudentGroupForm" scope="session" validate="true" > input="/home/mentor/addStudentGroupForm.jsp"> >path="/do/mentor/createAnonymousStudentGroup" /> >path="/home/mentor/getStudentNamesForm.jsp" /> > > > > And this is the validation: > > > >mask^[a-zA-Z]+[\w\ > ]*$ > > > > > > > > > > > Can anyone see something obviously wrong there? > > Cheers, > > Bart. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator not getting called and I can't see why [resolved]
OK, I got all this figured out in the end. The validator was being called but because of problems with the page attribute in the form the validator appears to have been receiving a page value of zero and hence not validating the items on pages 1 or two because neither 1 nor 2 are less that or equal to zero! When I did get the validator to be called it still wasn't working right but I got that fixed too. Anyhow, I did up a blog post about it which can be found here: http://www.bartbusschots.ie/blog/?p=262 If people thing an edited version of this would be a useful addition to the Wiki work away, just credit me or link to the original blog post and I'll be more than happy. Cheers for your help guys, Bart. Bart Busschots wrote: I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: type="org.apache.struts.validator.DynaValidatorForm"> This is the action: type="vtie.portal.mentor.CreateStudentGroupPrepareAction" name="createStudentGroupForm" scope="session" validate="true" input="/home/mentor/addStudentGroupForm.jsp"> path="/do/mentor/createAnonymousStudentGroup" /> path="/home/mentor/getStudentNamesForm.jsp" /> And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: Validator not getting called and I can't see why
Just curios - that's the only createStudentGroupForm instance in your struts config? Since DynaValidatorForm extends DynaActionForm it inherits' the DynaActionForm toString - which always just starts off with "DynaActionForm[..." - in the action, can you log the actual class (form.getClass().getName()) to see what the actual class is - it could be that struts thinks you only have a DynaActionForm instead of a DynaValidatorForm. Cheers, Matt On 8/4/06, Bart Busschots <[EMAIL PROTECTED]> wrote: Hi Niall, I don't seem to be able to get log output form the validator. Maybe I'm doing something wrong? This is my commons-logging.properties file: org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog org.apache.commons.logging.simplelog.defaultlog=debug org.apache.commons.logging.simplelog.showlogname=true org.apache.commons.logging.simplelog.showdatetime=true And this is my simplelog.properties file: org.apache.commons.logging.simplelog.log.org.apache.struts.validator=trace This is not producing any output from the validator at all so I set the default log level to debug and then I see this when I submit the form that is not being validated with no data at all entered (note that every field depends on required): [DEBUG] ModuleUtils - Get module name for path /do [DEBUG] ModuleUtils - Module name found: default [DEBUG] RequestProcessor - Processing a 'POST' for path '/mentor/createStudentGroupStep1' [DEBUG] RequestUtils - Looking for ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestUtils - Can recycle existing DynaActionForm instance of type 'createStudentGroupForm'?: true [DEBUG] RequestProcessor - Storing ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestProcessor - Populating bean properties from this request [DEBUG] BeanUtils - BeanUtils.populate(DynaActionForm[dynaClass=createStudentGroupForm,wikiText=,noStudents=,groupName=,groupType=MINORS,studentNames={}], {wikiText=[Ljava.lang.String;@c8d24, page=[Ljava.lang.String;@666b9, noStudents=[Ljava.lang.String;@4200d3, groupName=[Ljava.lang.String;@443251, groupType=[Ljava.lang.String;@438e8c}) [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string 'MINORS' to class 'java.lang.String' [DEBUG] RequestProcessor - Validating input form properties [DEBUG] RequestProcessor - Looking for Action instance for class vtie.portal.mentor.CreateStudentGroupPrepareAction [DEBUG] PropertyMessageResources - getMessage(en_US,unhandledException) [WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NumberFormatException To my un-trained eye this looks like the validator is being called but not doing what it should, i.e. throwing a wobbler when it gets no data in any field. The validation for the form in validation.xml is as follows: mask^[a-zA-Z]+[\w\ ]*$ Does any of this make sense to you and can you see anything odd in the traces above? Thanks, Bart. Niall Pemberton wrote: > Try turning on logging in debug mode, should give you more info about > what its doing. > > Niall > > On 8/3/06, Bart Busschots <[EMAIL PROTECTED]> wrote: >> I'm either missing something stupid (which is always possible) or I've >> managed to break the validator. I have an app that uses validator all >> over the place and it's working fine in all my other actions but for >> this one action it is simply not getting called. >> >> I can't see any difference between this action/form/validation and all >> the other ones that are working. >> >> This is the form: >> >> > type="org.apache.struts.validator.DynaValidatorForm"> >> >> >> >> >> >> >> >> This is the action: >> >> > type="vtie.portal.mentor.CreateStudentGroupPrepareAction" >> name="createStudentGroupForm" scope="session" validate="true" >> input="/home/mentor/addStudentGroupForm.jsp"> >>> path="/do/mentor/createAnonymousStudentGroup" /> >>> path="/home/mentor/getStudentNamesForm.jsp" /> >> >> >> >> And this is the validation: >> >> >> >> mask^[a-zA-Z]+[\w\ >> ]*$ >> >> >> >> >> >> >> >> >> >> >> Can anyone see something obviously wrong there? >> >> Cheers, >> >> Bart. >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE
Re: Validator not getting called and I can't see why
On 8/5/06, Bart Busschots <[EMAIL PROTECTED]> wrote: Hi Niall, I don't seem to be able to get log output form the validator. Maybe I'm doing something wrong? This is my commons-logging.properties file: org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog org.apache.commons.logging.simplelog.defaultlog=debug org.apache.commons.logging.simplelog.showlogname=true org.apache.commons.logging.simplelog.showdatetime=true And this is my simplelog.properties file: org.apache.commons.logging.simplelog.log.org.apache.struts.validator=trace This is not producing any output from the validator at all so I set the default log level to debug and then I see this when I submit the form that is not being validated with no data at all entered (note that every field depends on required): [DEBUG] ModuleUtils - Get module name for path /do [DEBUG] ModuleUtils - Module name found: default [DEBUG] RequestProcessor - Processing a 'POST' for path '/mentor/createStudentGroupStep1' [DEBUG] RequestUtils - Looking for ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestUtils - Can recycle existing DynaActionForm instance of type 'createStudentGroupForm'?: true [DEBUG] RequestProcessor - Storing ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestProcessor - Populating bean properties from this request [DEBUG] BeanUtils - BeanUtils.populate(DynaActionForm[dynaClass=createStudentGroupForm,wikiText=,noStudents=,groupName=,groupType=MINORS,studentNames={}], {wikiText=[Ljava.lang.String;@c8d24, page=[Ljava.lang.String;@666b9, noStudents=[Ljava.lang.String;@4200d3, groupName=[Ljava.lang.String;@443251, groupType=[Ljava.lang.String;@438e8c}) [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string 'MINORS' to class 'java.lang.String' [DEBUG] RequestProcessor - Validating input form properties [DEBUG] RequestProcessor - Looking for Action instance for class vtie.portal.mentor.CreateStudentGroupPrepareAction [DEBUG] PropertyMessageResources - getMessage(en_US,unhandledException) [WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NumberFormatException To my un-trained eye this looks like the validator is being called but not doing what it should, i.e. throwing a wobbler when it gets no data in any field. The validation for the form in validation.xml is as follows: mask^[a-zA-Z]+[\w\ ]*$ Does any of this make sense to you and can you see anything odd in the traces above? Validator is throwing a wobbler like you said. You have the DEBUG message from the RequestProcessor before it does validation - but there should be one after saying either there were errors or that everything was OK. You need to find out what the exception being thrown is for - create a custom DynaValidatorForm and trap the exception and get the cause. The other thing that someone else pointed out is that you have used the "page" attribute in your validation.xml, but not defined it as a property for your DynaValidatorForm - so maybe its something to do with that. Anyway the root of the problem is the exception being throw - find out what that is and it should shed a whole lot more light on the problem. Niall Thanks, Bart. Niall Pemberton wrote: > Try turning on logging in debug mode, should give you more info about > what its doing. > > Niall > > On 8/3/06, Bart Busschots <[EMAIL PROTECTED]> wrote: >> I'm either missing something stupid (which is always possible) or I've >> managed to break the validator. I have an app that uses validator all >> over the place and it's working fine in all my other actions but for >> this one action it is simply not getting called. >> >> I can't see any difference between this action/form/validation and all >> the other ones that are working. >> >> This is the form: >> >> > type="org.apache.struts.validator.DynaValidatorForm"> >> >> >> >> >> >> >> >> This is the action: >> >> > type="vtie.portal.mentor.CreateStudentGroupPrepareAction" >> name="createStudentGroupForm" scope="session" validate="true" >> input="/home/mentor/addStudentGroupForm.jsp"> >>> path="/do/mentor/createAnonymousStudentGroup" /> >>> path="/home/mentor/getStudentNamesForm.jsp" /> >> >> >> >> And this is the validation: >> >> >> >> mask^[a-zA-Z]+[\w\ >> ]*$ >> >> >> >> >> >> >> >> >> >> >> Can anyone see something obviously wrong there? >> >> Cheers, >> >> Bart. >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --
Re: Validator not getting called and I can't see why
Hi Niall, I don't seem to be able to get log output form the validator. Maybe I'm doing something wrong? This is my commons-logging.properties file: org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog org.apache.commons.logging.simplelog.defaultlog=debug org.apache.commons.logging.simplelog.showlogname=true org.apache.commons.logging.simplelog.showdatetime=true And this is my simplelog.properties file: org.apache.commons.logging.simplelog.log.org.apache.struts.validator=trace This is not producing any output from the validator at all so I set the default log level to debug and then I see this when I submit the form that is not being validated with no data at all entered (note that every field depends on required): [DEBUG] ModuleUtils - Get module name for path /do [DEBUG] ModuleUtils - Module name found: default [DEBUG] RequestProcessor - Processing a 'POST' for path '/mentor/createStudentGroupStep1' [DEBUG] RequestUtils - Looking for ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestUtils - Can recycle existing DynaActionForm instance of type 'createStudentGroupForm'?: true [DEBUG] RequestProcessor - Storing ActionForm bean instance in scope 'session' under attribute key 'createStudentGroupForm' [DEBUG] RequestProcessor - Populating bean properties from this request [DEBUG] BeanUtils - BeanUtils.populate(DynaActionForm[dynaClass=createStudentGroupForm,wikiText=,noStudents=,groupName=,groupType=MINORS,studentNames={}], {wikiText=[Ljava.lang.String;@c8d24, page=[Ljava.lang.String;@666b9, noStudents=[Ljava.lang.String;@4200d3, groupName=[Ljava.lang.String;@443251, groupType=[Ljava.lang.String;@438e8c}) [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string '' to class 'java.lang.String' [DEBUG] ConvertUtils - Convert string 'MINORS' to class 'java.lang.String' [DEBUG] RequestProcessor - Validating input form properties [DEBUG] RequestProcessor - Looking for Action instance for class vtie.portal.mentor.CreateStudentGroupPrepareAction [DEBUG] PropertyMessageResources - getMessage(en_US,unhandledException) [WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NumberFormatException To my un-trained eye this looks like the validator is being called but not doing what it should, i.e. throwing a wobbler when it gets no data in any field. The validation for the form in validation.xml is as follows: mask^[a-zA-Z]+[\w\ ]*$ Does any of this make sense to you and can you see anything odd in the traces above? Thanks, Bart. Niall Pemberton wrote: Try turning on logging in debug mode, should give you more info about what its doing. Niall On 8/3/06, Bart Busschots <[EMAIL PROTECTED]> wrote: I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: This is the action: And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator not getting called and I can't see why
Try turning on logging in debug mode, should give you more info about what its doing. Niall On 8/3/06, Bart Busschots <[EMAIL PROTECTED]> wrote: I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: This is the action: And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validator not getting called and I can't see why
Sure you can, just follow Eric's example and subclass DynaValidatorForm. Then change your form-bean declaration to ... Adam -Original Message- From: Bart Busschots [mailto:[EMAIL PROTECTED] Sent: Friday, August 04, 2006 10:41 AM To: Struts Users Mailing List Subject: Re: Validator not getting called and I can't see why Hi Eric, Thanks for the reply but I'm using a DynaValidatorForm so I don't have a class to override things in. I would assume that DynaValidatorForm validates correctly because I use it all over the place. It's just this one action that's not validating and I just can't see what's different here. Bart. Givler, Eric wrote: > Can you override the validate() method inside your form and just call super.validate(), then see what the error collection has? > At least then you know it was called, but may not have done what you thought it should: > > package view.struts.forms; > > import javax.servlet.http.HttpServletRequest; > > import org.apache.log4j.Logger; > import org.apache.struts.action.ActionErrors; > import org.apache.struts.action.ActionMapping; > import org.apache.struts.validator.DynaValidatorForm; > > public class Page_6_Form extends DynaValidatorForm { >private static Logger log = Logger.getLogger(Page_6_Form.class); > >public ActionErrors validate(ActionMapping mapping, > HttpServletRequest request) { > > log.info( request.getRemoteUser() + " *** validate() - Start > ***"); > > // step in here with debug > ActionErrors errors = super.validate(mapping, request); > > // look at results of errors object as watch on first test > log.info( request.getRemoteUser() + " *** validate - End, errors= " + > ( errors == null ? "0" : errors.size()+"" ) + " ***"); > > return ( errors ); >} // validate > > } // Page_6_Form > > > -Original Message- > From: Bart Busschots [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 03, 2006 6:10 PM > To: Struts Users Mailing List > Subject: Validator not getting called and I can't see why > > > I'm either missing something stupid (which is always possible) or I've > managed to break the validator. I have an app that uses validator all > over the place and it's working fine in all my other actions but for > this one action it is simply not getting called. > > I can't see any difference between this action/form/validation and all > the other ones that are working. > > This is the form: > >type="org.apache.struts.validator.DynaValidatorForm"> > > > > > > > > This is the action: > >type="vtie.portal.mentor.CreateStudentGroupPrepareAction" > name="createStudentGroupForm" scope="session" validate="true" > input="/home/mentor/addStudentGroupForm.jsp"> > path="/do/mentor/createAnonymousStudentGroup" /> > path="/home/mentor/getStudentNamesForm.jsp" /> > > > > And this is the validation: > > > > mask^[a-zA-Z]+[\w\ > ]*$ > > > > > > > > > > > Can anyone see something obviously wrong there? > > Cheers, > > Bart. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - The information contained in this message may be privileged, confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or any employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Paychex, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator not getting called and I can't see why
Hi Eric, Thanks for the reply but I'm using a DynaValidatorForm so I don't have a class to override things in. I would assume that DynaValidatorForm validates correctly because I use it all over the place. It's just this one action that's not validating and I just can't see what's different here. Bart. Givler, Eric wrote: Can you override the validate() method inside your form and just call super.validate(), then see what the error collection has? At least then you know it was called, but may not have done what you thought it should: package view.struts.forms; import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMapping; import org.apache.struts.validator.DynaValidatorForm; public class Page_6_Form extends DynaValidatorForm { private static Logger log = Logger.getLogger(Page_6_Form.class); public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { log.info( request.getRemoteUser() + " *** validate() - Start ***"); // step in here with debug ActionErrors errors = super.validate(mapping, request); // look at results of errors object as watch on first test log.info( request.getRemoteUser() + " *** validate - End, errors= " + ( errors == null ? "0" : errors.size()+"" ) + " ***"); return ( errors ); } // validate } // Page_6_Form -Original Message- From: Bart Busschots [mailto:[EMAIL PROTECTED] Sent: Thursday, August 03, 2006 6:10 PM To: Struts Users Mailing List Subject: Validator not getting called and I can't see why I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: type="org.apache.struts.validator.DynaValidatorForm"> This is the action: type="vtie.portal.mentor.CreateStudentGroupPrepareAction" name="createStudentGroupForm" scope="session" validate="true" input="/home/mentor/addStudentGroupForm.jsp"> path="/do/mentor/createAnonymousStudentGroup" /> path="/home/mentor/getStudentNamesForm.jsp" /> And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validator not getting called and I can't see why
Can you override the validate() method inside your form and just call super.validate(), then see what the error collection has? At least then you know it was called, but may not have done what you thought it should: package view.struts.forms; import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMapping; import org.apache.struts.validator.DynaValidatorForm; public class Page_6_Form extends DynaValidatorForm { private static Logger log = Logger.getLogger(Page_6_Form.class); public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { log.info( request.getRemoteUser() + " *** validate() - Start ***"); // step in here with debug ActionErrors errors = super.validate(mapping, request); // look at results of errors object as watch on first test log.info( request.getRemoteUser() + " *** validate - End, errors= " + ( errors == null ? "0" : errors.size()+"" ) + " ***"); return ( errors ); } // validate } // Page_6_Form -Original Message- From: Bart Busschots [mailto:[EMAIL PROTECTED] Sent: Thursday, August 03, 2006 6:10 PM To: Struts Users Mailing List Subject: Validator not getting called and I can't see why I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: This is the action: And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator not getting called and I can't see why
Do you have the property "page" being submitted with your form: Also, are you sure that the validation isn't working and the error messages aren't getting displayed? Can you send the jsp source? -Matt On 8/3/06, Bart Busschots <[EMAIL PROTECTED]> wrote: I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: This is the action: And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Matthew Kurjanowicz [EMAIL PROTECTED] College of Computing GEORGIA Institute of TECHnology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validator not getting called and I can't see why
I'm either missing something stupid (which is always possible) or I've managed to break the validator. I have an app that uses validator all over the place and it's working fine in all my other actions but for this one action it is simply not getting called. I can't see any difference between this action/form/validation and all the other ones that are working. This is the form: type="org.apache.struts.validator.DynaValidatorForm"> This is the action: type="vtie.portal.mentor.CreateStudentGroupPrepareAction" name="createStudentGroupForm" scope="session" validate="true" input="/home/mentor/addStudentGroupForm.jsp"> path="/do/mentor/createAnonymousStudentGroup" /> path="/home/mentor/getStudentNamesForm.jsp" /> And this is the validation: mask^[a-zA-Z]+[\w\ ]*$ Can anyone see something obviously wrong there? Cheers, Bart. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]