FW: [ANN] Bridgetown IoC Framework
FYI -Original Message- From: Peter A. Pilgrim [mailto:[EMAIL PROTECTED] Sent: 08 September 2004 07:12 To: Struts Developers List Subject: [ANN] Bridgetown IoC Framework Hi I have been quietly working on my own Inversion of Control lightweight framework over the last couple of months. My itch was scratched when I suddenly realised that ``Commons BeanUtils'' and ``Common Digester'' could be simply combined together into a bean assembly factory. An assembly factory could manage service beans in a lightweight container. Services could then be retrieved by name, and one doesn't have to worry about connecting different services together. Experiments showed that this idea was pretty cool and have implemented property and method dependency injection (aka ``BeanUtils'' and ``MethodUtils''). [Constructor injection is on the todo list. ] I am at the point where the current codebase is stable enough for development, but if I want the container to be more useful, then I need to open- source the project. It would allow others to write Dynamic proxy service beans, integrate with Struts 1.2/2+, or extend with AOP library, or whatever persistence layer EJB 3.0 decides to become. It cannot be down by just one man writing software. As an independent consultant I simply have not got the time to build everything. Moreover, I intend to follow the Struts style ``open integration'' philosophy that should allow Bridgetown IoC container to be added any other framework. (I intend add support to the Expresso Framework in the near term, since I am a core committer there) So my simple IoC Test Container became ``Bridgetown IoC''. I uploaded the source code to ``Sourceforge'' and slapped on it an Apache License 2.0 badge. The software is ALPHA quality but it compiles and run with Eclipse SDK 3, and there are junit test and a couple of examples. `` http://bridgetown.sf.net '' is the hook. I'd like publicly thank the man, Craig McClanahan, for his two inventions `BeanUtils' and `Digester'. Without those two components it just wouldn't have happened. Enjoy baby bop# -- Peter Pilgrim __ _ _ _ / //__ // ___// ___/ + Serverside Java / /___/ // /__ / /__ + Struts / // ___// ___// ___/ + Expresso Committer __/ // /__ / /__ / /__ + Independent Contractor /___/////// + Intrinsic Motivation On Line Resumehttp://jroller.com/page/peter_pilgrim || \\=== `` http://www.xenonsoft.demon.co.uk/no-it-striker.html '' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] [ Not subscribed to the users list at home ;-( ] -- Peter Pilgrim Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ, United Kingdom Tel: +44 (0)207 883 4447 == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:cancel usage
Hi, Has anyone else had a problem with this? I am using Struts 1.1 but presume it has worked in this and previous versions as it must come up in almost every project. I cannot switch validation to false as my submit button does require validation. I suppose I could put the cancel and submit buttons inside seperate form tags but this seems a little contrived. Thanks, Andy _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A couple of questions
Marco Tedone wrote: Interesting, I also build commercial apps, and try to use wizards whenever possible to keep things simple for my users We prefer to keep things easy for us also for maintainability as we look at the project long life term. Doing and maintain wizards with struts is really easy , specially for long life projects. Can you see how easily one simple field propagates the amount of activities just because of the ActionForm in the middle? ActionForm are really usefull when a lot of forms that use the same fields (select menu or textfield or whatever). I create an ActionFormBase which contain all dropdown menus contents and basic validation, extend it when neeeded to add specific fields, and never have to bother with the common fields again in the whole application. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Proper place for validation
Hmm, not a lot of comments on this. I guess there is a consensus on the matter (that, or no-one really gives a damn). A quick followup on this; how could I achieve both a) decoupling of my business classes from Struts b) internationalization if I validate in my business class? 1) if (alreadyExists(email)) { throw new MyAppException(E-mail address already exists); achieves a) but not b), and 2) if (alreadyExists(email)) { throw new MyAppException(errors.email.duplicate); achieves b) but not a) From: Robert Taylor [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: Proper place for validation Date: Tue, 7 Sep 2004 08:21:09 -0400 From: Robert Taylor [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: Proper place for validation Date: Tue, 7 Sep 2004 08:21:09 -0400 I would avoid putting any business logic in the action class. Place this type of logic in the business class as it most likely is validation that is valid across all application logic and not for just one use case. robert -Original Message- From: Janne Mattila [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 8:15 AM To: [EMAIL PROTECTED] Subject: Proper place for validation I am wondering what would be the propert place for some validation code. Let's say I have a registration page where user inputs his/her information for a new user account. There's a field for e-mail address. On one level that information is validated on the ActionForm, for things such as - field is not left empty, if it is required - field is a valid e-mail address That much seems quite clear. But where should I put a check that ensures that same e-mail address is not already used by an existing account? On the other hand, I could put it in the registration action, because checking that is (kind of) user-input validation, and action is a natural place to do this. On the other hand, I could put it in my business class. The pros for this would be smaller and simpler action code, and reuse if same check is needed with different actions. Any suggestions? Intuitively, I think I would put that check in the Action, but I am happy to hear any arguments in favor or opposing that. _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - 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] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bean tag and session data issue
Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. I now have a multi-page form backed by an ActionForm and an Action that appears to work fine (stepping from one page to the next, accepting input, validating it, storing it in an object in a session) except for the fact that the JSP pages do not retrieve the accumulating data from the object stored in the session, other than the first piece of data entered and the last. So I get a growing number of blank fields in the page. I have built and run a multi-step unit test with Struts Test Case that works fine. The Action creates the required object, stores it in the session, and adds the data piece by piece as the unit test simulates stepping through the wizard. This has at my wits end. Below is the code from the Action and one of the JSP pages that fails. Note: Only the first four pages are currently processed by business logic. The rest just return success regardless. I can't see what I am doing wrong. It seems like the object stored in the session isn't being updated properly (although the unit test disproves this), so perhaps its something I have messed up in the JSP, or don't fully understand? Any assistance anyone can offer would be greatfully received. Regards, Langdon -- StudentRegistrationWizardAction.java package adamh; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; /** * Created by IntelliJ IDEA. * User: langdons * Date: 18/08/2004 * Time: 18:44:41 * To change this template use Options | File Templates. */ public class StudentRegistrationWizardAction extends Action{ private static Log log = LogFactory.getLog(StudentRegistrationWizardAction.class); public static final String STUDENT_KEY = adamh.StudentRegistrationWizardAction.STUDENT; public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { log.trace(In execute of StudentRegistrationWizardAction); if ((request.getSession().getAttribute(STUDENT_KEY)) == null) { Student newStudent = new Student(); request.getSession().setAttribute(STUDENT_KEY, newStudent); } /* Check to see if the user cancellend the registration process */ if (isCancelled(request)) { log.debug(Cancel Button was pushed!); request.getSession().removeAttribute(STUDENT_KEY); request.getSession().removeAttribute(mapping.getAttribute()); return mapping.findForward(welcome); } /* Get the form data */ StudentRegistrationWizardForm studentForm = (StudentRegistrationWizardForm) form; int page = studentForm.getPage(); if (page == 1) { return processRegReferrer(mapping, studentForm, request, response); } else if (page == 2) { return processEmailAddress(mapping, studentForm, request, response); } else if (page == 3) { return processPassword(mapping, studentForm, request, response); } else if (page == 4) { return processNickname(mapping, studentForm, request, response); } else if (page == 5) { return mapping.findForward(success); } else if (page == 6) { return mapping.findForward(success); } else if (page == 7) { return mapping.findForward(success); } else if (page == 8) { return mapping.findForward(success); } else if (page == 9) { return mapping.findForward(success); } return processRegReferrer(mapping, studentForm, request, response); } public ActionForward processRegReferrer( ActionMapping mapping, StudentRegistrationWizardForm studentForm, HttpServletRequest request, HttpServletResponse response) throws Exception { log.trace(In processRegReferrer of StudentRegistrationWizardAction); String referrerId = studentForm.getReferredById(); Student student = (Student) request.getSession().getAttribute(STUDENT_KEY); if (student == null) { throw new java.lang.IllegalStateException( Missing student in session scope); } else { if (referrerId != null) { /** * TODO: Check the databse to see if the referrer id is valid, if so then add the id to the student object, if not, then dump it */
Database Mapping
Hai All, Will it be possible in the Struts to do some mapping between the form fields and underlining database by writing queries in the xml file. I want to develop a prototype with some functionality and do not want to do coding for this or minimal I saw similar functionality with JDBC Connection Servlet Framework (jcs) http://jresources.com But the problem is that the support for this seems to have been removed. If someone has got the JAR file concerning this framework then please send it to me. Any indication on this will be very helpful. Thanks Shailender Jain - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Database Mapping
I'm not exactly sure what you are asking. If you asking if Struts supports putting sql in the configuration files, then the answer is no. If you wanting some automatic framework to write your sql for you, then the answer is yes and no. No, you can't do it with Struts config files, but yes, it can be done and easily used by your classes with the Struts framework. There are an infinite number of ways to connect your Struts application with a database. It all depends on your requirements. Give us more detail and you might get a few recommendations..thx. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Shailender Jain [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Anusharan Tiwari [EMAIL PROTECTED]; Tapas Tiwari [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 8:12 AM Subject: Database Mapping Hai All, Will it be possible in the Struts to do some mapping between the form fields and underlining database by writing queries in the xml file. I want to develop a prototype with some functionality and do not want to do coding for this or minimal I saw similar functionality with JDBC Connection Servlet Framework (jcs) http://jresources.com But the problem is that the support for this seems to have been removed. If someone has got the JAR file concerning this framework then please send it to me. Any indication on this will be very helpful. Thanks Shailender Jain - 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: tiles ForwardAction
[EMAIL PROTECTED] wrote: Hello, is ther any way I can forward to a tile-definition? That is the only way you can ever get to a page at all in Struts, so the answer has to be Yes. Wrong, you can forward to a JSP page or to a servlet (used in StrutsCX) or to another action or to nothing at all (e.g. if you build the HttpRequest manually). Ciao Antonio Petrelli You mean that you build the HttpServletRequest manually on the client as a hack? Please give an example, for example. Ciao2! Michael McGrady - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles ForwardAction
[EMAIL PROTECTED] wrote: Hello, is ther any way I can forward to a tile-definition? That is the only way you can ever get to a page at all in Struts, so the answer has to be Yes. Wrong, you can forward to a JSP page or to a servlet (used in StrutsCX) or to another action or to nothing at all (e.g. if you build the HttpRequest manually). Ciao Antonio Petrelli I do suspect that, when you build the HttpServletRequest manually, you are not doing so with Struts. Can you please tell me how building an HttpServletRequest manually is doing it in Struts? Ciao3! Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm with all application attributes
Bill, this is for sure a disadavantage. Do you see others Actually, we're suceptible to this avantage in all forms, but i agree with you that if i have a base form with all atributes the chances of things getting messed up is a log bigger. --- Bill Siggelkow [EMAIL PROTECTED] escreveu: Are all of your getters and setters public? If so, (which I assume is true), one disadavantage is that request parameters can be passed in that set stuff on the form that you may not be expecting. For example, suppose your uber form supports properties for 'foo' 'bar' and 'baz'. Let's say one form sets the first two properties -- from a GET you would see: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=glob Now suppose some hacker comes along and does the following: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=globbaz=evilvalue Now, the property for baz has been set when you weren't expecting it to. - Bill Siggelkow Leandro Melo wrote: Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. - With this approach i got no coupling between my ActionForm and DTOs. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms that have these fields. This approach will only work correctly if you don't have fields with the same name in your application. Naturally, this is not a drawback because forces you to use a nice use of software engineering forcing you to give significant names for the fiels. Well, i'd appreciate comments (bad or nice ones) on that. Thanks, Leandro ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm with all application attributes
Bill, wait a minute, i just thought on something. I wouldn't matter if a hacker set a attributes in my BaseActionFomr, if i don't use it to build my DTOs. I mount my DTOs case specific, so i'd just ignore the hacker set attribute. But if this hacker set attribute is in my DTO, i agree that i could get problems. But if this attribute is present in the DTO it means that even if i was using the traditional way this attribute would present in the traditional ActionForm and, consequently, would be suceptible to the same problem. Got the point??? --- Bill Siggelkow [EMAIL PROTECTED] escreveu: Are all of your getters and setters public? If so, (which I assume is true), one disadavantage is that request parameters can be passed in that set stuff on the form that you may not be expecting. For example, suppose your uber form supports properties for 'foo' 'bar' and 'baz'. Let's say one form sets the first two properties -- from a GET you would see: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=glob Now suppose some hacker comes along and does the following: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=globbaz=evilvalue Now, the property for baz has been set when you weren't expecting it to. - Bill Siggelkow Leandro Melo wrote: Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. - With this approach i got no coupling between my ActionForm and DTOs. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms that have these fields. This approach will only work correctly if you don't have fields with the same name in your application. Naturally, this is not a drawback because forces you to use a nice use of software engineering forcing you to give significant names for the fiels. Well, i'd appreciate comments (bad or nice ones) on that. Thanks, Leandro ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding Tags Dynamically
Can I add struts tags dynamically after loading the page, using javascript probably??? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: Adding Tags Dynamically
Simple answer : no - Struts tags are converted to HTML tags during rendering -Opprinnelig melding- Fra: Hadeel Rashad [mailto:[EMAIL PROTECTED] Sendt: 9. september 2004 01:10 Til: 'Struts Users Mailing List'; [EMAIL PROTECTED] Emne: Adding Tags Dynamically Can I add struts tags dynamically after loading the page, using javascript probably??? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding Tags Dynamically
- JSP tags are translated into java code during JSP compilation BEFORE any request processing. - Javascript is executed by browser AFTER reponse has been built by server. Tags must be 'statically' set in JSP What do you ant to do ? Nico. Can I add struts tags dynamically after loading the page, using javascript probably??? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [ANN] Bridgetown IoC Framework
Peter, this sounds interesting, but what would Bridgetown offer over a more mature IoC container like Spring? robert -Original Message- From: Pilgrim, Peter [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 3:52 AM To: Struts User Apache (E-mail) Subject: FW: [ANN] Bridgetown IoC Framework FYI -Original Message- From: Peter A. Pilgrim [mailto:[EMAIL PROTECTED] Sent: 08 September 2004 07:12 To: Struts Developers List Subject: [ANN] Bridgetown IoC Framework Hi I have been quietly working on my own Inversion of Control lightweight framework over the last couple of months. My itch was scratched when I suddenly realised that ``Commons BeanUtils'' and ``Common Digester'' could be simply combined together into a bean assembly factory. An assembly factory could manage service beans in a lightweight container. Services could then be retrieved by name, and one doesn't have to worry about connecting different services together. Experiments showed that this idea was pretty cool and have implemented property and method dependency injection (aka ``BeanUtils'' and ``MethodUtils''). [Constructor injection is on the todo list. ] I am at the point where the current codebase is stable enough for development, but if I want the container to be more useful, then I need to open- source the project. It would allow others to write Dynamic proxy service beans, integrate with Struts 1.2/2+, or extend with AOP library, or whatever persistence layer EJB 3.0 decides to become. It cannot be down by just one man writing software. As an independent consultant I simply have not got the time to build everything. Moreover, I intend to follow the Struts style ``open integration'' philosophy that should allow Bridgetown IoC container to be added any other framework. (I intend add support to the Expresso Framework in the near term, since I am a core committer there) So my simple IoC Test Container became ``Bridgetown IoC''. I uploaded the source code to ``Sourceforge'' and slapped on it an Apache License 2.0 badge. The software is ALPHA quality but it compiles and run with Eclipse SDK 3, and there are junit test and a couple of examples. `` http://bridgetown.sf.net '' is the hook. I'd like publicly thank the man, Craig McClanahan, for his two inventions `BeanUtils' and `Digester'. Without those two components it just wouldn't have happened. Enjoy baby bop# -- Peter Pilgrim __ _ _ _ / //__ // ___// ___/ + Serverside Java / /___/ // /__ / /__ + Struts / // ___// ___// ___/ + Expresso Committer __/ // /__ / /__ / /__ + Independent Contractor /___/////// + Intrinsic Motivation On Line Resume http://jroller.com/page/peter_pilgrim || \\=== `` http://www.xenonsoft.demon.co.uk/no-it-striker.html '' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] [ Not subscribed to the users list at home ;-( ] -- Peter Pilgrim Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ, United Kingdom Tel: +44 (0)207 883 4447 == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == - 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]
[OT] RE: [ANN] Bridgetown IoC Framework
This is off topic to the Struts list. Also not forgetting Avalon, PicoContainer, etc from my POV. Admittedly these mature containers have been around for sometime. Here are my motivations: 1) To scratch the itch. Build a tiny container/kernel that I could experiment with in Expresso / Struts. The idea is make an assembler that can be merged into another toolkit. (My goal is to make Bridgetown a first class citizen in Expresso, but I am still scratching my head about this issue.) 2) I wanted to implement ``method injection''. 3) Build a pizza base, that I could extend later with a dynamic proxy generation / interceptors. Maybe directly support or use the Commons Chain (this is still very fuzzy in my mind.) 4) Eventually make services beans and service oriented architecture first class citizen of a ioc framework. 5) Fun: I wanted to experiment with Jakarta technologies. 6) Learning: I wanted to build something small and wonderful and it will be always free and open source. I enabled the sf.net mailing lists, so if you want to discuss further I suggest we take this thread over there. -- Peter Pilgrim Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ, United Kingdom Tel: +44 (0)207 883 4447 -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 08 September 2004 14:10 To: Struts Users Mailing List Subject: RE: [ANN] Bridgetown IoC Framework Peter, this sounds interesting, but what would Bridgetown offer over a more mature IoC container like Spring? robert -Original Message- From: Pilgrim, Peter [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 3:52 AM To: Struts User Apache (E-mail) Subject: FW: [ANN] Bridgetown IoC Framework FYI -Original Message- From: Peter A. Pilgrim [mailto:[EMAIL PROTECTED] Sent: 08 September 2004 07:12 To: Struts Developers List Subject: [ANN] Bridgetown IoC Framework Hi I have been quietly working on my own Inversion of Control lightweight framework over the last couple of months. My itch was scratched when I suddenly realised that ``Commons BeanUtils'' and ``Common Digester'' could be simply combined together into a bean assembly factory. An assembly factory could manage service beans in a lightweight container. Services could then be retrieved by name, and one doesn't have to worry about connecting different services together. Experiments showed that this idea was pretty cool and have implemented property and method dependency injection (aka ``BeanUtils'' and ``MethodUtils''). [Constructor injection is on the todo list. ] I am at the point where the current codebase is stable enough for development, but if I want the container to be more useful, then I need to open- source the project. It would allow others to write Dynamic proxy service beans, integrate with Struts 1.2/2+, or extend with AOP library, or whatever persistence layer EJB 3.0 decides to become. It cannot be down by just one man writing software. As an independent consultant I simply have not got the time to build everything. Moreover, I intend to follow the Struts style ``open integration'' philosophy that should allow Bridgetown IoC container to be added any other framework. (I intend add support to the Expresso Framework in the near term, since I am a core committer there) So my simple IoC Test Container became ``Bridgetown IoC''. I uploaded the source code to ``Sourceforge'' and slapped on it an Apache License 2.0 badge. The software is ALPHA quality but it compiles and run with Eclipse SDK 3, and there are junit test and a couple of examples. `` http://bridgetown.sf.net '' is the hook. I'd like publicly thank the man, Craig McClanahan, for his two inventions `BeanUtils' and `Digester'. Without those two components it just wouldn't have happened. Enjoy baby bop# -- Peter Pilgrim __ _ _ _ / //__ // ___// ___/ + Serverside Java / /___/ // /__ / /__ + Struts / // ___// ___// ___/ + Expresso Committer __/ // /__ / /__ / /__ + Independent Contractor /___/////// + Intrinsic Motivation On Line Resumehttp://jroller.com/page/peter_pilgrim || \\=== `` http://www.xenonsoft.demon.co.uk/no-it-striker.html '' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] [ Not subscribed to the users list at home ;-( ] -- Peter Pilgrim Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ, United Kingdom Tel: +44 (0)207 883 4447
Re: How to resolve label in ActionMessage?
You might be able to. Action.getResources() is actually implemented as return ((MessageResources) request.getAttribute(Globals.MESSAGES_KEY)); So try that to get the message resources, then call getMessage() on that. On Wed, 8 Sep 2004 09:59:03 -0400, White, Joshua A (HTSC, CASD) [EMAIL PROTECTED] wrote: Hubert, Are you unable to do this from an ActionForms validate method? Joshua -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 9:50 AM To: Struts Users Mailing List Subject: Re: How to resolve label in ActionMessage? The first parameter of the ActionMessage constructor is the message key. The rest (which are optional), are the actual parameters to the message. If your parameter is itself in need of evaluation, you'll need to do that yourself before you pass that on to ActionMessage. For that, you can call getResources(request).getMessage(activity.description) in your action. There are also getMessage() methods that take in a locale and parameters. Hubert On Wed, 8 Sep 2004 09:43:00 -0400, White, Joshua A (HTSC, CASD) [EMAIL PROTECTED] wrote: Hello all, The following piece of code appears in my validate method of an actionForm. How can I make work correctly? errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage(errors.required,activity.description)); where activity.description is a key in my messages.properties file, just like errors.required. I would like to have activity.description resolved to its value. Regards, Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - 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]
ActionForm data type X BeanUtils - using Dates
Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validating single fields in multi-page forms
Well, if I recall from your original post you only wanted to validate the fields on the current page only. Validator provides support for a page attribute that you can use for wizard-style forms. Validator will use that attribute to validate form fields on the current page and any previous pages. The reason it does the previous page is primarily for security since you cannot guarantee that form properties were set from the intended page. - Bill Siggelkow Langdon Stevenson wrote: Hi Bill Thanks for your suggestion. I have switched to ValidatorActionForm for my validation and now get the desired result (validation of only the fields that appear on the specific page). So problem solved! I am curious though about your interpretation of wizard style. The form is indeed wizard like, would you do things differently because of that? Langdon Bill Siggelkow wrote: If I understand you correctly, you are using a form for multiple-pages but not in a wizard fashion. The best way to do this is to use path-mapping for validator -- in this case your form extends ValidatorActionForm (or DynaValidatorActionForm) and you specify the path to the action for the form name in the validation.xml ... form name=/Foo/Bar ... for this action, only these fields will be validated... /form Bill Siggelkow Langdon Stevenson wrote: Hi I have a multi-page form (about 8 pages total) that take just a few fields per page that I am implementing in Struts (this is my first Struts project). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm with all application attributes
True -- some people use bulk property setters like those provided by BeanUtils to move data from the ActionForm to the DTO -- I think that is primarily where you would need to be careful. Personally, I am not fond of the use of an uber form; it doesn't seem very object-oriented; however, I can see advantages for small applications. - Bill Siggelkow Leandro Melo wrote: Bill, wait a minute, i just thought on something. I wouldn't matter if a hacker set a attributes in my BaseActionFomr, if i don't use it to build my DTOs. I mount my DTOs case specific, so i'd just ignore the hacker set attribute. But if this hacker set attribute is in my DTO, i agree that i could get problems. But if this attribute is present in the DTO it means that even if i was using the traditional way this attribute would present in the traditional ActionForm and, consequently, would be suceptible to the same problem. Got the point??? --- Bill Siggelkow [EMAIL PROTECTED] escreveu: Are all of your getters and setters public? If so, (which I assume is true), one disadavantage is that request parameters can be passed in that set stuff on the form that you may not be expecting. For example, suppose your uber form supports properties for 'foo' 'bar' and 'baz'. Let's say one form sets the first two properties -- from a GET you would see: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=glob Now suppose some hacker comes along and does the following: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=globbaz=evilvalue Now, the property for baz has been set when you weren't expecting it to. - Bill Siggelkow Leandro Melo wrote: Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. - With this approach i got no coupling between my ActionForm and DTOs. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms that have these fields. This approach will only work correctly if you don't have fields with the same name in your application. Naturally, this is not a drawback because forces you to use a nice use of software engineering forcing you to give significant names for the fiels. Well, i'd appreciate comments (bad or nice ones) on that. Thanks, Leandro ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bean tag and session data issue
Are you setting scope=session for the actions in your struts-config.xml? If so, I'd take it through a debugger. - Bill Siggelkow Langdon Stevenson wrote: Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. I now have a multi-page form backed by an ActionForm and an Action that appears to work fine (stepping from one page to the next, accepting input, validating it, storing it in an object in a session) except for the fact that the JSP pages do not retrieve the accumulating data from the object stored in the session, other than the first piece of data entered and the last. So I get a growing number of blank fields in the page. I have built and run a multi-step unit test with Struts Test Case that works fine. The Action creates the required object, stores it in the session, and adds the data piece by piece as the unit test simulates stepping through the wizard. This has at my wits end. Below is the code from the Action and one of the JSP pages that fails. Note: Only the first four pages are currently processed by business logic. The rest just return success regardless. I can't see what I am doing wrong. It seems like the object stored in the session isn't being updated properly (although the unit test disproves this), so perhaps its something I have messed up in the JSP, or don't fully understand? Any assistance anyone can offer would be greatfully received. Regards, Langdon -- StudentRegistrationWizardAction.java package adamh; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; /** * Created by IntelliJ IDEA. * User: langdons * Date: 18/08/2004 * Time: 18:44:41 * To change this template use Options | File Templates. */ public class StudentRegistrationWizardAction extends Action{ private static Log log = LogFactory.getLog(StudentRegistrationWizardAction.class); public static final String STUDENT_KEY = adamh.StudentRegistrationWizardAction.STUDENT; public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { log.trace(In execute of StudentRegistrationWizardAction); if ((request.getSession().getAttribute(STUDENT_KEY)) == null) { Student newStudent = new Student(); request.getSession().setAttribute(STUDENT_KEY, newStudent); } /* Check to see if the user cancellend the registration process */ if (isCancelled(request)) { log.debug(Cancel Button was pushed!); request.getSession().removeAttribute(STUDENT_KEY); request.getSession().removeAttribute(mapping.getAttribute()); return mapping.findForward(welcome); } /* Get the form data */ StudentRegistrationWizardForm studentForm = (StudentRegistrationWizardForm) form; int page = studentForm.getPage(); if (page == 1) { return processRegReferrer(mapping, studentForm, request, response); } else if (page == 2) { return processEmailAddress(mapping, studentForm, request, response); } else if (page == 3) { return processPassword(mapping, studentForm, request, response); } else if (page == 4) { return processNickname(mapping, studentForm, request, response); } else if (page == 5) { return mapping.findForward(success); } else if (page == 6) { return mapping.findForward(success); } else if (page == 7) { return mapping.findForward(success); } else if (page == 8) { return mapping.findForward(success); } else if (page == 9) { return mapping.findForward(success); } return processRegReferrer(mapping, studentForm, request, response); } public ActionForward processRegReferrer( ActionMapping mapping, StudentRegistrationWizardForm studentForm, HttpServletRequest request, HttpServletResponse response) throws Exception { log.trace(In processRegReferrer of StudentRegistrationWizardAction); String referrerId = studentForm.getReferredById(); Student student = (Student) request.getSession().getAttribute(STUDENT_KEY); if (student == null) { throw new java.lang.IllegalStateException( Missing student in session scope); } else { if (referrerId != null) { /** * TODO:
500 Internal Server Error java.lang.NoSuchMethodError
Hi All, I am trying to call a method on ejb through business delegate which in turn is called by struts action class. I have created a project in Jdeveloper and this is working fine. When I created an ear file using ant script and deployed this in oc4j903 then I got following error 500 Internal Server Error java.lang.NoSuchMethodError Any inputs... TIA... Regards, Viral
Re: 500 Internal Server Error java.lang.NoSuchMethodError
I have your solution: Find out which method is being called and do not call that method, it does not exist. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Viral_Thakkar [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 11:06 AM Subject: 500 Internal Server Error java.lang.NoSuchMethodError Hi All, I am trying to call a method on ejb through business delegate which in turn is called by struts action class. I have created a project in Jdeveloper and this is working fine. When I created an ear file using ant script and deployed this in oc4j903 then I got following error 500 Internal Server Error java.lang.NoSuchMethodError Any inputs... TIA... Regards, Viral - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 500 Internal Server Error java.lang.NoSuchMethodError
Method exists both in BD and EJB still this error is coming... Below is the stack trace.. 500 Internal Server Error java.lang.NoSuchMethodError at com.tropics.web.commonservices.services.batch.BatchServiceBD.searchBatch Process(BatchServiceBD.java:86) at com.tropics.web.commonservices.action.batch.BatchAction.execute(BatchAct ion.java:103) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr ocessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatch er.java:721) at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletReques tDispatcher.java:306) at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.j ava:767) at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:259) at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:106) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecuto r.java:797) at java.lang.Thread.run(Thread.java:484) -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 8:43 PM To: Struts Users Mailing List Subject: Re: 500 Internal Server Error java.lang.NoSuchMethodError I have your solution: Find out which method is being called and do not call that method, it does not exist. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Viral_Thakkar [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 11:06 AM Subject: 500 Internal Server Error java.lang.NoSuchMethodError Hi All, I am trying to call a method on ejb through business delegate which in turn is called by struts action class. I have created a project in Jdeveloper and this is working fine. When I created an ear file using ant script and deployed this in oc4j903 then I got following error 500 Internal Server Error java.lang.NoSuchMethodError Any inputs... TIA... Regards, Viral - 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: Struts XDoclet examples
That's good information; I read it with vigor... As you can tell, I'm excited by the prospects of using XDoclet instead of insert proprietary tool here. And, I think I get the gist of Struts related support provided in XDoclet, but I have a couple of questions. 1 -- How good is the DynaValidatorForm support? I saw the announcement: http://www.systemmobile.com/code/xdoclet-dynaform-README.txt. That looks well and good, but there appear to be some discrepancies: Class Level Tags: @struts.dynaform Attributes: name- The name of the form bean in the config. [required] type- The type of DynaForm. [required] description - Descriptive string. [optional] className - The config class. [optional] validate- If set, the validator code will generate a form definition for this dynaform. [optional] Method Level Tags: @struts.dynaform-field Attributes: name - The name of the form field. If not specified, the property name of the method is used. [optional] What method? I thought this was a dynaform? type - The type of field. If not specified, the return type of the getter is used. [optional] Again, we're talking about dynaforms... I'm going to put these XDoclet tags in an Action, I presume. Is there support for DispatchActions? I'm just starting to dig into this tool. I may end up adding some code of my own to these projects, just so I don't sound like a whiner. Thanks, Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm with all application attributes
-Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 5:48 PM To: struts jakarta Subject: ActionForm with all application attributes Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. Didn't see this post, but yes there could be 1 to many between ActinForm and DTO's, and this is not a problem. ActionForms directly represent what is on the screen, while DTO's represent your data. You have a 1-to-many relationship between screens and tables. - With this approach i got no coupling between my ActionForm and DTOs. What do you mean by coupling? You still have to transfer data to and from the DTO. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. The strtus validate stuff is centralized, and easier to configure. Doing it all in one class, means that at some point your going to have logic to handle special cases The more of these you have hte more complex the logic... Complex logic is directly related to the stability of your code. In addition I don't have to code the validations myself. Just specify what I want validated and I'm done. You could do the same thing, however you still have to glue it all together. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. You can do this with custom validation classes and still achieve centralizations. Depending on what you mean by light business validation. I like consistency in where things are. Business rules in business layer, and validation in the view tier. A newcomer to the app would have to guess (yeah, sure they'll ask, maybe) where the code is supposed to go. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. With the standard struts approach I have even smaller action classes no validate or reset methods. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms that have these fields. You can do this with a base action form. This approach will only work correctly if you don't have fields with the same name in your application. Naturally, this is not a drawback because forces you to use a nice use of software engineering forcing you to give significant names for the fiels. Not entirely true. I have several fields that get validated differently based on where they come from, or where the data is going (some customers will accept a phone number that is 10-30 numbers, -() and '.', others want a US phone number). Right now, I use a different form bean for each, and use a common base class for everything. The different child class allows for different completely different validations, which is what I need. Doing it your way would make this customization much harder, since I would have to sublcass the validation class too. With struts 1.2, I can use inheritance and make this even easier then the copy and paste I use now. Well, i'd appreciate comments (bad or nice ones) on that. Thanks, Leandro ___ Yahoo!
RE: Proper place for validation
-Original Message- From: Janne Mattila [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 3:49 AM To: [EMAIL PROTECTED] Subject: RE: Proper place for validation Hmm, not a lot of comments on this. I guess there is a consensus on the matter (that, or no-one really gives a damn). A quick followup on this; how could I achieve both a) decoupling of my business classes from Struts b) internationalization if I validate in my business class? 1) if (alreadyExists(email)) { throw new MyAppException(E-mail address already exists); achieves a) but not b), and 2) if (alreadyExists(email)) { throw new MyAppException(errors.email.duplicate); Simple, you throw EmailAlreadyExists( email), and catch that, or use the exception handling ability of struts to give an appropriate error message to the user. For system level stuff (ie DB is missing etc) you inlcude a cause, but don't necessarily show it to the user. achieves b) but not a) From: Robert Taylor [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: Proper place for validation Date: Tue, 7 Sep 2004 08:21:09 -0400 From: Robert Taylor [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: Proper place for validation Date: Tue, 7 Sep 2004 08:21:09 -0400 I would avoid putting any business logic in the action class. Place this type of logic in the business class as it most likely is validation that is valid across all application logic and not for just one use case. robert -Original Message- From: Janne Mattila [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 8:15 AM To: [EMAIL PROTECTED] Subject: Proper place for validation I am wondering what would be the propert place for some validation code. Let's say I have a registration page where user inputs his/her information for a new user account. There's a field for e-mail address. On one level that information is validated on the ActionForm, for things such as - field is not left empty, if it is required - field is a valid e-mail address That much seems quite clear. But where should I put a check that ensures that same e-mail address is not already used by an existing account? On the other hand, I could put it in the registration action, because checking that is (kind of) user-input validation, and action is a natural place to do this. On the other hand, I could put it in my business class. The pros for this would be smaller and simpler action code, and reuse if same check is needed with different actions. Any suggestions? Intuitively, I think I would put that check in the Action, but I am happy to hear any arguments in favor or opposing that. _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - 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] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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: ActionForm with all application attributes
-Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 5:40 AM To: Struts Users Mailing List Subject: Re: ActionForm with all application attributes Bill, wait a minute, i just thought on something. I wouldn't matter if a hacker set a attributes in my BaseActionFomr, if i don't use it to build my DTOs. I mount my DTOs case specific, so i'd just ignore the hacker set attribute. But if this hacker set attribute is in my DTO, i agree that i could get problems. But if this attribute is present in the DTO it means that even if i was using the traditional way this attribute would present in the traditional ActionForm and, consequently, would be suceptible to the same problem. Got the point??? Why give them any hooks you don't have to? Sure today you're not using the field, what about tomorrow? If the field isn't there in the form, then struts won't copy the attacking value into it, and you won't have to worry about it at all. --- Bill Siggelkow [EMAIL PROTECTED] escreveu: Are all of your getters and setters public? If so, (which I assume is true), one disadavantage is that request parameters can be passed in that set stuff on the form that you may not be expecting. For example, suppose your uber form supports properties for 'foo' 'bar' and 'baz'. Let's say one form sets the first two properties -- from a GET you would see: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=glob Now suppose some hacker comes along and does the following: http://localhost/myapp/SubmitFooBar.do?foo=blahbar=globbaz=evilvalue Now, the property for baz has been set when you weren't expecting it to. - Bill Siggelkow Leandro Melo wrote: Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. - With this approach i got no coupling between my ActionForm and DTOs. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms that have these fields. This approach will only work correctly if you don't have fields with the same name in your application. Naturally, this is not a drawback because forces you to use a nice use of software engineering forcing you to give significant names for the fiels. Well, i'd appreciate comments (bad or nice ones) on that. Thanks, Leandro ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED]
Re: Struts XDoclet examples
I should probably post this stuff on XDoclet's list ... David Durham wrote: That's good information; I read it with vigor... As you can tell, I'm excited by the prospects of using XDoclet instead of insert proprietary tool here. And, I think I get the gist of Struts related support provided in XDoclet, but I have a couple of questions. 1 -- How good is the DynaValidatorForm support? I saw the announcement: http://www.systemmobile.com/code/xdoclet-dynaform-README.txt. That looks well and good, but there appear to be some discrepancies: Class Level Tags: @struts.dynaform Attributes: name- The name of the form bean in the config. [required] type- The type of DynaForm. [required] description - Descriptive string. [optional] className - The config class. [optional] validate- If set, the validator code will generate a form definition for this dynaform. [optional] Method Level Tags: @struts.dynaform-field Attributes: name - The name of the form field. If not specified, the property name of the method is used. [optional] What method? I thought this was a dynaform? type - The type of field. If not specified, the return type of the getter is used. [optional] Again, we're talking about dynaforms... I'm going to put these XDoclet tags in an Action, I presume. Is there support for DispatchActions? I'm just starting to dig into this tool. I may end up adding some code of my own to these projects, just so I don't sound like a whiner. Thanks, Dave - 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: Proper place for validation
-Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 6:39 AM To: Struts Users Mailing List Subject: Re: Proper place for validation Maybe there weren't a lot of comments because people agreed with Robert. :) For your followup, the reason you get one of (a) and (b) is because you're thinking that the error message should come from the business tier. I like to think that it shouldn't. In fact, not only shouldn't it just come from the business tier, it can't. What happens if your DBA accidently fat fingers your DB (drop table or db, deletes a column, marks it read only)? or your SQL? What happens if your cleaning lady/cow-orker/boss kicks the network cable out of the DB? Or the network cable goes bad? Where do these kinds of things get handled?[1] Which is why I like chained exceptions. The DAO layer has an issue, that's a specific message that the business layer wraps up in an exception that get tossed up to presentation, where the struts exception handler decides what to dispaly, and how to dispaly it. Error messages are a presentation tier responsibility. In the business tier, the exception should be able to communicate with other objects what the error was. The way I do this is with specific exception types or with error codes. If the exception is caught by another business tier object, it can check the error code to see what exactly happened. If it bubbles up all the way to the presentation tier, it can do the same, and then select an i18n error message to show, or other take other action as needed. I agree... handle the right exception at the right time, but never ignore. [1] Yes these have all happened in production with highly competent people. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm data type X BeanUtils - using Dates
BeanUtils.copyProperties() method does not work with date fields. One needs to copy it manually using DateFormatter ot something. To avoid garbage getting into date variable in domain object, one should name it other way. For example, if domain object has : Date paymentDate; you should rename the variable for this date in form as datePayment so that it does not get copied to domain object. -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils - using Dates Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
You can register a different converter that BeanUtils uses to copy from a string to a date. Write your own converter, using the date format you need, then use ConvertUtils.register(...) to register it. That's what I do anyhow. -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils - using Dates Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Proper place for validation
Jim Barrows wrote: -Original Message- From: Janne Mattila [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 3:49 AM To: [EMAIL PROTECTED] Subject: RE: Proper place for validation Hmm, not a lot of comments on this. I guess there is a consensus on the matter (that, or no-one really gives a damn). A lot of these sort of questions are, I think, badly framed. They are asked as if there is some definitive thing that is always right. The important thing, I think, is to get the principles and to use them to good effect depending on your needs. There are too many knee jerk decisions based on principles not really understood. I think, for example, that exceptions should be handled as soon as possible /as a rule/ but not always. I don't understand questions like how do I decouple X from Y?. Does that mean: (1) How do I decouple? or (2) How should I decouple in this case?. When the question are badly framed, they lead to meandering and I tend to disengage myself from the discussion because it is too time consuming to follow. This is what I think happened in this case. Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm with all application attributes
Jim, all the code i`m talking about is inside a Base Action Form. It seems the you`re thinking that my code is inside a action, aren`t you?? Maybe a misundertanding, maybe mine, maybe yours. So, i agree with some of your comments, but not on all of thems. In fact, i`m gonna to take a look about this customized classes to use with validator. --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 5:48 PM To: struts jakarta Subject: ActionForm with all application attributes Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. Didn't see this post, but yes there could be 1 to many between ActinForm and DTO's, and this is not a problem. ActionForms directly represent what is on the screen, while DTO's represent your data. You have a 1-to-many relationship between screens and tables. - With this approach i got no coupling between my ActionForm and DTOs. What do you mean by coupling? You still have to transfer data to and from the DTO. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. The strtus validate stuff is centralized, and easier to configure. Doing it all in one class, means that at some point your going to have logic to handle special cases The more of these you have hte more complex the logic... Complex logic is directly related to the stability of your code. In addition I don't have to code the validations myself. Just specify what I want validated and I'm done. You could do the same thing, however you still have to glue it all together. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. You can do this with custom validation classes and still achieve centralizations. Depending on what you mean by light business validation. I like consistency in where things are. Business rules in business layer, and validation in the view tier. A newcomer to the app would have to guess (yeah, sure they'll ask, maybe) where the code is supposed to go. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. With the standard struts approach I have even smaller action classes no validate or reset methods. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms that have these fields. You can do this with a base action form. This approach will only work correctly if you don't have fields with the same name in your application. Naturally, this is not a drawback because forces you to use a nice use of software engineering forcing you to give significant names for the fiels. Not entirely true. I have several fields that get validated differently based on where they come from, or where the data is going (some customers will accept a phone number that is 10-30 numbers, -() and '.', others want a US phone number). Right now, I use a different form bean for each, and use a common base
Re: ActionForm data type X BeanUtils - using Dates
Could you point us at some code that does this? Do you customize in the action, the form or the DTO? Bryce Fischer wrote: You can register a different converter that BeanUtils uses to copy from a string to a date. Write your own converter, using the date format you need, then use ConvertUtils.register(...) to register it. That's what I do anyhow. -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils - using Dates Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. - 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: ActionForm data type X BeanUtils - using Dates
I also would like to see this converter code and how to use it!!! --- Jason King [EMAIL PROTECTED] escreveu: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? Bryce Fischer wrote: You can register a different converter that BeanUtils uses to copy from a string to a date. Write your own converter, using the date format you need, then use ConvertUtils.register(...) to register it. That's what I do anyhow. -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils - using Dates Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. - 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] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] How to sort with c:forEach?
Hi, Is there an easy way to have the JSTL forEach tag sort the collection of items before looping through them? Currently I have a scriptlet doing it before the loop tag, but this is pretty ugly. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
Kind of being picky here, but I wouldn't switch the property name like that -- instead; since the form field would be a String I would use String getPaymentDateString() {...} in the ActionForm and Date getPaymentDate() {...} in the domain object. Desai, Sunny wrote: BeanUtils.copyProperties() method does not work with date fields. One needs to copy it manually using DateFormatter ot something. To avoid garbage getting into date variable in domain object, one should name it other way. For example, if domain object has : Date paymentDate; you should rename the variable for this date in form as datePayment so that it does not get copied to domain object. -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils - using Dates Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm with all application attributes
-Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 9:48 AM To: Struts Users Mailing List Subject: RE: ActionForm with all application attributes Jim, all the code i`m talking about is inside a Base Action Form. It seems the you`re thinking that my code is inside a action, aren`t you?? Maybe a misundertanding, maybe mine, maybe yours. No, I understood you to have it in a Base Action. So, i agree with some of your comments, but not on all of thems. In fact, i`m gonna to take a look about this customized classes to use with validator. Another trick, is to use the same AcitonForm class, but call it different things. Since validator will work by name, and not by class you can customize based on that alone. You can also validate a form by action mapping, rather then by form name. --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 5:48 PM To: struts jakarta Subject: ActionForm with all application attributes Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. Didn't see this post, but yes there could be 1 to many between ActinForm and DTO's, and this is not a problem. ActionForms directly represent what is on the screen, while DTO's represent your data. You have a 1-to-many relationship between screens and tables. - With this approach i got no coupling between my ActionForm and DTOs. What do you mean by coupling? You still have to transfer data to and from the DTO. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. The strtus validate stuff is centralized, and easier to configure. Doing it all in one class, means that at some point your going to have logic to handle special cases The more of these you have hte more complex the logic... Complex logic is directly related to the stability of your code. In addition I don't have to code the validations myself. Just specify what I want validated and I'm done. You could do the same thing, however you still have to glue it all together. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. You can do this with custom validation classes and still achieve centralizations. Depending on what you mean by light business validation. I like consistency in where things are. Business rules in business layer, and validation in the view tier. A newcomer to the app would have to guess (yeah, sure they'll ask, maybe) where the code is supposed to go. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes. With the standard struts approach I have even smaller action classes no validate or reset methods. - With this approach i also have a central unit of fields and their types, so if it's necessary to chance them, i don't need to go through all the action forms
Re: ActionForm data type X BeanUtils - using Dates
http://jakarta.apache.org/commons/beanutils/api/index.html Leandro Melo wrote: I also would like to see this converter code and how to use it!!! --- Jason King [EMAIL PROTECTED] escreveu: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? Bryce Fischer wrote: You can register a different converter that BeanUtils uses to copy from a string to a date. Write your own converter, using the date format you need, then use ConvertUtils.register(...) to register it. That's what I do anyhow. -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils - using Dates Hi, i believe that a lot of developers use BeanUtils to copy the data from ActionForms to the specific DTOs. I've used this approach, but right now i'm facing a problem, not a big one. I've allways been confused about working with dates in Java. I got a jsp where the user must input a date in the following format. Date: dd/mm/ That's how we use dates in Brazil: the day, month and year. I'd like to make a validation if the user input the date in the correct manner in the ActionForm (i'm using traditional validation and the user input comes in a String). So, keeping in mind the variou ways of doing this date validation (even the deprecated ones), how should a do the date validation Which one is the best way??? I just want to check if the user input a day with 2 digits, a slash, a month with 2 digits, a slash and a year with 4 digits. Also, after that i'd like to copy this form data to my DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks, Leandro. - 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] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] How to sort with c:forEach?
-Original Message- From: Craig Dickson [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 9:51 AM To: Struts List Subject: [OT] How to sort with c:forEach? Hi, Is there an easy way to have the JSTL forEach tag sort the collection of items before looping through them? Currently I have a scriptlet doing it before the loop tag, but this is pretty ugly. If you use some of the jakarta commons collection stuff you could call a setter and have the collection auto-sort. I'm assuming your talking about allowing dynamic resort of a table by column, as opposed to not doing it coming out of the database. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
strange random problem
Since I have rewrited an important part of my application using struts I've had this problem several times. It didn't happen in development environment, with only one or two users using the application at the same time. It happends in production with 20 or 30 users. * Development environment: Debian GNU/Linux, Jonas 4.1.2 application server with Tomcat 5.0.25, J2SE 1.4.2, Struts 1.1, MS SQL Server (on different Win2000 machine) * Production environment: Win2000 SP4, Jonas 4.1.2 application server with Tomcat 5.0.25, J2SE 1.4.2, Struts 1.1, MS SQL Server. All forms are request scoped (I think I don't need session, probably I'm saving memory). Every of them have implemented the reset method setting variables to their initial values, this is made in constructors too. * This is a bit more complex so I'll try to simplify the explanation with a generic example: 1. I have one object wich instances can be edited and updated by users, saving its instance values to a database. I have two actions: EditObjectAction and UpdateObjectAction, each of them with their forms (EditObjectForm and UpdateObjectForm). 2. EditObjectForm has only one String attribute that contains the primary key (id) of the object we want to edit, submitted from a jsp page. 3. EditObjectAction gets the primary key from the form, instances the object and call the necesary methods on it in order to load the rest of object data from database. Then the action put the object in the request using request.setAttribute(objectName, object) method and makes a forward (using mapping.findForward(...)) to the page data.jsp. 4. Into the data.jsp page I render the view using struts-html, struts-html-el and c (JSTL) taglibs, extracting the necessary information from the request object using JSTL expressions like: c:out value=${objectName.attribute}/. The html:form/ tag has this content: a) Primary key: html-el:hidden property=id value=${objectName.id} / b) Rest of object data using html_el:text/ and other useful tags like loops etc. 5. When the user change and submits the data, UpdateObjectForm is created and filled by struts, content validated, and passed to UpdateObjectAction. The action takes the id from the form and instances the object again from database, it updates object values from the form in memory and database, puts the object into request and forward to data.jsp again. 6. Data.jsp is rendered from the request object again with the new submitted data. Note that the object is NEVER stored into the session. Forms are request scoped. The only information I keep into session is the logged user. I don't use application scope. The problem is that sometimes (about 10% more or less), once the object is updated, the next view shows data from another different object instance that is currently being managed by other user. The forward or the render fails. I thought about a possible coding or design error, but is it not impossible to access data from other session? moreover the object is stored into request. Am I using struts in a correct way? Could it be a taglibs or struts bug or configuration error? What do you think about trying struts 1.2.2 or using linux in production? I think probably is much more easy but I don't see it. Thank you in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
The custom converter is done independently of the action, form or DTO. First step is to implement the interface org.apache.commons.beanutils.Converter. Keep in mind that the converter you are writing uses the appropriate converter for the original class. So, if you were converting from a String to a Date, you would create a String converter. And vice versa, if you were converting from a Date to a String you would create a Date converter. Example below Then, to override the standard converters, you call: ConvertUtils.register(Your converter class, class to use converter on.class); First parameter is your new converter, and the second is the class its used for. I call this in a static initializer of a utility class, you just need to make sure its called before any validations occur, and it only needs to be done once. Since we are interested in customizing conversions from String to Date, I override the String converter: public class StringConverter implements Converter{ public Object convert(Class type, Object value) { Object returnObj = null; if (value != null) { if (value instanceof Date){ returnObj = dateFormatter.format((Date)value); } else if (value instanceof BigDecimal){ returnObj = decimalFormatter.format((BigDecimal)value); } else { returnObj = value.toString(); } } return returnObj; } } I've left out some properties, their getters and setters, but I think you get the gist of what I'm doing. Now, I register this converter as such: ConvertUtils.register(new StringConverter(), String.class); I actually have a utility class, where the register is done in the static initializer. I suppose another way would be to use a servlet that loads prior to Struts.. Or if your Actions have a base class, etc... Maybe there's a more elegant way of doing that. This is what I've come up with. If someone has a better way, post please, I'm always looking for more elegant ways of accomplishing stuff like this. Jason King wrote: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: strange random problem
-Original Message- From: calandraca [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:04 AM To: Struts Users Mailing List Subject: strange random problem Since I have rewrited an important part of my application using struts I've had this problem several times. It didn't happen in development environment, with only one or two users using the application at the same time. It happends in production with 20 or 30 users. snip The problem is that sometimes (about 10% more or less), once the object is updated, the next view shows data from another different object instance that is currently being managed by other user. The forward or the render fails. I thought about a possible coding or design error, but is it not impossible to access data from other session? moreover the object is stored into request. Am I using struts in a correct way? Could it be a taglibs or struts bug or configuration error? What do you think about trying struts 1.2.2 or using linux in production? I think probably is much more easy but I don't see it. you have a multithreading issue, probably between your action class and the DAO classes. I'm guessing that you're reading of other peoples data is occuring when two users are using the app at the exact same time, doing the exact same thing (with different data). That should be easy to re-create. This could be caused by: 1) You are using the same DAO class for all sessions. Bad programmer, no caffeine. 2) You are using the same business object class for all sessions. Bad programmer, no caffeine. 3) Someting the DAO classes use is the same between sessions, that you are using to transfer data. Bad Programmer, no caffeine. I've found, that most of the above is done to avoid a perceived performance hit. It is never a good idea to code for performance before the codeing is done, ESPECIALLY on the web. You usually end up creating a bottleneck, or end up in a multi-threading issue. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: strange random problem
How are you doing the database interactions with your MS SQL Server? JDBC with some ODBC connectivity kit or some other way? Regards, David -Original Message- From: calandraca [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:04 PM To: Struts Users Mailing List Subject: strange random problem Since I have rewrited an important part of my application using struts I've had this problem several times. It didn't happen in development environment, with only one or two users using the application at the same time. It happends in production with 20 or 30 users. * Development environment: Debian GNU/Linux, Jonas 4.1.2 application server with Tomcat 5.0.25, J2SE 1.4.2, Struts 1.1, MS SQL Server (on different Win2000 machine) * Production environment: Win2000 SP4, Jonas 4.1.2 application server with Tomcat 5.0.25, J2SE 1.4.2, Struts 1.1, MS SQL Server. All forms are request scoped (I think I don't need session, probably I'm saving memory). Every of them have implemented the reset method setting variables to their initial values, this is made in constructors too. * This is a bit more complex so I'll try to simplify the explanation with a generic example: 1. I have one object wich instances can be edited and updated by users, saving its instance values to a database. I have two actions: EditObjectAction and UpdateObjectAction, each of them with their forms (EditObjectForm and UpdateObjectForm). 2. EditObjectForm has only one String attribute that contains the primary key (id) of the object we want to edit, submitted from a jsp page. 3. EditObjectAction gets the primary key from the form, instances the object and call the necesary methods on it in order to load the rest of object data from database. Then the action put the object in the request using request.setAttribute(objectName, object) method and makes a forward (using mapping.findForward(...)) to the page data.jsp. 4. Into the data.jsp page I render the view using struts-html, struts-html-el and c (JSTL) taglibs, extracting the necessary information from the request object using JSTL expressions like: c:out value=${objectName.attribute}/. The html:form/ tag has this content: a) Primary key: html-el:hidden property=id value=${objectName.id} / b) Rest of object data using html_el:text/ and other useful tags like loops etc. 5. When the user change and submits the data, UpdateObjectForm is created and filled by struts, content validated, and passed to UpdateObjectAction. The action takes the id from the form and instances the object again from database, it updates object values from the form in memory and database, puts the object into request and forward to data.jsp again. 6. Data.jsp is rendered from the request object again with the new submitted data. Note that the object is NEVER stored into the session. Forms are request scoped. The only information I keep into session is the logged user. I don't use application scope. The problem is that sometimes (about 10% more or less), once the object is updated, the next view shows data from another different object instance that is currently being managed by other user. The forward or the render fails. I thought about a possible coding or design error, but is it not impossible to access data from other session? moreover the object is stored into request. Am I using struts in a correct way? Could it be a taglibs or struts bug or configuration error? What do you think about trying struts 1.2.2 or using linux in production? I think probably is much more easy but I don't see it. Thank you in advance - 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] How to sort with c:forEach?
Do it in the business layer that fetches the collection -- or in the database -- or store the data in a sorted collection (like SortedTreeMap or some similar animal). Craig Dickson wrote: Hi, Is there an easy way to have the JSTL forEach tag sort the collection of items before looping through them? Currently I have a scriptlet doing it before the loop tag, but this is pretty ugly. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm with all application attributes
--- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 9:48 AM To: Struts Users Mailing List Subject: RE: ActionForm with all application attributes Jim, all the code i`m talking about is inside a Base Action Form. It seems the you`re thinking that my code is inside a action, aren`t you?? Maybe a misundertanding, maybe mine, maybe yours. No, I understood you to have it in a Base Action. So, i agree with some of your comments, but not on all of thems. In fact, i`m gonna to take a look about this customized classes to use with validator. Another trick, is to use the same AcitonForm class, but call it different things. Since validator will work by name, and not by class you can customize based on that alone. You can also validate a form by action mapping, rather then by form name. Would you mind showing an example on how to do that? --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 5:48 PM To: struts jakarta Subject: ActionForm with all application attributes Hi, i sent this question yesterday, but as nowbody answered me, i trying it again with a more sifinificant title (sorry for the re-post). Also, if i'm doing something terrible, i'd like to know. Keeping in mind that more than one action form may have to validate and/or reset the same fields, i decided to this. I already have a MyBaseActionForm which incorporates all some methods that i need in my application. I don't use Validator, as i prefer to use java classes for validation ligth business logic. Now, i decided to add ALL fileds (setters and getters) i have in my application as private members of this MyBaseActionForm. Then i created classes WebValidation and WebReset. This classes have validate methods for all fields in my application. These classes can access the fields they need for each method because all my action forms extend the MyBaseActionForm, thus this WebValidation and WebReset classes can call the setters and getters of an y action form to validate with the light business logic i need. I got with this approach a centralized way and component responsible for the validation. All my action forms delegate the validate and reset methods to the classes i mentioned. I'd like to briefly describe some nice benefits of this approach. - With this approach i definetly solve my earlier problem that i posted on question 1:N relationships - ActionForm x DTOs. Didn't see this post, but yes there could be 1 to many between ActinForm and DTO's, and this is not a problem. ActionForms directly represent what is on the screen, while DTO's represent your data. You have a 1-to-many relationship between screens and tables. - With this approach i got no coupling between my ActionForm and DTOs. What do you mean by coupling? You still have to transfer data to and from the DTO. - With this approach i have a centralized validate unit. It's very usual to have more than 1 action form validating the same field, what may causes some duplication and a harder maintenance. A central unit of validation and resetting suits this problem very well. The strtus validate stuff is centralized, and easier to configure. Doing it all in one class, means that at some point your going to have logic to handle special cases The more of these you have hte more complex the logic... Complex logic is directly related to the stability of your code. In addition I don't have to code the validations myself. Just specify what I want validated and I'm done. You could do the same thing, however you still have to glue it all together. - With this approach i can perform light business validation that must be done in java code. So, for one or more situation i could access some util classes that do some validation for me. You can do this with custom validation classes and still achieve centralizations. Depending on what you mean by light business validation. I like consistency in where things are. Business rules in business layer, and validation in the view tier. A newcomer to the app would have to guess (yeah, sure they'll ask, maybe) where the code is supposed to go. - With this approach i have very small action forms that basically has a validate and reset methods that just delegate to the WebValidation and WebReset classes.
RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward)
Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? --- Caroline Jen [EMAIL PROTECTED] wrote: Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 2:25 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (Now, the Hyperlink Is Not Working) Now, I do not even get the hyperlink working. In my JSP 1, which is home.jsp, I have this hyperlink (something is wrong with it): html:link forward=/RegisterRegister/html:link html:link action=/RegisterRegister/html:link However, upon further reflction... If what you really want is a href=/Register.doRegister/a generated, then you could do it with an action forward too. Which is what you tried to do above, you just need a global forward call /Register, or rather Register. The difference between the two? Not much in terms of basic functionality. Lots in terms of re=use. I tend to like the start of my use cases as global action forwards, that way I can change how to get into them action wise. In my struts.config.xml file, I have this action mapping: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where the .frame.Enrollment is a piece tile. I got the following message in the browser: [ServletException in:/frame/content/home.jsp] Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named /Register' What is wrong with my code? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 1:03 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP What is the answer? Do you mean action forward=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where .frame.Enrollment is the tile that contains my JSP 2. action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=/path/to/jsp/ or action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=tilename/ The name, scope and input of course being optional. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 12:52 PM To: Struts Users Mailing List Subject: Re: Action Mapping From a JSP to Another JSP I think Jim meant to say ForwardAction. http://struts.apache.org/api/org/apache/struts/actions/Forward Action.html I did say that :) The fingers on the other hand.. :) On Tue, 7 Sep 2004 12:49:49 -0700, Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 12:46 PM To: [EMAIL PROTECTED] Subject: Action Mapping From a JSP to Another JSP I have two JSPs: JSP 1 and JSP 2 JSP 1 has a hyperlink (register). Once users click on the 'register' hyperlink, the users are suppose to have JSP 2 displayed in the browser. That is to say, there is no action to be performed from JSP 1 to JSP 2. How do I specify the action mapping in the === message truncated ===
RE: ActionForm with all application attributes
-Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:25 AM To: Struts Users Mailing List Subject: RE: ActionForm with all application attributes --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 9:48 AM To: Struts Users Mailing List Subject: RE: ActionForm with all application attributes Jim, all the code i`m talking about is inside a Base Action Form. It seems the you`re thinking that my code is inside a action, aren`t you?? Maybe a misundertanding, maybe mine, maybe yours. No, I understood you to have it in a Base Action. So, i agree with some of your comments, but not on all of thems. In fact, i`m gonna to take a look about this customized classes to use with validator. Another trick, is to use the same AcitonForm class, but call it different things. Since validator will work by name, and not by class you can customize based on that alone. You can also validate a form by action mapping, rather then by form name. Would you mind showing an example on how to do that? http://struts.apache.org/api/org/apache/struts/validator/ValidatorActionForm.html As opposed to ValidatorForm. The following is from memory, but should be close. Assuming the following struts-config.xml blah blah form-bean name=ChangeAddressForm type=com.sssc.csr.web.forms.BorrowerDemographicsForm/form-bean blah blah action path=/changeAddress name=ChangeAddressForm validate=true type=com.sssc.csr.web.actions.ChangeAddressAction scope=request forward name=success path=changeAddress/forward /action Normaly, your validation.xml would look like: form name=ChangeAddressForm blah blah. /form Using the path mapping you would have the following in your validation.xml: blah blah form name=/changeAddress blah blah. /form AND, don't forget inherit from ValidatorActionForm, as oppposed to ValidatorForm. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward)
-Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:34 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward) Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? global-forwards !-- Default forward to Welcome action -- !-- Demonstrates using index.jsp to forward -- forward name=Register path=/whatever/link/you/want/the/forward/to/be/replaced/with/ blah /global-forwards --- Caroline Jen [EMAIL PROTECTED] wrote: Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 2:25 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (Now, the Hyperlink Is Not Working) Now, I do not even get the hyperlink working. In my JSP 1, which is home.jsp, I have this hyperlink (something is wrong with it): html:link forward=/RegisterRegister/html:link html:link action=/RegisterRegister/html:link However, upon further reflction... If what you really want is a href=/Register.doRegister/a generated, then you could do it with an action forward too. Which is what you tried to do above, you just need a global forward call /Register, or rather Register. The difference between the two? Not much in terms of basic functionality. Lots in terms of re=use. I tend to like the start of my use cases as global action forwards, that way I can change how to get into them action wise. In my struts.config.xml file, I have this action mapping: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where the .frame.Enrollment is a piece tile. I got the following message in the browser: [ServletException in:/frame/content/home.jsp] Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named /Register' What is wrong with my code? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 1:03 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP What is the answer? Do you mean action forward=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where .frame.Enrollment is the tile that contains my JSP 2. action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=/path/to/jsp/ or action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=tilename/ The name, scope and input of course being optional. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 12:52 PM To: Struts Users Mailing List Subject: Re: Action Mapping From a JSP to Another JSP I think Jim meant to say ForwardAction. http://struts.apache.org/api/org/apache/struts/actions/Forward Action.html I did say that :) The fingers on the other hand.. :) On Tue, 7 Sep 2004 12:49:49 -0700, Jim Barrows [EMAIL PROTECTED] wrote: -Original Message-
RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward)
Thanks a lot for being around and helping us. -CJen --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:34 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward) Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? global-forwards !-- Default forward to Welcome action -- !-- Demonstrates using index.jsp to forward -- forward name=Register path=/whatever/link/you/want/the/forward/to/be/replaced/with/ blah /global-forwards --- Caroline Jen [EMAIL PROTECTED] wrote: Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 2:25 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (Now, the Hyperlink Is Not Working) Now, I do not even get the hyperlink working. In my JSP 1, which is home.jsp, I have this hyperlink (something is wrong with it): html:link forward=/RegisterRegister/html:link html:link action=/RegisterRegister/html:link However, upon further reflction... If what you really want is a href=/Register.doRegister/a generated, then you could do it with an action forward too. Which is what you tried to do above, you just need a global forward call /Register, or rather Register. The difference between the two? Not much in terms of basic functionality. Lots in terms of re=use. I tend to like the start of my use cases as global action forwards, that way I can change how to get into them action wise. In my struts.config.xml file, I have this action mapping: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where the .frame.Enrollment is a piece tile. I got the following message in the browser: [ServletException in:/frame/content/home.jsp] Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named /Register' What is wrong with my code? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 1:03 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP What is the answer? Do you mean action forward=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where .frame.Enrollment is the tile that contains my JSP 2. action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=/path/to/jsp/ or action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=tilename/ The name, scope and input of course being optional. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Hubert Rabago [mailto:[EMAIL PROTECTED] === message truncated === ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm with all application attributes
Thanks, i`ll take a look at that in the next days!! --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:25 AM To: Struts Users Mailing List Subject: RE: ActionForm with all application attributes --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 9:48 AM To: Struts Users Mailing List Subject: RE: ActionForm with all application attributes Jim, all the code i`m talking about is inside a Base Action Form. It seems the you`re thinking that my code is inside a action, aren`t you?? Maybe a misundertanding, maybe mine, maybe yours. No, I understood you to have it in a Base Action. So, i agree with some of your comments, but not on all of thems. In fact, i`m gonna to take a look about this customized classes to use with validator. Another trick, is to use the same AcitonForm class, but call it different things. Since validator will work by name, and not by class you can customize based on that alone. You can also validate a form by action mapping, rather then by form name. Would you mind showing an example on how to do that? http://struts.apache.org/api/org/apache/struts/validator/ValidatorActionForm.html As opposed to ValidatorForm. The following is from memory, but should be close. Assuming the following struts-config.xml blah blah form-bean name=ChangeAddressForm type=com.sssc.csr.web.forms.BorrowerDemographicsForm/form-bean blah blah action path=/changeAddress name=ChangeAddressForm validate=true type=com.sssc.csr.web.actions.ChangeAddressAction scope=request forward name=success path=changeAddress/forward /action Normaly, your validation.xml would look like: form name=ChangeAddressForm blah blah. /form Using the path mapping you would have the following in your validation.xml: blah blah form name=/changeAddress blah blah. /form AND, don't forget inherit from ValidatorActionForm, as oppposed to ValidatorForm. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward)
-Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:56 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward) Thanks a lot for being around and helping us. You're welcome.. and thank you for helping me, not only directly but by asking questions and making me dig through code and documentation to find the answers. I learn a lot by answering questions. -CJen --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:34 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (How to Do Global Forward) Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? global-forwards !-- Default forward to Welcome action -- !-- Demonstrates using index.jsp to forward -- forward name=Register path=/whatever/link/you/want/the/forward/to/be/replaced/with/ blah /global-forwards --- Caroline Jen [EMAIL PROTECTED] wrote: Thanks for your reply and help. if I have html:link action=/RegisterRegister/html:link In my struts.config.xml file, I should have action mapping like this: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ What if I do a global forward: html:link forward=/RegisterRegister/html:link what kind of mapping should I specify in the struts-config.xml file? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 2:25 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (Now, the Hyperlink Is Not Working) Now, I do not even get the hyperlink working. In my JSP 1, which is home.jsp, I have this hyperlink (something is wrong with it): html:link forward=/RegisterRegister/html:link html:link action=/RegisterRegister/html:link However, upon further reflction... If what you really want is a href=/Register.doRegister/a generated, then you could do it with an action forward too. Which is what you tried to do above, you just need a global forward call /Register, or rather Register. The difference between the two? Not much in terms of basic functionality. Lots in terms of re=use. I tend to like the start of my use cases as global action forwards, that way I can change how to get into them action wise. In my struts.config.xml file, I have this action mapping: action path=/Register parameter=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where the .frame.Enrollment is a piece tile. I got the following message in the browser: [ServletException in:/frame/content/home.jsp] Cannot create rewrite URL: java.net.MalformedURLException: Cannot retrieve ActionForward named /Register' What is wrong with my code? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 1:03 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP What is the answer? Do you mean action forward=.frame.Enrollment type=org.apache.struts.actions.ForwardAction/ where .frame.Enrollment is the tile that contains my JSP 2. action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp parameter=/path/to/jsp/ or action path=/saveSubscription type=org.apache.struts.actions.ForwardAction name=yourForm scope=request input=/subscription.jsp
RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!)
OKay, I see what you mean now. I am a kind of dumb. Before I clicked on the link, it shows: a href=/DHSInfo/do/ContentMgmtManage the Content/a in the browser. DHSInfo is the name of my application in the $TOMCAT/webapps directory. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:18 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) The html:link is not generating anything. None of my tiles or content is displayed. I only got error message HTTP Status 400. blah, blah. Therefore, View Source does not show anything but the html code of the error message. Even before you click on the link? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:09 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I do not fully understand. Do you want me to actually code a href instead of html:link action=/ContentMgmtManage the Content/html:link in my links.jsp file? No, I want to know what the html your html:link is generating. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I have tried both action=/ContentMgmt and action=/ContentMgmt.do They do not make any difference. Error message is the same. And it is HTTP Status 400. Nothing gets displayed in the browser but the error message. I tried right-click View Source. None of my code appears in the View Source. No, but the html:link will get translated to a href, that's what I was asking about. What gets generated? I'm thinking that something is wrong with the link. The error message, and the 400 error code would indicate that the browser is doing something wrong. Which leaves to possibilies 1) the link is a bit wonky 2) Your using IE and it's decided to no longer funciton correctly. Leaving my opinions of MS aside... it's probalby the link. If I could see it I might be able to figure out what's going on with it. I don't really thinkg it's a config error, because your conifg looks good. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 11:54 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) Hi, I am in trouble again. I am using tiles. I have three piece of tiles: upperbar, sidelinks, and lowerbar. All three tiles are displayed with contents shown in the center (toward right hand side) of the web page. Now, I click on one of the links provided in the 'sidelinks' tile and I got this error message in the browser: === Http Status 400 Invalid path /ContentMgmt was requested description The request sent by the client was syntactically incorrect (Invalid path /ContentMgmt was The path concerns me a little, if you copy and pasted it. It should be /ContentMgmt.do, however that would generate a 404, not a 400. requested). === The link that I clicked on in the 'sidelinks' tile is coded this way: html:link action=/ContentMgmtManage the Content/html:link Okay, what does the html look like? === message truncated === ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!)
-Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:28 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) OKay, I see what you mean now. I am a kind of dumb. No you're not... I confuse myself from time to time. Before I clicked on the link, it shows: a href=/DHSInfo/do/ContentMgmtManage the Content/a When the jsp page gets executed, it's mapping the action /do and not *.do. I'm wondering if any of your links are working. Try typing in the browser /DHSInfo/do/ContentMgmt and /DHSInfo/ContentMgmt.do and see which works. I'm wondering if something is tweaked wrong in web.xml. in the browser. DHSInfo is the name of my application in the $TOMCAT/webapps directory. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:18 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) The html:link is not generating anything. None of my tiles or content is displayed. I only got error message HTTP Status 400. blah, blah. Therefore, View Source does not show anything but the html code of the error message. Even before you click on the link? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:09 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I do not fully understand. Do you want me to actually code a href instead of html:link action=/ContentMgmtManage the Content/html:link in my links.jsp file? No, I want to know what the html your html:link is generating. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I have tried both action=/ContentMgmt and action=/ContentMgmt.do They do not make any difference. Error message is the same. And it is HTTP Status 400. Nothing gets displayed in the browser but the error message. I tried right-click View Source. None of my code appears in the View Source. No, but the html:link will get translated to a href, that's what I was asking about. What gets generated? I'm thinking that something is wrong with the link. The error message, and the 400 error code would indicate that the browser is doing something wrong. Which leaves to possibilies 1) the link is a bit wonky 2) Your using IE and it's decided to no longer funciton correctly. Leaving my opinions of MS aside... it's probalby the link. If I could see it I might be able to figure out what's going on with it. I don't really thinkg it's a config error, because your conifg looks good. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 11:54 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) Hi, I am in trouble again. I am using tiles. I have three piece of tiles: upperbar, sidelinks, and lowerbar. All three tiles are displayed with contents shown in the center (toward right hand side) of the web page. Now, I click on one of the links provided in the 'sidelinks' tile and I got this error message in the browser: === Http Status 400 Invalid path /ContentMgmt was requested description The request sent by the client was syntactically incorrect (Invalid path /ContentMgmt was The path concerns me a little, if you copy and pasted it. It should be /ContentMgmt.do, however that would generate a 404, not a 400. requested).
RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!)
Jim, Sorry for bothering so much. My code, mapping, path, ., etc. are correct. Problem is with the Tomcat server. CJen --- Caroline Jen [EMAIL PROTECTED] wrote: OKay, I see what you mean now. I am a kind of dumb. Before I clicked on the link, it shows: a href=/DHSInfo/do/ContentMgmtManage the Content/a in the browser. DHSInfo is the name of my application in the $TOMCAT/webapps directory. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:18 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) The html:link is not generating anything. None of my tiles or content is displayed. I only got error message HTTP Status 400. blah, blah. Therefore, View Source does not show anything but the html code of the error message. Even before you click on the link? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:09 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I do not fully understand. Do you want me to actually code a href instead of html:link action=/ContentMgmtManage the Content/html:link in my links.jsp file? No, I want to know what the html your html:link is generating. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I have tried both action=/ContentMgmt and action=/ContentMgmt.do They do not make any difference. Error message is the same. And it is HTTP Status 400. Nothing gets displayed in the browser but the error message. I tried right-click View Source. None of my code appears in the View Source. No, but the html:link will get translated to a href, that's what I was asking about. What gets generated? I'm thinking that something is wrong with the link. The error message, and the 400 error code would indicate that the browser is doing something wrong. Which leaves to possibilies 1) the link is a bit wonky 2) Your using IE and it's decided to no longer funciton correctly. Leaving my opinions of MS aside... it's probalby the link. If I could see it I might be able to figure out what's going on with it. I don't really thinkg it's a config error, because your conifg looks good. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 11:54 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) Hi, I am in trouble again. I am using tiles. I have three piece of tiles: upperbar, sidelinks, and lowerbar. All three tiles are displayed with contents shown in the center (toward right hand side) of the web page. Now, I click on one of the links provided in the 'sidelinks' tile and I got this error message in the browser: === Http Status 400 Invalid path /ContentMgmt was requested description The request sent by the client was syntactically incorrect (Invalid path /ContentMgmt === message truncated === ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is strut a good choice in my case.
Jim, If you know what I am saying then we're both in trouble. Primarily, I am just being weird. Comes from a combination too much overexposurer to the wild life when I was younger and too much exposure to the family life now that I am older -- in other words, stick a fork in me -- I'm done :) Brain spouts sludge Mouth obeys brain White coats come. Jim Barrows wrote: -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Bill Siggelkow Sent: Wednesday, September 08, 2004 1:28 PM To: [EMAIL PROTECTED] Subject: Re: is strut a good choice in my case. Well, make sure you use more than one Strut -- you will want to scale the number of Struts to the number of users. For each request, you will have one Strut. Does this make sense? ;) No, and I think I know what you're saying :) Vitalii wrote: I have a question about struts. I know Strut is good framework for designing a large website. It has a lot of classes that help to design well scaled websites. What about performance? Does it slow the processing of request. if speed is the main issue is it good idea to use strut?if website needs to handle about 200,000 request per hour would you advice to use strut? ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - 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: Action Mapping From a JSP to Another JSP (In Trouble Again!!!)
-Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:51 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) Jim, Sorry for bothering so much. My code, mapping, path, ., etc. are correct. Problem is with the Tomcat server. Okay... if that's where you traced it to. CJen --- Caroline Jen [EMAIL PROTECTED] wrote: OKay, I see what you mean now. I am a kind of dumb. Before I clicked on the link, it shows: a href=/DHSInfo/do/ContentMgmtManage the Content/a in the browser. DHSInfo is the name of my application in the $TOMCAT/webapps directory. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:18 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) The html:link is not generating anything. None of my tiles or content is displayed. I only got error message HTTP Status 400. blah, blah. Therefore, View Source does not show anything but the html code of the error message. Even before you click on the link? --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 1:09 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I do not fully understand. Do you want me to actually code a href instead of html:link action=/ContentMgmtManage the Content/html:link in my links.jsp file? No, I want to know what the html your html:link is generating. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 12:45 PM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) I have tried both action=/ContentMgmt and action=/ContentMgmt.do They do not make any difference. Error message is the same. And it is HTTP Status 400. Nothing gets displayed in the browser but the error message. I tried right-click View Source. None of my code appears in the View Source. No, but the html:link will get translated to a href, that's what I was asking about. What gets generated? I'm thinking that something is wrong with the link. The error message, and the 400 error code would indicate that the browser is doing something wrong. Which leaves to possibilies 1) the link is a bit wonky 2) Your using IE and it's decided to no longer funciton correctly. Leaving my opinions of MS aside... it's probalby the link. If I could see it I might be able to figure out what's going on with it. I don't really thinkg it's a config error, because your conifg looks good. --- Jim Barrows [EMAIL PROTECTED] wrote: -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 11:54 AM To: Struts Users Mailing List Subject: RE: Action Mapping From a JSP to Another JSP (In Trouble Again!!!) Hi, I am in trouble again. I am using tiles. I have three piece of tiles: upperbar, sidelinks, and lowerbar. All three tiles are displayed with contents shown in the center (toward right hand side) of the web page. Now, I click on one of the links provided in the 'sidelinks' tile and I got this error message in the browser: === Http Status 400 Invalid path /ContentMgmt was requested description The request sent by the client was syntactically incorrect (Invalid path /ContentMgmt === message truncated === ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now.
Re: Bean tag and session data issue
Hi Bill Indeed I do have scope set to session in struts-config.xml. When unit testing in debug through IDEA I can see the object in the session being populated step by step, however when I run the compiled web app under Struts with JWebUnit, or a browser, I get the problem. I am up against my limits of debugging knowledge here :-) I will look into more debugging and see where that takes me. Thanks once again for your input. Regards, Langdon From: Bill Siggelkow [EMAIL PROTECTED] Are you setting scope=session for the actions in your struts-config.xml? If so, I'd take it through a debugger. - Bill Siggelkow Langdon Stevenson wrote: Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bean tag and session data issue
Hi Bill Indeed I do have scope set to session in struts-config.xml. When unit testing in debug through IDEA I can see the object in the session being populated step by step, however when I run the compiled web app under Struts with JWebUnit, or a browser, I get the problem. I am up against my limits of debugging knowledge here :-) I will look into more debugging and see where that takes me. Thanks once again for your input. Regards, Langdon From: Bill Siggelkow [EMAIL PROTECTED] Are you setting scope=session for the actions in your struts-config.xml? If so, I'd take it through a debugger. - Bill Siggelkow Langdon Stevenson wrote: Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bean tag and session data issue
Hi Bill Indeed I do have scope set to session in struts-config.xml. When unit testing in debug through IDEA I can see the object in the session being populated step by step, however when I run the compiled web app under Struts with JWebUnit, or a browser, I get the problem. I am up against my limits of debugging knowledge here :-) I will look into more debugging and see where that takes me. Thanks once again for your input. Regards, Langdon From: Bill Siggelkow [EMAIL PROTECTED] Are you setting scope=session for the actions in your struts-config.xml? If so, I'd take it through a debugger. - Bill Siggelkow Langdon Stevenson wrote: Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bean tag and session data issue
Hi Bill Indeed I do have scope set to session in struts-config.xml. When unit testing in debug through IDEA I can see the object in the session being populated step by step, however when I run the compiled web app under Struts with JWebUnit, or a browser, I get the problem. I am up against my limits of debugging knowledge here :-) I will look into more debugging and see where that takes me. Thanks once again for your input. Regards, Langdon From: Bill Siggelkow [EMAIL PROTECTED] Are you setting scope=session for the actions in your struts-config.xml? If so, I'd take it through a debugger. - Bill Siggelkow Langdon Stevenson wrote: Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bean tag and session data issue
Hi Bill Indeed I do have scope set to session in struts-config.xml. When unit testing in debug through IDEA I can see the object in the session being populated step by step, however when I run the compiled web app under Struts with JWebUnit, or a browser, I get the problem. I am up against my limits of debugging knowledge here :-) I will look into more debugging and see where that takes me. Thanks once again for your input. Regards, Langdon From: Bill Siggelkow [EMAIL PROTECTED] Are you setting scope=session for the actions in your struts-config.xml? If so, I'd take it through a debugger. - Bill Siggelkow Langdon Stevenson wrote: Having overcome my validation problem with help from the list (thanks Bill) I now find myself banging my head against another wall. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Preventing Page Caching
Hi All, I am developing some pages with struts. When I was testing my pages, I realize that if I click the back and forward button, my browser (IE or Firefox) will load the cached page, instead of retrieving the latest data from the database. Is there anyway to prevent this caching, or is there a way to tell the browser to always load the a new page instead of the cache ? Regards, Irfandhy Franciscus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Preventing Page Caching
-Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Irfandhy Franciscus Sent: Tuesday, September 07, 2004 8:18 AM To: [EMAIL PROTECTED] Subject: Preventing Page Caching Hi All, I am developing some pages with struts. When I was testing my pages, I realize that if I click the back and forward button, my browser (IE or Firefox) will load the cached page, instead of retrieving the latest data from the database. Is there anyway to prevent this caching, or is there a way to tell the browser to always load the a new page instead of the cache ? Sarch the archives, all kinds of info. The manual has it too! Regards, Irfandhy Franciscus - 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: is strut a good choice in my case.
You are such a smart ace!!! Are you taking lessons from me? -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Bill Siggelkow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 4:28 PM Subject: Re: is strut a good choice in my case. Well, make sure you use more than one Strut -- you will want to scale the number of Struts to the number of users. For each request, you will have one Strut. Does this make sense? ;) Vitalii wrote: I have a question about struts. I know Strut is good framework for designing a large website. It has a lot of classes that help to design well scaled websites. What about performance? Does it slow the processing of request. if speed is the main issue is it good idea to use strut?if website needs to handle about 200,000 request per hour would you advice to use strut? ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - 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: is strut a good choice in my case.
You are the master -- BTW, how come Struts doesn't work with Flex? ;) James Mitchell wrote: You are such a smart ace!!! Are you taking lessons from me? -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Bill Siggelkow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 4:28 PM Subject: Re: is strut a good choice in my case. Well, make sure you use more than one Strut -- you will want to scale the number of Struts to the number of users. For each request, you will have one Strut. Does this make sense? ;) Vitalii wrote: I have a question about struts. I know Strut is good framework for designing a large website. It has a lot of classes that help to design well scaled websites. What about performance? Does it slow the processing of request. if speed is the main issue is it good idea to use strut?if website needs to handle about 200,000 request per hour would you advice to use strut? ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - 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: Easy Struts
My apologies -- I wasn't aware of the problem. -Bill Siggelkow Darryl Pierce wrote: On Tuesday 07 September 2004 09:39 am, Bill Siggelkow wrote: Darryl Pierce wrote: On Monday 06 September 2004 07:49 am, James Holmes wrote: As far as I know, Easy Struts does not work with Eclipse 3. Struts Console does though. It provides similar functionality (Easy Struts is based on Struts Console) and more. http://www.jamesholmes.com/struts/ But, be warned: if you're working on Linux then you have to upgrade to J2SDK 1.5; Struts Console won't work with J2SDK 1.4. This sucks for me since I work in Debian and can't easily upgrade my Linux boxes to 1.5 (nor do I want to now); why the author createdd this dependancy is beyond me... Struts Console works just fine with JDK 1.4. Re-read my message: I was talking about J2SDK 1.4 for *Linux*. Holmes acknowledges the problem and said that the only workaround is to upgrade to 1.5 for Linux. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... This will never happen, as the value comes in String. Am i saying something stupid??? I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? --- Bryce Fischer [EMAIL PROTECTED] escreveu: The custom converter is done independently of the action, form or DTO. First step is to implement the interface org.apache.commons.beanutils.Converter. Keep in mind that the converter you are writing uses the appropriate converter for the original class. So, if you were converting from a String to a Date, you would create a String converter. And vice versa, if you were converting from a Date to a String you would create a Date converter. Example below Then, to override the standard converters, you call: ConvertUtils.register(Your converter class, class to use converter on.class); First parameter is your new converter, and the second is the class its used for. I call this in a static initializer of a utility class, you just need to make sure its called before any validations occur, and it only needs to be done once. Since we are interested in customizing conversions from String to Date, I override the String converter: public class StringConverter implements Converter{ public Object convert(Class type, Object value) { Object returnObj = null; if (value != null) { if (value instanceof Date){ returnObj = dateFormatter.format((Date)value); } else if (value instanceof BigDecimal){ returnObj = decimalFormatter.format((BigDecimal)value); } else { returnObj = value.toString(); } } return returnObj; } } I've left out some properties, their getters and setters, but I think you get the gist of what I'm doing. Now, I register this converter as such: ConvertUtils.register(new StringConverter(), String.class); I actually have a utility class, where the register is done in the static initializer. I suppose another way would be to use a servlet that loads prior to Struts.. Or if your Actions have a base class, etc... Maybe there's a more elegant way of doing that. This is what I've come up with. If someone has a better way, post please, I'm always looking for more elegant ways of accomplishing stuff like this. Jason King wrote: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm data type X BeanUtils - using Dates
-Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 4:28 PM To: Struts Users Mailing List Subject: Re: ActionForm data type X BeanUtils - using Dates I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... Bi-directional conversion. Look at what he does if it is a date. This isn't just for ActionForm to DTO, it's for any other time you have to convert a string to a date using BeanUtils. This will never happen, as the value comes in String. Am i saying something stupid??? Not really... just not being generic enough for the solution. I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? Sorta :) --- Bryce Fischer [EMAIL PROTECTED] escreveu: The custom converter is done independently of the action, form or DTO. First step is to implement the interface org.apache.commons.beanutils.Converter. Keep in mind that the converter you are writing uses the appropriate converter for the original class. So, if you were converting from a String to a Date, you would create a String converter. And vice versa, if you were converting from a Date to a String you would create a Date converter. Example below Then, to override the standard converters, you call: ConvertUtils.register(Your converter class, class to use converter on.class); First parameter is your new converter, and the second is the class its used for. I call this in a static initializer of a utility class, you just need to make sure its called before any validations occur, and it only needs to be done once. Since we are interested in customizing conversions from String to Date, I override the String converter: public class StringConverter implements Converter{ public Object convert(Class type, Object value) { Object returnObj = null; if (value != null) { if (value instanceof Date){ returnObj = dateFormatter.format((Date)value); } else if (value instanceof BigDecimal){ returnObj = decimalFormatter.format((BigDecimal)value); } else { returnObj = value.toString(); } } return returnObj; } } I've left out some properties, their getters and setters, but I think you get the gist of what I'm doing. Now, I register this converter as such: ConvertUtils.register(new StringConverter(), String.class); I actually have a utility class, where the register is done in the static initializer. I suppose another way would be to use a servlet that loads prior to Struts.. Or if your Actions have a base class, etc... Maybe there's a more elegant way of doing that. This is what I've come up with. If someone has a better way, post please, I'm always looking for more elegant ways of accomplishing stuff like this. Jason King wrote: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - 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] is strut a good choice in my case.
What do you mean? It works just fine as long as you are running Windows 3.1.1 SP8002. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Bill Siggelkow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 7:13 PM Subject: Re: is strut a good choice in my case. You are the master -- BTW, how come Struts doesn't work with Flex? ;) James Mitchell wrote: You are such a smart ace!!! Are you taking lessons from me? -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Bill Siggelkow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 4:28 PM Subject: Re: is strut a good choice in my case. Well, make sure you use more than one Strut -- you will want to scale the number of Struts to the number of users. For each request, you will have one Strut. Does this make sense? ;) Vitalii wrote: I have a question about struts. I know Strut is good framework for designing a large website. It has a lot of classes that help to design well scaled websites. What about performance? Does it slow the processing of request. if speed is the main issue is it good idea to use strut?if website needs to handle about 200,000 request per hour would you advice to use strut? ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - 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: ActionForm data type X BeanUtils - using Dates
--- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 4:28 PM To: Struts Users Mailing List Subject: Re: ActionForm data type X BeanUtils - using Dates I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... Bi-directional conversion. Look at what he does if it is a date. This isn't just for ActionForm to DTO, it's for any other time you have to convert a string to a date using BeanUtils. Yes Jim, to convert a String to a Date, so if i use value instanceof Date i will allways fail!!! Because value is a String, you just said that. This will never happen, as the value comes in String. Am i saying something stupid??? Not really... just not being generic enough for the solution. I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? Sorta :) --- Bryce Fischer [EMAIL PROTECTED] escreveu: The custom converter is done independently of the action, form or DTO. First step is to implement the interface org.apache.commons.beanutils.Converter. Keep in mind that the converter you are writing uses the appropriate converter for the original class. So, if you were converting from a String to a Date, you would create a String converter. And vice versa, if you were converting from a Date to a String you would create a Date converter. Example below Then, to override the standard converters, you call: ConvertUtils.register(Your converter class, class to use converter on.class); First parameter is your new converter, and the second is the class its used for. I call this in a static initializer of a utility class, you just need to make sure its called before any validations occur, and it only needs to be done once. Since we are interested in customizing conversions from String to Date, I override the String converter: public class StringConverter implements Converter{ public Object convert(Class type, Object value) { Object returnObj = null; if (value != null) { if (value instanceof Date){ returnObj = dateFormatter.format((Date)value); } else if (value instanceof BigDecimal){ returnObj = decimalFormatter.format((BigDecimal)value); } else { returnObj = value.toString(); } } return returnObj; } } I've left out some properties, their getters and setters, but I think you get the gist of what I'm doing. Now, I register this converter as such: ConvertUtils.register(new StringConverter(), String.class); I actually have a utility class, where the register is done in the static initializer. I suppose another way would be to use a servlet that loads prior to Struts.. Or if your Actions have a base class, etc... Maybe there's a more elegant way of doing that. This is what I've come up with. If someone has a better way, post please, I'm always looking for more elegant ways of accomplishing stuff like this. Jason King wrote: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - 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] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Moving a data object into a map inside a form?
Hi I've got a custom javabean that I want to move all of its public properties directly into a map held in a form. I've tried BeanUtils.copyProperties(myMap, myObject); as well as PropertyUtils.copyProperties(myMap, myObject); neither seem to do what I want, however if I reverse it for moving data from the map to my object it works great. I swear at one point I had it working doing this but then it conked out.. (dont ask I dont know either :P). Anyway is there an easy quick way to move everything from my object into a map? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm data type X BeanUtils - using Dates
I was taking a look at bean utils source and could see myself how this is done. Then i understood that acutally you use the value instanceof SOMETHING However, the BeanUtilsBean class is quite complex and i didn't have the patience (and the brains) to try to understand it. Anyway, it seems to me that when the value goes to the convert method it already has a defined data type (that's way the instanceof). But can anyone tell me how exactly is the flux of data?? When does exactly my value assumes the destination type??? --- Leandro Melo [EMAIL PROTECTED] escreveu: --- Jim Barrows [EMAIL PROTECTED] escreveu: -Original Message- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 4:28 PM To: Struts Users Mailing List Subject: Re: ActionForm data type X BeanUtils - using Dates I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... Bi-directional conversion. Look at what he does if it is a date. This isn't just for ActionForm to DTO, it's for any other time you have to convert a string to a date using BeanUtils. Yes Jim, to convert a String to a Date, so if i use value instanceof Date i will allways fail!!! Because value is a String, you just said that. This will never happen, as the value comes in String. Am i saying something stupid??? Not really... just not being generic enough for the solution. I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? Sorta :) --- Bryce Fischer [EMAIL PROTECTED] escreveu: The custom converter is done independently of the action, form or DTO. First step is to implement the interface org.apache.commons.beanutils.Converter. Keep in mind that the converter you are writing uses the appropriate converter for the original class. So, if you were converting from a String to a Date, you would create a String converter. And vice versa, if you were converting from a Date to a String you would create a Date converter. Example below Then, to override the standard converters, you call: ConvertUtils.register(Your converter class, class to use converter on.class); First parameter is your new converter, and the second is the class its used for. I call this in a static initializer of a utility class, you just need to make sure its called before any validations occur, and it only needs to be done once. Since we are interested in customizing conversions from String to Date, I override the String converter: public class StringConverter implements Converter{ public Object convert(Class type, Object value) { Object returnObj = null; if (value != null) { if (value instanceof Date){ returnObj = dateFormatter.format((Date)value); } else if (value instanceof BigDecimal){ returnObj = decimalFormatter.format((BigDecimal)value); } else { returnObj = value.toString(); } } return returnObj; } } I've left out some properties, their getters and setters, but I think you get the gist of what I'm doing. Now, I register this converter as such: ConvertUtils.register(new StringConverter(), String.class); I actually have a utility class, where the register is done in the static initializer. I suppose another way would be to use a servlet that loads prior to Struts.. Or if your Actions have a base class, etc... Maybe there's a more elegant way of doing that. This is what I've come up with. If someone has a better way, post please, I'm always looking for more elegant ways of accomplishing stuff like this. Jason King wrote: Could you point us at some code that does this? Do you customize in the action, the form or the DTO? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
Re: ActionForm data type X BeanUtils - using Dates
Leandro Melo wrote: I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... This will never happen, as the value comes in String. Sorry, I had it backwards (thats what I get when I post in a hurry). The example I sent was converting a Date property to String. To convert other types to Date I have the following Converter: public class DateConverter implements Converter{ public Object convert(Class type, Object value) { if (value == null) { return null; } else if (type == Date.class) { return convertToDate(type, value); } else if (type == String.class) { return convertToString(type, value); } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } protected Object convertToDate(Class type, Object value) { if (value instanceof String) { try { return df.parse((String) value); } catch (Exception pe) { throw new ConversionException(Error converting String to Date); } } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } } To register: ConvertUtils.register(new DateConverter(), Date.class); Am i saying something stupid??? I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
I almost understand it in the other way, haha... Now things are clear!!! --- Bryce Fischer [EMAIL PROTECTED] escreveu: Leandro Melo wrote: I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... This will never happen, as the value comes in String. Sorry, I had it backwards (thats what I get when I post in a hurry). The example I sent was converting a Date property to String. To convert other types to Date I have the following Converter: public class DateConverter implements Converter{ public Object convert(Class type, Object value) { if (value == null) { return null; } else if (type == Date.class) { return convertToDate(type, value); } else if (type == String.class) { return convertToString(type, value); } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } protected Object convertToDate(Class type, Object value) { if (value instanceof String) { try { return df.parse((String) value); } catch (Exception pe) { throw new ConversionException(Error converting String to Date); } } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } } To register: ConvertUtils.register(new DateConverter(), Date.class); Am i saying something stupid??? I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
Then you are doing better than I did. It took me several iterations to figure it out. I ended up testing with two differnt forms, putting breakpoints in my Converters to figure out what was going on... Leandro Melo wrote: I almost understand it in the other way, haha... Now things are clear!!! --- Bryce Fischer [EMAIL PROTECTED] escreveu: Leandro Melo wrote: I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... This will never happen, as the value comes in String. Sorry, I had it backwards (thats what I get when I post in a hurry). The example I sent was converting a Date property to String. To convert other types to Date I have the following Converter: public class DateConverter implements Converter{ public Object convert(Class type, Object value) { if (value == null) { return null; } else if (type == Date.class) { return convertToDate(type, value); } else if (type == String.class) { return convertToString(type, value); } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } protected Object convertToDate(Class type, Object value) { if (value instanceof String) { try { return df.parse((String) value); } catch (Exception pe) { throw new ConversionException(Error converting String to Date); } } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } } To register: ConvertUtils.register(new DateConverter(), Date.class); Am i saying something stupid??? I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - 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: Bean tag and session data issue
My appology to the list. Outlook Express and a weak wireless connection confused me and I sent this message multiple times. Langdon Hi Bill Indeed I do have scope set to session in struts-config.xml. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validator exception
Hi All, I am getting the following exception from validator by doing a simple check on required field (using struts 1.2.3). I have no clue why this is happening and the stack trace didn't give me any useful info. Please help. Thanks. -Betty 18:28:50,864 ERROR [ValidatorForm] org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest) org.apache.commons.validator.ValidatorException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest) at org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorA ction.java:627) at org.apache.commons.validator.ValidatorAction.executeValidationMethod(Validat orAction.java:557) at org.apache.commons.validator.Field.validateForRule(Field.java:811) at org.apache.commons.validator.Field.validate(Field.java:890) at org.apache.commons.validator.Form.validate(Form.java:174) at org.apache.commons.validator.Validator.validate(Validator.java:367) at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm data type X BeanUtils - using Dates
That's because you don't know for how many hours i've been sitting in from of my computer and screamming at it, haha!!! --- Bryce Fischer [EMAIL PROTECTED] escreveu: Then you are doing better than I did. It took me several iterations to figure it out. I ended up testing with two differnt forms, putting breakpoints in my Converters to figure out what was going on... Leandro Melo wrote: I almost understand it in the other way, haha... Now things are clear!!! --- Bryce Fischer [EMAIL PROTECTED] escreveu: Leandro Melo wrote: I got one doubt in your code when used in a situation that i mentioned (transforming data from action form to dto). When date comes from action form, they usually come in Strings, but in your method you verify value instanceof Date... This will never happen, as the value comes in String. Sorry, I had it backwards (thats what I get when I post in a hurry). The example I sent was converting a Date property to String. To convert other types to Date I have the following Converter: public class DateConverter implements Converter{ public Object convert(Class type, Object value) { if (value == null) { return null; } else if (type == Date.class) { return convertToDate(type, value); } else if (type == String.class) { return convertToString(type, value); } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } protected Object convertToDate(Class type, Object value) { if (value instanceof String) { try { return df.parse((String) value); } catch (Exception pe) { throw new ConversionException(Error converting String to Date); } } throw new ConversionException(Could not convert + value.getClass().getName() + to + type.getName()); } } To register: ConvertUtils.register(new DateConverter(), Date.class); Am i saying something stupid??? I'm not saying your code is wrong, but not appropriate for the situation in question. Am i right? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - 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] ___ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! http://br.acesso.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator exception
My guess is that you haven't upgraded the validator-rules.xml - the method signature changed with ActionMessages replacing ActionErrors Niall - Original Message - From: Betty Koon [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, September 09, 2004 2:32 AM Subject: Validator exception Hi All, I am getting the following exception from validator by doing a simple check on required field (using struts 1.2.3). I have no clue why this is happening and the stack trace didn't give me any useful info. Please help. Thanks. -Betty 18:28:50,864 ERROR [ValidatorForm] org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest) org.apache.commons.validator.ValidatorException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest) at org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorA ction.java:627) at org.apache.commons.validator.ValidatorAction.executeValidationMethod(Validat orAction.java:557) at org.apache.commons.validator.Field.validateForRule(Field.java:811) at org.apache.commons.validator.Field.validate(Field.java:890) at org.apache.commons.validator.Form.validate(Form.java:174) at org.apache.commons.validator.Validator.validate(Validator.java:367) at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:152) - 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] Setting up a struts project in IDEA
David Durham wrote: Now you're forced into choosing from their modules. You can basically almost always just choose the java module and then do as you say add what you need.. very easy. So you aren't really 'forced' into anything and can always do things like you were used to. The advantage of some of the other modules is that it does some adding for you... for example, if you choose web module it'll look in WEB-INF/lib and add those jars automatically. Stuff like that. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Gracefully handling invalid paths
Hi all, I am wondering how I should handle invalid path situations within my Struts application. I want to be able to have a catch-all page whenever someone enters an invalid path so that they don't see that ugly Tomcat 404 page. How might I go about doing something like that? Thanks very much. Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Gracefully handling invalid paths
You can specify it in your web.xml: error-page error-code404/error-code location/error_404.jsp/location /error-page -Yves- On Wed, 8 Sep 2004 20:36:38 -0700 (PDT), Andy Engle [EMAIL PROTECTED] wrote: Hi all, I am wondering how I should handle invalid path situations within my Struts application. I want to be able to have a catch-all page whenever someone enters an invalid path so that they don't see that ugly Tomcat 404 page. How might I go about doing something like that? Thanks very much. Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- For me to poop on! http://www.formetopoopon.com http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
found difficult in displaying hashtable in view
herewith i enclosed the file which contains the actionclass,form bean,view part in this enclosed file the attachment and url are KEY and VALUE pairs in hashtable ie) which i got from DB. and i've to display these value in textfiled[url] based on the key selected in the html:options. i need help to identify. This is my Form bean package com.calsoft.ecm; import java.util.Collection; import java.util.Hashtable; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class AttachForm extends ActionForm{ private Hashtable values = new Hashtable(); private Collection webLink = null; private String linkVal = null; private String url = null; private String attachment = null; public void setValue(String attachment,Object url) { values.put(attachment,url); } public Object getValue(String attachment) { return values.get(attachment); } public void reset(ActionMapping mapping,HttpServletRequest request) { values = new Hashtable(); } /** * @return Returns the linkVal. */ public String getLinkVal() { return linkVal; } /** * @param linkVal The linkVal to set. */ public void setLinkVal(String linkVal) { this.linkVal = linkVal; } /** * @return Returns the url. */ public String getUrl() { return url; } /** * @param url The url to set. */ public void setUrl(String url) { this.url = url; } /** * @return Returns the attachment. */ public String getAttachment() { return attachment; } /** * @param attachment The attachment to set. */ public void setAttachment(String attachment) { this.attachment = attachment; } /** * @return Returns the webLink. */ public Collection getWebLink() { return webLink; } /** * @param webLink The webLink to set. */ public void setWebLink(Collection webLink) { this.webLink = webLink; } } ** My Action Class package com.calsoft.ecm; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.Hashtable; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class AttachAction extends Action { Hashtable hswebLink = new Hashtable(); Enumeration enu; Collection collect = null; ArrayList arrayCollect = new ArrayList(); String weblink = new String(); String attachment = null; Object webUrl = null; String userLink = null; String userUrl = null; public ActionForward execute (ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException { try { hswebLink = new Hashtable(); AttachForm attachForm = (AttachForm) form; userLink = attachForm.getAttachment(); WeblinkConfigDAO web = new WeblinkConfigDAO(); hswebLink = web.getWebLinks(); enu = hswebLink.keys(); // hswebLink.values(); while(enu.hasMoreElements()) { weblink =(String) enu.nextElement(); arrayCollect.add(weblink); // here the pbms collect = arrayCollect; webUrl = hswebLink.get(weblink); // webUrl = hswebLink.get(weblink).toString(); System.out.println([weblink]+weblink); it works fine System.out.println([webUrl]+webUrl); it works fine } attachForm.setWebLink(collect); // here the pbms attachForm.setValue(weblink,webUrl); String userUrl = (String) attachForm.getValue(userLink); attachForm.setUrl(userUrl); } catch (Exception e) { e.printStackTrace(); } return (mapping.findForward(attachment)); } } ** my jsp TR TD width=144 class=td_oddrows div align=leftAttachment Name/div/TD TD width=159 class=td_oddrows html:select property=attachment name=attachForm html:options property=webLink/ /html:select /TD /TR TR TD class=td_evenrows div align=leftURL /div/TD TD class=td_evenrows html:text property=url //TD /TR *** in this enclosed file the attachment and url are KEY and VALUE pairs in hashtable ie) which i got from DB. and i've to display these value in textfiled[url] based on the key selected in the html:options.