Sub Actions in an Action class
Hi Craig and others, We plan to use coarse grained action classes in our application.Basically what we plan to is to do is combine add,update,delete operation to one Action class. We have two options . 1.Have 1Action class - 1 JSP - 1 Form Bean approach. This Action class will handle all operations/button of the particular page. Basically all button clicks. 2. Combine Add,update , delete etc of related data to a single action class. Which one of the two is the best approach. I have another question . 3.For aboove Options 1 and 2 we would need to handle sub actions in the Action class .We understand that DispatchAction can be used to handle this by using reflection.Is there a better approach to do this . Please give your valuable suggestions . Thanks and Regards, Bachan - Do you Yahoo!? U2 on LAUNCH - Exclusive medley videos from Greatest Hits CD
Resending : Sub Actions in an Action class
Hi Craig and others, We plan to use coarse grained action classes in our application.Basically what we plan to is to do is combine add,update,delete operation to one Action class. We have two options . 1.Have 1Action class - 1 JSP - 1 Form Bean approach. This Action class will handle all operations/button of the particular page. Basically all button clicks. 2. Combine Add,update , delete etc of related data to a single action class. Which one of the two is the best approach. I have another question . 3.For aboove Options 1 and 2 we would need to handle sub actions in the Action class .We understand that DispatchAction can be used to handle this by using reflection.Is there a better approach to do this . Please give your valuable suggestions . Thanks and Regards, Bachan - Do you Yahoo!? U2 on LAUNCH - Exclusive medley videos from Greatest Hits CD
RE: JavaScript Validation: MinLength MaxLength Functions Don't Work
Could you please send across your jsp and validation.xml file ??? Nekkalapudi, Viplava [EMAIL PROTECTED] wrote:We tried the same thing by just specifying the minlength for test purpose. But it didn't work. -- depends=minlength and removed the stuff for maxlength. -Original Message- From: bachan s [mailto:bachan_anand;yahoo.com] Sent: Thursday, October 24, 2002 2:39 PM To: Struts Users Mailing List Subject: Re: JavaScript Validation: MinLength MaxLength Functions Don't Work Can you try removing the required from the depends for password and give minlength and maxlength. Since minLength is mentioned required is not necesary. Try it and let ue know. this may be considered as a bug in struts too. Thanks ! Bachan Nekkalapudi, Viplava wrote: My team can't get the Struts client-side (i.e. JavaScript) validation framework to work. We want to ensure that a password is between 6 and 30 characters. Has anyone been able to get these checks to work? The required field check works, but the minlength and maxlength do not. Here's what our validation.xml file contains: depends=required depends=required,minlength,maxlength minlength 6 maxlength 30 Thanks, JOHN -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Re: JavaScript Validation: MinLength MaxLength Functions Don't Work
Can you try removing the required from the depends for password and give minlength and maxlength. Since minLength is mentioned required is not necesary. Try it and let ue know. this may be considered as a bug in struts too. Thanks ! Bachan Nekkalapudi, Viplava [EMAIL PROTECTED] wrote: My team can't get the Struts client-side (i.e. JavaScript) validation framework to work. We want to ensure that a password is between 6 and 30 characters. Has anyone been able to get these checks to work? The required field check works, but the minlength and maxlength do not. Here's what our validation.xml file contains: depends=required depends=required,minlength,maxlength minlength 6 maxlength 30 Thanks, JOHN -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Re: Validator later rather than sooner?
That also sounds good. Can you please tell how this entry would look like in validation.xml if we want to validate based on action type. formset form name=logonForm field property=value(username) depends=minlength,maxlength arg0 key=prompt.username/ arg1 key=${var:minlength} name=minlength resource=false/ arg2 key=${var:maxlength} name=maxlength resource=false/ var var-namemaxlength/var-name var-value16/var-value /var var var-nameminlength/var-name var-value3/var-value /var /field /form Thanks ! Bachan Dave Derry [EMAIL PROTECTED] wrote:You can also validate based on the action rather than the form. Just use the action type rather than the form name, and be sure to extend ValidatorActionForm rather than ValidatorForm. Dave Derry - Original Message - From: bachan s Instead of writing different action forms you can have different entries in your struts config with the same Object type (i.e action form ).In this was you can have different rule for each form using the validator framework. Does this sound feasible. Michael Lee wrote:Along the same thread, we are having a validation design problem. We have broken most of our Action classes up into multiple classes. Before we had one and used the property in the action mapping. That makes the Action classes much more readable. Problem is, these action classes still just use one ActionForm. This ActionForm's validation method checks the parameter because the validation for each page is different. This is starting to get large and unwieldy. I don't want to have to create basically the same ActionForm for each Action class when they are all mostly the same. Question is, what is a clean way of breaking up all these validations? Should I continue to check the action parameter and validate against it within the same validation method for that one Action form? I was thinking of extending the UserForm (the ActionForm in question) and just implementing the validation method. This way I could also get rid of the parameter in the action mapping of the struts-config.xml. Thanks, Mike -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Re: Validator later rather than sooner?
Instead of writing different action forms you can have different entries in your struts config with the same Object type (i.e action form ).In this was you can have different rule for each form using the validator framework. Does this sound feasible. Michael Lee [EMAIL PROTECTED] wrote:Along the same thread, we are having a validation design problem. We have broken most of our Action classes up into multiple classes. Before we had one and used the property in the action mapping. That makes the Action classes much more readable. Problem is, these action classes still just use one ActionForm. This ActionForm's validation method checks the parameter because the validation for each page is different. This is starting to get large and unwieldy. I don't want to have to create basically the same ActionForm for each Action class when they are all mostly the same. Question is, what is a clean way of breaking up all these validations? Should I continue to check the action parameter and validate against it within the same validation method for that one Action form? I was thinking of extending the UserForm (the ActionForm in question) and just implementing the validation method. This way I could also get rid of the parameter in the action mapping of the struts-config.xml. Thanks, Mike - Original Message - From: Richards, Devin N (Devin) To: Struts Users Mailing List Sent: Thursday, October 24, 2002 1:58 PM Subject: RE: Validator later rather than sooner? Since the validator classes extend the standard struts classes, I would get everything working correctly and then add the validator in after. We did this and it worked well (except for the current bug of the validator not supporting multiple resource bundles.) -Devin -Original Message- From: Susan Bradeen [mailto:SusanB;softlanding.com] Sent: Thursday, October 24, 2002 1:50 PM To: [EMAIL PROTECTED] Subject: Validator later rather than sooner? Is it general practice, or recommended, to develop a Struts application using the Action/ActionForm classes first (getting everything working properly) and later switch to the Validator classes, OR to use the Validator classes (implementing validation) right from the beginning? I have done a little with form validation, but not enough to know if I will get myself in trouble by waiting and switching class sets later on. Thanks, Susan Bradeen -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Re: Only one DynaValidatorForm
Hi, In this case it would be better to do it this was. form-bean name=loginForm dynamic=true type=org.apache.struts.validator.DynaValidatorForm form-property name=userName type=java.lang.String initial= / form-property name=password type=java.lang.String initial= / /form-bean form-bean name=changePassword dynamic=true type=org.apache.struts.validator.DynaValidatorForm form-property name=userName type=java.lang.String initial= / form-property name=password type=java.lang.String initial= / form-property name=newPassword1 type=java.lang.String initial= / form-property name=newPassword2 type=java.lang.String initial= / /form-bean Any other suggestions ! Bachan Heligon Sandra [EMAIL PROTECTED] wrote: With DynaValidatorForm it is possible to use the same Form for multiple views (JSP page), isn't it ? How one indicates which parameter validated for a given page/action ? For example I defined the following form: type=org.apache.struts.validator.DynaValidatorForm initial= / initial= / initial= / initial= / For the page login.jsp only the fields userName and password are visible. The validator has to ignore the value of the other fields. For the page changePassword.jsp all the fields are visible. Is it possible to do that ? Thanks a lot -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
RE: JavaScript Validation: MinLength MaxLength Functions Don't Work
Hi, If you have noticed the validation would stil occur at the back end (java part). If you want password also to be validated at front end change you validator-rules.xml - javascript function validateMinLength to the following code . javascript![CDATA[ function validateMinLength(form) { var bValid = true; var focusField = null; var i = 0; var fields = new Array(); oMinLength = new minlength(); for (x in oMinLength) { if (form[oMinLength[x][0]].type == 'text' || form[oMinLength[x][0]].type == 'password' || form[oMinLength[x][0]].type == 'textarea') { var iMin = parseInt(oMinLength[x][2](minlength)); if (!(form[oMinLength[x][0]].value.length = iMin)) { if (i == 0) { focusField = form[oMinLength[x][0]]; } fields[i++] = oMinLength[x][1]; bValid = false; } } } if (fields.length 0) { focusField.focus(); alert(fields.join('\n')); } return bValid; }]] /javascript This should work fine.Let me know. Bachan Nekkalapudi, Viplava [EMAIL PROTECTED] wrote:It looks like the min/max length JavaScript functions do NOT work on HTML password fields. We just verified this. I totally agree with Hajratwala. Struts should not impose this limitation on the developers. It is the developers responsibility to control the amount of security-related information returned to a user, not Struts. I go to websites all the time where I get a message specifying the size limits for a password. Does anyone know where the logic is implemented for ignoring the max/min check on a password? Do others agree that Struts is outside it boundaries by doing this? If so, maybe my team can submit a patch. John Hohlen (and Viplava Nekkaplapudi) -Original Message- From: Hajratwala, Nayan (N.) [mailto:nhajratw;ford.com] Sent: Thursday, October 24, 2002 3:15 PM To: 'Struts Users Mailing List' Subject: RE: JavaScript Validation: MinLength MaxLength Functions Don't Work interesting ... sorry if this has been discussed to death already. If so, i'll shut up. =) Shouldn't the decision of displaying the validation be up to the application developer? For example, when changing a password, you would have a spot to enter old new passwords, but would likely want to put some validation around the new one (min 6 characters, etc). What would be wrong with displaying that info to the user? --- - Nayan Hajratwala - Chikli Consulting LLC - http://www.chikli.com -Original Message- From: Dave Derry [mailto:dderry;acm.org] Sent: Thursday, October 24, 2002 4:14 PM To: Struts Users Mailing List Subject: Re: JavaScript Validation: MinLength MaxLength Functions Don't Work This has been explained before. I think it was by Ted. The reason has to do with security. Specifying bouinds on the length of a password limits the universe of potential passwords that a cracker would need to test. And of course if he/she saw a message saying Password must be between 6 and 30 characters in length that would provide that information. Dave Derry - Original Message - From: bachan s Can you try removing the required from the depends for password and give minlength and maxlength. Since minLength is mentioned required is not necesary. Try it and let ue know. this may be considered as a bug in struts too. Thanks ! Bachan Nekkalapudi, Viplava wrote: My team can't get the Struts client-side (i.e. JavaScript) validation framework to work. We want to ensure that a password is between 6 and 30 characters. Has anyone been able to get these checks to work? The required field check works, but the minlength and maxlength do not. Here's what our validation.xml file contains: depends=required depends=required,minlength,maxlength minlength 6 maxlength 30 Thanks, JOHN -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Problem with modules
Hi , I am trying to work with sub application(modules) in Struts 1.1 . I have made the following entry in my web.xml init-param param-nameconfig/param-name param-value/WEB-INF/conf/struts-default.xml/param-value /init-param init-param param-nameconfig/mod/param-name param-value/WEB-INF/conf/struts-mod.xml/param-value /init-param init-param and also mode the following entry for switch action in my struts-default.xml action path=/switch type=org.apache.struts.actions.SwitchAction/ Now when I try to access using the URL http://127.0.0.1:8080/struts-example/switch.do?prefix=modpage=index.do I am getting the following error Invalid sub-application prefix module1 was specified Could anyone let me know where I am making the mistake . Thanks ! Bachan - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
RE: struts Newbie - login screen
Struts can help yon in this .If you ever use a back button and go back you can make use of struts feature to take user to an error page . You have to make a call to saveToken() method in your ActionClasses. Thanks ! Bachan Sri Sankaran [EMAIL PROTECTED] wrote:This is one of the arguments that can go on for a long time. My thoughts on this subject are that the server can make no assumptions about the client other than what it knows. This philosophy permeates more than the 'back' button issue. It applies to validation, authentication etc. The server doesn't know that the user used the 'back' button. There are client-side technologies, such as JavaScript as your pointed out, that can aid in passing the server additional information. However, there could be other mitigating factors that makes using JavaScript or cookies not worth it in the long term. Think about the various sites on the web that authenticate the user. Majority of them don't do anything to prevent the user from re-logging in. Finally, if re-authenticating a user is such a hassle, one technique that isn't anathema in all situations is to trigger a new window to start your application upon user authentication. Sri -Original Message- From: deepank [mailto:deepank;sasken.com] Sent: Monday, October 21, 2002 9:44 AM To: Struts Users Mailing List Subject: Re: struts Newbie - login screen Why should a new session be initialized for nothing!!! - Original Message - From: Sri Sankaran To: Struts Users Mailing List Sent: Monday, October 21, 2002 7:01 PM Subject: RE: struts Newbie - login screen What's wrong if the user navigates back and views the login screen? Your application can just discard the earlier session and re-initialize. Don't try to circumvent standard browser behavior. Sri -Original Message- From: deepank [mailto:deepank;sasken.com] Sent: Monday, October 21, 2002 9:33 AM To: Struts Users Mailing List Subject: struts Newbie - login screen Hi, This question is not exclusive to Struts but i am hopeful Stuts must be having a solution for this. Once i authenticate a user and store his user information in session, i dont want that the login screen should appear again, unless ofcourse the user logs out or the session expires. As of now in my application, the user can always click the BACK button on the browser and access the login screen. MUST i use JAVASCRIPT to prevent this, or Struts can help me here. Deepank -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: -- To unsubscribe, e-mail: For additional commands, e-mail: - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Error Higlighting capability of Struts Tags and JSTL Usage
Hi, Does the input tags in struts have any inbuild error highlighting capability . What I mean is if the validate / any other method sets an error message with the key as the field name of a field , will the tag look into the ActionErrors object for each of the input fields and check whether the key is contained in the error object and do the following . 1. Give focus to the first error field even if the error there is a field given for the focus attribute in the form. 2. Give a different style background color/ text color to all the error filed. Also is it advisable to use struts tags /JSTL tags for tags like logic ,bean etc Thanks ! Bachan - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site
Error Higlighting capability of Struts Tags
Hi, Does the input tags in struts have any inbuild error highlighting capability . What I mean is if the validate / any other method sets an error message with the key as the field name of a field , will the tag look into the ActionErrors object for each of the input fields and check whether the key is contained in the error object and do the following . 1. Give focus to the first error field even if the error there is a field given for the focus attribute in the form. 2. Give a different style background color/ text color to all the error filed. Also is it advisable to use struts tags /JSTL tags for tags like logic ,bean etc Thanks ! Bachan - Do you Yahoo!? Y! Web Hosting - Let the expert host your web site