RE : validating double causes no error on text entry
the problem is that the string is NOT empty but it validate it as an empty string. -Original Message- From: John Fitzpatrick [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 6:51 PM To: Struts Users Mailing List Subject: Re: validating double causes no error on text entry Casting an empty String to a double will give you 0.0. On 20040303 12:10 PM, thomas Sontheimer [EMAIL PROTECTED] wrote: when I use the validator on the server side to validate a double the value is converted to 0.0 an no error is reported. has anyone meet that problem? I parsed the struts and commons bugzilla lists and didn't found anything about. thanks thomas - 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 : RE : validating double causes no error on text entry[RESOLVED]
the problem came from the java.lang.Double field of my DynaValidatorForm which converted first any string in an empty string. instead I use a java.lang.String field that I convert myself after validation and it works. -Original Message- From: thomas Sontheimer [mailto:[EMAIL PROTECTED] Sent: Thursday, March 04, 2004 9:44 AM To: 'Struts Users Mailing List' Subject: RE : validating double causes no error on text entry the problem is that the string is NOT empty but it validate it as an empty string. -Original Message- From: John Fitzpatrick [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 6:51 PM To: Struts Users Mailing List Subject: Re: validating double causes no error on text entry Casting an empty String to a double will give you 0.0. On 20040303 12:10 PM, thomas Sontheimer [EMAIL PROTECTED] wrote: when I use the validator on the server side to validate a double the value is converted to 0.0 an no error is reported. has anyone meet that problem? I parsed the struts and commons bugzilla lists and didn't found anything about. thanks thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
validating double causes no error on text entry
when I use the validator on the server side to validate a double the value is converted to 0.0 an no error is reported. has anyone meet that problem? I parsed the struts and commons bugzilla lists and didn't found anything about. thanks thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to specify parameters for the message in exception handling?
since we may define parametrable messages in the ressource bundle, is it possible to add parameters to the key in declarative exception handling? and if yes, how can I do it? thanks in advance. thomas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
crud example
has anyone an example for crud (Create, Read, Update, Delete) functionnality with dispatchAction and jsp page code? thanks in advance. thomas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE : logic:iterate with changing row colors
here are means to do it: http://husted.com/struts/FAQ/view-logic.htm -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 3:17 PM To: Struts-User Subject: logic:iterate with changing row colors hello, i use logic:iterate and want to change the cgcolor every row. usualy i do something like this thisway: if(currentrow mod 2 == 0) { bgcolor = color1; } else { bgcolor = color2; } how would u do this with struts ? i would prefer to do this without any jsp, so far my code is struts only :) any ideas ? Mit freundlichen Grüßen Christian Reps, Dipl. Inf. (FH) Web Applications - 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 : iterator tag
you may also test if the *brand new* collection is defined with the logic:present and logic:notPresent tags... thomas. -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 6:14 PM To: 'Struts Users Mailing List' Subject: RE: iterator tag You sure? 'cause normally what I got is just nothing if the list is empty. If the collection you are iterating over contain null values, the loop will still be performed but no page scope attribute (named by the id attribute) will be created for that loop iteration. You can use the logic:present and logic:notPresent tags to test for this case. However, the *brand new* collection has to be defined somehow, i.e., itself cannot be null. Hope this helps. -Original Message- From: LUCERO,DENNIS (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: September 6, 2003 2:34 PM To: ' ([EMAIL PROTECTED])' Subject: iterator tag What is the correct behavior of the logic:iterator tag when given a collection of size zero (when the named collection is a brand new linkedList this tag causes a page to crash??) We come from the land of the ice and snow With the midnight sun, where the hot springs glow The hammer of the gods, will drive our ships to new lands Fight the horde, Sing and cry Valhalla I am coming - 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]
Display Taglib vs HtmlTable
http://edhill.its.uiowa.edu/display/ http://htmltable.yuriy-zubarev.com/jsp/index.jsp Has anyone tried these two taglibs? which one do you recommend? thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE : RE : RE : Validator and Dispatch Actions
here is another means to do it: http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorDispatchAction -Original Message- From: Trent Fisher [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 9:26 PM To: [EMAIL PROTECTED] Subject: Re: RE : RE : Validator and Dispatch Actions On this same note, if I were then calling a dispatch method on that action class to load/pre-populate the page, I would also need to register yet another actionMapping that would use the same action class for the type parameter, but would just call the load method instead one of the submission methods, correct? I don't use a load method but I think you're right. Basically, if I'm breaking this down correctly, if someone is using Dispatch/LookupDispatch Action and the struts validator, they would need 1 ActionMapping to call in order to load the page (and it's dispatch method on the action class) as well as 1 ActionMapping for each of the submission possibilities they had on their JSP... i.e., if you wanted to validate 2 subsets of fields on the page, you'd have an actionmapping for each of them. yes Isn't the struts-config going to get quite cluttered and harder to follow if this is the pattern used? it depends on how many actionMappings you need. Is there a different approach that is recommended vs. this one? yes, another means is proposed here: http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorDispatchAction From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 17:04:35 +0200 you don't need 2 action classes. you may declare 2 actions in the struts-config.xml file using the same class. but you have to declare 2 formset tags in the validation.xml file, setting up each form name with the action path instead of the form name. in the first formset tag you define validation rules for all the fields and in the second you do it only for a part of them. using the first action will validate all the fields and using the second will validate only a part of them. thomas -Original Message- From: Trent Fisher [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 4:05 PM To: [EMAIL PROTECTED] Subject: Re: RE : Validator and Dispatch Actions This being the case, say you had a situation where your form had a few fields that would be disabled/not displayed if a user didnt have a certain access level. If you wanted 2 separate validation schemes for this form (one that has all fields being validated, one that has all fields except for the disabled/not shown fields being validated) then you would need 2 action classes (or 2 dispatch methods in the case below)? If the actions will be executing similar, if not identical code based on the fields submitted, this seems like an awful lot of rework just to get the validation accomplished. From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 15:21:47 +0200 you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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] _ MSN 8: Get 6 months for $9.95/month http://join.msn.com/?page=dept/dialup
RE : RE : Validator and Dispatch Actions
if you want to use different validation rules with the validator you have to declare different action elements in your struts-config.xml file (using the same action class if you want). another means is to validate your form in the methods of your action class as propose Koni in the mail sent on the list Monday, August 25, 2003 8:04 PM: struts-config.xml: actionpath=/logon/action/logon type=test.web.struts.action.logon.LogonAction name=logonForm scope=request-- !!! validate=false -- !!! input=/WEB-INF/jsp/logon/logon.jsp forward name=success path=/index.jsp/ /action LogonAction.java: ActionErrors errors = new ActionErrors(); errors = form.validate(mapping, request); // Report any errors we have discovered back to the original form if (!errors.isEmpty()) { saveErrors(request, errors); return new ActionForward(mapping.getInput()); } thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 5:44 PM To: [EMAIL PROTECTED] Subject: Re: RE : Validator and Dispatch Actions Thomas, How do i have 3 actions here? I have only one action with three methods each working on SEARCH, CREATE and EDIT.(which is why i use the dispatch Action) Appreciate any other thoughts. TIA, Manglu thomas Sontheimer wrote: you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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 : Validation failes and returns (almost) empty page.
I had the same problem and your solution works. thank you thomas -Original Message- From: Rune Peter Bjørnstad [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 11:46 AM To: Struts Users Mailing List Subject: Re: Validation failes and returns (almost) empty page. I found the solution to my problem. Instead of specifying an absolute JSP as my input attribute (struts-config.xml), I specified a forward name. Now it works perfectly. Still don't know why it works in the example application. Rune. On Tue, 26 Aug 2003, Rune Peter Bjørnstad wrote: On Tue, 26 Aug 2003, Rune Peter Bjørnstad wrote: I've compared the logfiles of my application and the validator example application in the case of a failed validation. - In my case, the situation described in my previous mail occurs. - In the example application, the following messages are logged: Validation failed, returning to '/registration.jsp' Delegating via forward to '/registration.jsp' The second message I do not get in my application. examining the source ResourceProcessor.java reveals: // Save our error messages and return to the input form if possible if (log.isDebugEnabled()) { log.debug( Validation failed, returning to ' + input + '); } request.setAttribute(Globals.ERROR_KEY, errors); if (moduleConfig.getControllerConfig().getInputForward()) { ForwardConfig forward = mapping.findForward(input); processForwardConfig( request, response, forward); } else { internalModuleRelativeForward(input, request, response); } with: protected void internalModuleRelativeForward( String uri, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Construct a request dispatcher for the specified path uri = moduleConfig.getPrefix() + uri; // Delegate the processing of this request // FIXME - exception handling? if (log.isDebugEnabled()) { log.debug( Delegating via forward to ' + uri + '); } doForward(uri, request, response); } This leads me to the conclusion that my application and the example application reacts differently to the boolean check: moduleConfig.getControllerConfig().getInputForward() Can anyone shed some light on this? Kind regards, Rune Bjørnstad Hi, I've got a bizarre problem regarding form validation. A simple form is validated, and when failing this validation I get a blank html page with the following source: htmlbody/body/html The last message in the log is: Validation failed, returning to '/upload.jsp' I've read in another thread that somone else experienced the same thing. The solution in this case was to use a different commons-validation.jar. I'm using exactly the same jars as the validation example application. Still with the same result. Why am I not receiving the original form, like in the validation example? I've included the following files for review: - upload.jsp // The file containing the html. - web.xml - struts-config.xml - validation.xml - UploadBean.java Any help would be greatly appreciated! Kind regards Rune Bjørnstad - 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 : RE : Validation failes and returns (almost) empty page.
yes but in my case when the validation failed I always get a blank page. the actionErrors was not sent and the page was not displayed. I don't understand why the page was not displayed even if the actionErrors was not forwarded. thomas -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 4:37 PM To: 'Struts Users Mailing List' Subject: RE: RE : Validation failes and returns (almost) empty page. Forward retains your request arguments(i.e., actionErrors), while an absolute url submits an entirely new request(i.e., without any actionErrors). -Original Message- From: Rune Peter Bjørnstad [mailto:[EMAIL PROTECTED] Sent: August 26, 2003 5:29 AM To: Struts Users Mailing List Subject: Re: RE : Validation failes and returns (almost) empty page. Glad to help. The world now has atleast two less frustrated men walking about.. ;) Rune. On Tue, 26 Aug 2003, thomas Sontheimer wrote: I had the same problem and your solution works. thank you thomas -Original Message- From: Rune Peter Bjørnstad [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 11:46 AM To: Struts Users Mailing List Subject: Re: Validation failes and returns (almost) empty page. I found the solution to my problem. Instead of specifying an absolute JSP as my input attribute (struts-config.xml), I specified a forward name. Now it works perfectly. Still don't know why it works in the example application. Rune. On Tue, 26 Aug 2003, Rune Peter Bjørnstad wrote: On Tue, 26 Aug 2003, Rune Peter Bjørnstad wrote: I've compared the logfiles of my application and the validator example application in the case of a failed validation. - In my case, the situation described in my previous mail occurs. - In the example application, the following messages are logged: Validation failed, returning to '/registration.jsp' Delegating via forward to '/registration.jsp' The second message I do not get in my application. examining the source ResourceProcessor.java reveals: // Save our error messages and return to the input form if possible if (log.isDebugEnabled()) { log.debug( Validation failed, returning to ' + input + '); } request.setAttribute(Globals.ERROR_KEY, errors); if (moduleConfig.getControllerConfig().getInputForward()) { ForwardConfig forward = mapping.findForward(input); processForwardConfig( request, response, forward); } else { internalModuleRelativeForward(input, request, response); } with: protected void internalModuleRelativeForward( String uri, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Construct a request dispatcher for the specified path uri = moduleConfig.getPrefix() + uri; // Delegate the processing of this request // FIXME - exception handling? if (log.isDebugEnabled()) { log.debug( Delegating via forward to ' + uri + '); } doForward(uri, request, response); } This leads me to the conclusion that my application and the example application reacts differently to the boolean check: moduleConfig.getControllerConfig().getInputForward() Can anyone shed some light on this? Kind regards, Rune Bjørnstad Hi, I've got a bizarre problem regarding form validation. A simple form is validated, and when failing this validation I get a blank html page with the following source: htmlbody/body/html The last message in the log is: Validation failed, returning to '/upload.jsp' I've read in another thread that somone else experienced the same thing. The solution in this case was to use a different commons-validation.jar. I'm using exactly the same jars as the validation example application. Still with the same result. Why am I not receiving the original form, like in the validation example? I've included the following files for review: - upload.jsp // The file containing the html. - web.xml - struts-config.xml - validation.xml - UploadBean.java Any help would be greatly appreciated! Kind regards Rune Bjørnstad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED
RE : Validator and Dispatch Actions
you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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 and Dispatch Actions
you don't need 2 action classes. you may declare 2 actions in the struts-config.xml file using the same class. but you have to declare 2 formset tags in the validation.xml file, setting up each form name with the action path instead of the form name. in the first formset tag you define validation rules for all the fields and in the second you do it only for a part of them. using the first action will validate all the fields and using the second will validate only a part of them. thomas -Original Message- From: Trent Fisher [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 4:05 PM To: [EMAIL PROTECTED] Subject: Re: RE : Validator and Dispatch Actions This being the case, say you had a situation where your form had a few fields that would be disabled/not displayed if a user didnt have a certain access level. If you wanted 2 separate validation schemes for this form (one that has all fields being validated, one that has all fields except for the disabled/not shown fields being validated) then you would need 2 action classes (or 2 dispatch methods in the case below)? If the actions will be executing similar, if not identical code based on the fields submitted, this seems like an awful lot of rework just to get the validation accomplished. From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 15:21:47 +0200 you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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] _ MSN 8: Get 6 months for $9.95/month http://join.msn.com/?page=dept/dialup - 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]
validator returns blank page
I'm attempting to use the validator with a DynaValidatorForm and it returns a blank page if I don't fill the field. And if I fill the username field I'm redirected to the good page (/index.jsp). any idea? thomas here are some parts from my code: struts-config.xml: form-bean name=logonForm type=org.apache.struts.validator.DynaValidatorForm form-property name=username type=java.lang.String/ form-property name=password type=java.lang.String/ /form-bean actionpath=/logon/action/logon type=test.web.struts.action.logon.LogonAction name=logonForm scope=session input=/WEB-INF/jsp/logon/logon.jsp forward name=success path=/index.jsp/ /action validation.xml: formset form name=logonForm field property=username depends=required arg0 key=logon.data.username/ /field /form /formset logon.jsp: body html:errors/ html:form action=/logon/action/logon.do focus=username table border=0 width=100% tr th align=right Username: /th td align=left html:text property=username/ /td /tr tr th align=right Password: /th td align=left html:password property=password/ /td /tr tr td align=right html:submit property=submit value=Submit/ /td td align=left html:reset/ /td /tr /table /html:form /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]