RE: Newbie html:errors/ never displays errors
Without seeing your validation code I'm guessing you have this or want to have this: public ActionErrors validate (ActionMapping actionMapping, HttpServletRequest httpServletRequest) { ActionErrors errors = new ActionErrors(); if (getCountryName() == null || getCountryName().length() 1) { errors.add(countryName, new ActionError(errors.required,Country Name)); } if (getCountryCapital() == null || getCountryCapital().length() 1) { errors.add(countryCapital, new ActionError(errors.required,Country Capital)); } saveMessages(request, (ActionMessages) errors); return (errors); } Shed. -Original Message- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 10:13 AM To: Struts Users Mailing List Subject: RE: Newbie html:errors/ never displays errors Do I add saveMessages(request, (ActionMessages) errors); to the Validate method of ActionForm? Since that is where the validation is happening. Thanks -Original Message- From: Hollaway, Shedrick CIV (TRFKB C600) [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 10:00 AM To: 'Struts Users Mailing List' Subject: RE: Newbie html:errors/ never displays errors Looks like you are not saving your errors. Try this after errors.add: saveMessages(request, (ActionMessages) errors); -Original Message- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 9:01 AM To: Struts Users Mailing List Subject: RE: Newbie html:errors/ never displays errors David, I followed your suggestions. I have everything set up the way you said. I have a default error: errors.add(countryName, new ActionError(errors.required,Country Name)); I'm displaying the error using logic:messagesPresent ul html:messages id=error property=countryName libean:write name=error//li /html:messages /ul /logic:messagesPresent I get the following error: javax.servlet.ServletException: Cannot find bean error in any scope I also tried doing the following: logic:messagesPresent ul html:messages id=error libean:write name=countryName//li /html:messages /ul /logic:messagesPresent I still get an error : javax.servlet.ServletException: Cannot find bean countryName in any scope It seems like the error doesn't get added to the session or request. Anything else you could suggest? Thanks Nadia -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 3:26 PM To: Struts Users Mailing List Subject: RE: Newbie html:errors/ never displays errors Nadia, Are you sure you have the 3 important pieces? A) a struts-config.xml (or module) define message resources file? Mine is the file WEB-INF/classes/application.properties, which contains the line: errors.required={0} is required. My struts-config.xml includes this resource with the line: message-resources parameter=application null=true / B) Have you put a 'default' error message in your ActionForm's validate() method for testing purposes so your method does not end with: return(errors); but with: C) You have JSP Code like this: logic:messagesPresent ul html:messages id=error libean:write name=error//li /html:messages /ul /logic:messagesPresent I got this to work but only AFTER I made sure I had step A configured properly. Since you used property key names when you added each error instead of using the Globals.ERROR key, a.k.a. the string error. You added each item under keys like countryName and countryCapital so you could access them individually like this: logic:messagesPresent ul html:messages id=error property=countryName libean:write name=error//li /html:messages /ul /logic:messagesPresent AND logic:messagesPresent ul html:messages id=error property=countryCapital libean:write name=error//li /html:messages /ul /logic:messagesPresent Regards, David -Original Message- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 1:20 PM To: Struts Users Mailing List Subject: RE: Newbie html:errors/ never displays errors Nooo... I guess that's it! I thought you need to call saveErrors only when you create ActionErrors inside Action and not in Validate... Here is my Action (I'm using DispatchAction): public ActionForward Add (ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest req
RE: Problem with struts validator../ Struts 1.2
Marco, /formset is missing. my validation.xml Is as follows.. form-validation formset form name=contactForm field property=contactRef depends=required msg name=required key=error.field.required/ arg0 key=prompt.contact/ /field /form /form-validation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validator not validating v. 1.2.4
Is this the complete form bean? the form bean looks like: public class PasswordReminderForm extends ValidatorActionForm { public PasswordReminderForm() { } private String emailAddress; public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } } all input is appreciated TIA Jin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: a re-deploy does not refresh ApplicationResources in Apache
Thomas, You will need to make the Tomcat context reloadable. Open the project properties and select Tomcat (if not present install Sysdeo Eclipse Tomcat Launcher plugin). In the 'General' tab, check the both 'Can update server.xml file' and 'Mark this context as reloadable (reloadable=true).' Shed. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 6:11 PM To: [EMAIL PROTECTED] Subject: a re-deploy does not refresh ApplicationResources in Apache I'm running eclipse 3.0, myeclipse 30b2, apache 5.0.27 and struts 1.1 if I change the ApplicationResources.properties file then redeploy it to tomcat, my struts web app does not see the change. I need to stop/start tomcat to see a change in the properties file. My question, is there a struts or tomcat configuration value that will make the properties file active without recycling tomcat? Thanks for your help Tom Perry This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction. Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and affiliates. If you are not the intended recipient of this e-mail, please delete the e-mail. - 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: Tutorial for DAO with Struts
Download Firestorm/DAO and study generated source code. www.codefutures.com/products/firestorm/ Shed. -Original Message- From: Manuel Wissmann [mailto:[EMAIL PROTECTED] Sent: Saturday, September 18, 2004 4:39 AM To: [EMAIL PROTECTED] Subject: Tutorial for DAO with Struts Hi Folks! Does somebody know a good tutorial for DAO (Data Acess Objects) with struts? THX Manu - 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: [OT] someone using Outlook 2003, please tell me it can't be t his LAME...
Rick, if you view by conversation topic (View - Current View - By Conversation Topic) or customize that view you'll be able to bare the pain of Lookout. Shed. -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 10:45 AM To: Struts Users Mailing List Subject: [OT] someone using Outlook 2003, please tell me it can't be this LAME... Ok, I'm not trying to start an e-mail client war. (I have been using Thunderbird as my primary client but do miss some of the features of The Bat, but that's not the question I have). At work they've just installed Office 2003 so I figured I'd look again at Lookout since I do use it at work for the Calendar stuff that I'm forced to use (I can still use Thunderbird to get my Exchange server e-mail which is nice). While messing with the Outlook e-mail client I can't figure out for the life of me how to sort messages by subject/thread AND by date.. like EVERY OTHER client in the world does. If this client can sort like a normal client (thunderbird, mozilla, the bat, sylpheed, evolution, kmail, pegasus, eudora, poco mail, etc etc) how come it is so difficult to figure out how to set it up? I've been messing with these view and custom options and still havne't figured it out. I've used both Windows and Linux and I actually like Windows for a desktop environment (gasp!) but I don't use any of their software other than the OS (I use opera or firefox for browsing, thundbird for mail, open office for office stuff). I'm really amazed that they could realease an e-mail client that is so lame. It's like MS refusing to make IE have tabbed browsing features - just stupid - they know people want it but they don't provide it (I guess they're afraid to admit that moz/firefox/opera have the right idea.) Someone tell me how I can get messages sorted correctly in Outlook? I want grouped by thread/subject but sorted by received date (preferably a more recent date on an e-mail will simply move the grouped thread up or down). /rant -- Rick - 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: [ANN] Struts 1.2.2 release is now available for download.
A big thanks to you James for your leadership and all involved your labor :-D Shed. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 31, 2004 10:19 AM To: Struts Users Mailing List Cc: Struts Developers List Subject: [ANN] Struts 1.2.2 release is now available for download. The Apache Struts team is extremely proud to announce the availability of Struts 1.2.2. This release represents the first official release available for General Availability since Struts 1.1. You can find all of the features, enhancements, and bug fixes in the release notes listed below. I would personally like to send a big _THANK YOU_ to all the users and developers who help make this community project possible and an even bigger _THANK YOU_ to the developers and committers who volunteer their time and talents to this (as well as other) Open Source project. Pat yourselves on the back, you are doing a stellar job Release notes: http://struts.apache.org/userGuide/release-notes.html You can access the binary, source, or library distributions from any of our mirrors http://struts.apache.org/download.cgi The Apache Struts Team -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - 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]
Multiple forms in one JSP + one Action
I am unable to find a solution or an alternate way of having multiple forms in one jsp and upon submit one action handling all forms.The jsp will have the forms as follows: html:form %-- first form stuff -- using formA --% html:form %-- second form stuff -- using formB --% /html:form html:form %-- third form stuff -- using formB --% /html:form /html:form How do I indicate to the action that it depends on two forms? Or should I be using nested forms? Which I can't find docs or HOWTO for? I would be thankful for any help? Shedrick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple forms in one JSP + one Action
Micheal I was trying to submit all three at one time. But you're that is not an option. So, I have to do something like this: first.jsp html:form %-- first form stuff -- using formA --% html:form %-- second form stuff -- using formB --% /html:form html:form %-- third form stuff -- using formB --% /html:form /html:form html:submit/ second.jsp html:form %-- first form stuff -- using formA --% html:form %-- second form stuff -- using formB --% /html:form html:form %-- third form stuff -- using formB --% /html:form /html:form html:submit/ action attribute=formA input=/first.jsp forward name=success path=/second.jsp / /action action attribute=formB input=/second.jsp forward name=success path=/done.jsp / /action thanks, Shed -Original Message- From: Michael McGrady [mailto:[EMAIL PROTECTED] Sent: Thursday, August 12, 2004 9:36 AM To: Struts Users Mailing List Subject: Re: Multiple forms in one JSP + one Action At 05:50 AM 8/12/2004, you wrote: I am unable to find a solution or an alternate way of having multiple forms in one jsp and upon submit one action handling all forms.The jsp will have the forms as follows: You can have many forms but can submit only one at a time. What are you trying to do? Michael - 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: Multiple forms in one JSP + one Action
Rick wrote: Guys, This is what I wanted to do without using any javascript. html:form %-- first form stuff -- using formA --% html:text name=formA property=firstName readonly=true / html:text name=formA property=lastName readonly=true / html:text name=formA property=homePhone readonly=false / table %-- second form stuff -- using formB -- displayed% th nowrap=nowrapFirst Contact:/th tdhtml-el:text property=fullName value=${contact[0].fullName} readonly=false//td /table table %-- third form stuff -- using formB --% th nowrap=nowrapFirst Contact:/th tdhtml-el:text property=fullName value=${contact[1].fullName} readonly=false//td /table /html:form html:submit/ I don't understand how to capture both forms in the Action class. Shed. - 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: Multiple forms in one JSP + one Action
Rick, my apologies for being unclear here, html:text is html-el:text and I am using JSTL to retrieve data and iterate with (c:foreach). There are alot more fields involve here each ActionForm corrolate to a database tables(Atable = Aform, Btable = Bform). I would like the user to be able update fields in multiple tables without binding the table in one very big ActionForm. Does this fit the exception of nested forms using JSTL? Shed Wy would you want to? Why don't you just make an ActionForm with the properties: firstName lastName homePhone contact1 contact2 Maybe I'm missing something:) Also you do know that html:form will not work defined like you have it? Also of course you need your submit button inside the form. Lastly you have two form fields named the same (fullName) which will end up submitting a String[] which is probably not what you want. Make one form and name them contact1 and contact2 and set them before you get to the form so you don't have to declare the value like you are doing. (You 'usually' want to avoid having to declare the value - it should be set in the form. There are exceptions - nested forms using JSTL, sometimes radio or checkboxes - but 99.9 of the time you shouldn't need to define the value using an html:text tag). -- Rick - 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: Multiple forms in one JSP + one Action
Thanks to all, for gliding me back to the light. Jim, you were right I was over engineering it. I'll put down the oil, screwdriver and jackhammer then digest Rick's suggestions. again thanks, Shed -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Thursday, August 12, 2004 12:05 PM To: Struts Users Mailing List Subject: Re: Multiple forms in one JSP + one Action Hollaway, Shedrick CIV (TRFKB C600) wrote: Rick, my apologies for being unclear here, html:text is html-el:text and I am using JSTL to retrieve data and iterate with (c:foreach). There are alot more fields involve here each ActionForm corrolate to a database tables(Atable = Aform, Btable = Bform). I would like the user to be able update fields in multiple tables without binding the table in one very big ActionForm. Does this fit the exception of nested forms using JSTL? I understand it was html-el, but that doesn't matter - you should still just use property when you 'can' for text fields ( if iterating over checkboxes and displaying the values of the checkboxes with el, that makes more sense). You shouldn't be worrying about the backend at all from a front end perspective. The role of the front end is to capture and display data so I wouldn't worry about: (Atable = Aform, Btable = Bform). Here's what I do in your case. Imagine the slightly more complex case of updating user information Using your scenario, the set up could be like this: 1) Create an ActionForm that will be used to capture user information: //UserActionForm String id String firstName String lastName String homePhone String contact1 String contact2 2) I'd use a Dispatch Action for the Action class, but since I'm not sure if used them before, I'll assume a regular Action. So Create a GetUserAction and for this example we'll also need an UpdateUserAction (Dispatch really makes this much easier but that's another topic). 3) User might click on a link with an userID and we then need to populate the ActionForm so the fields (firstName, etc) can be updated. So imagine a link that will map to GetUserAction and takes request parameter of id. For this example we'll bind our UserActionForm for this mapping. So we might have a link that looks like... /getUser.do?id=3456 which in our StrutsConfig file we'd map that getUser.do to our GetUserAction. So GeUserAction is called... now here's where you'll see what I'd do... //in execute of GetUserAction.. UserActionForm userForm = (UserActionForm)form; String id = userForm.getId(); //now you mentioned you have different business calls to make //to populate both contact information and the rest of the info... //I'd think about creating a new query but lets assume you have to make //both calls. We'll use a service class that hides the implementation, //but what should always be returned is some kind of BusinessObject - //not an ActionForm... these business objects holding the data are //ValueObjects or DTOs - just glorified names for plain old java object //really. //NameValueObject holds firstName, lastName, homePhone NameValueObject nameObject = yourServiceLayer.getNameObject( id ); //ContactValueObject holds contact1, contact2 ContactValueObject contactObject = yourServiceLayer.getContactObject( id ) //so now you have the concern you were talking about earlier: //Atable = Aform, Btable = Bform - but notice now it's not based //on the view layer. //now we can simply use bean utils to populate our form bean for //the display: //to avoid having to do userForm.setFirstName( //nameObject.getFirstName() ); //for all the properties..use BeanUtils... BeanUtils.copyProperties( userForm, nameObject ); BeanUtils.copyProperties( userForm, contactObject ); //Viola. Now your UserActionForm is nice and populated and ready to be //used on your page. So yo forward on to your page and you have a //nice form with... html:form name=updateUser first name: html:text property=firstName/ //... Contact 1: html:text property=contact1/ //..etc /html:form The above of course submits to UpdateUserAction (or if Dispatch Action something like UserAction and in there you could do the reverse... UserActionForm userForm = (UserActionForm)form; NameValueObject nameObject = new NameValueObject(); BeanUtils.copyProperties( nameObject, userForm ); ContactValueObject contactObject = new ContactValueObject(); BeanUtils.copyProperties( contactObject , userForm ); yourServiceLayer.updateUser( nameObject, contactObject ); Again I still think it makes more sense to probably have just one ValueObject ( user ) to deal with holding all this, but you might have some requirement were you need to have each different object representing a table. (Use iBATIS and you won't have to worry about that:) By the way, I have some examples of this stuff at http