RE: ??? property naming convention problem
-Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese - 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: ??? property naming convention problem
This may be of interest: http://wiki.apache.org/struts/JavaBeans Quoting Andrew Hill [EMAIL PROTECTED]: Yes, it is rather confusing. I wasted *many* hours with this issue the first time it hit me! Another poster also stated that putting the property name as ECoupon in the JSP would work - and thats because with a getter getECoupon() that IS the real property name (like your saying in the last line of your email). Iirc the bean property capitalisation rules - which also cover multiple capital letters in a row - mean there is no equivalant getter for the property eCoupon, instead its ECoupon that maps to the getter getECoupon. So the fact here is that your _not_ naming your property eCoupon - your naming it ECoupon! :-) (The internal varioable name might be eCoupon, but it could equally well be foo or bob, or anything - it doesnt matter for the determination of the property name and as far as code that works with JavaBeans is concerned that property is called ECoupon and not eCoupon. Daniel Perry wrote: This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
jsp mime type
Hey all - I am working with the commons file uploader in struts to upload a JSP file to my website. Being a security conscious developer, I am limiting the available upload file types to text/plain and text/html hoping that the JSP file would be sent as one of these types. Instead, it is sent as application/octet-stream - which is the same type used for executables and binary type files - seems kind of weird to me. Does anybody know if there is a way to force jsp files to be of a text/plain (or some other text type) instead of application/octet-stream? I tried adding the following to my web.xml file: mime-mapping extensionjsp/extension mime-typetext/plain/mime-type /mime-mapping But it didn't seem to make a difference. Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error in CactusStrutsTestCase
Here is what I want to do. I want to loop through various scenarios. 1. add the parameters to each given scenario 2. execute the scenario 3. assert the outcome 4. start again from scratch. Now when I put the setUp() and tearDown() around the whole method, I get an ActionError thrown the very first iteration that I KNOW 100% is not true as when I remove them, I get 14 iterations done without error. So what to do without creating a new test method for each scenario as there are too many scenarios. Mick Knutson Wells Fargo Business Direct (415) 222-1020 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -Original Message- From: Jim Barrows [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 3:48 PM To: Struts Users Mailing List Subject: RE: Error in CactusStrutsTestCase -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 4:44 PM To: [EMAIL PROTECTED] Subject: RE: Error in CactusStrutsTestCase This one is a real pain because there is no real failure in my logs. Just the error I posted which came from my testcase page only. The closest thing I can figure, is this is where the error is happening: == === if( Constants.TRUE.equals( request.getParameter(Constants.BUS_CARD_SELECTED) ) ) { navigationBean.setHasBusinessCard(true); } else { request.getSession().removeAttribute(Constants.BUSINESSCARD_FORM); This is the only place you're writing anything, and it's not to the request. So, I don't think it's here, I think it's when you actually write to the request. THat's what the error message says. navigationBean.setHasBusinessCard(false); } Note that there are 17 iterations, and there are only 4 that have an if() for them. 1 for each of our 4 products. This is the second product in the list. So one of the products (businessLine), was already executed in this test before the businessCard which is where it fails. Move this one last, and see if the other three work. Mick Knutson Wells Fargo Business Direct (415) 222-1020 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -Original Message- From: Jim Barrows [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 3:33 PM To: Struts Users Mailing List Subject: RE: Error in CactusStrutsTestCase -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 4:20 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Error in CactusStrutsTestCase I have the following method that keeps failing and I don't know why. The method should really only set a NavigationBean into session, then forward to a page based on the action parameter. public void testProductSelection() throws Exception { // JUnitDoclet begin method productSelection NavigationBean navigationBean = null; u... where is the code in the action that is failing? snip/ The exception indicates that you are trying to write to a response that's been committed, but your test harness doesn't help much in figuring out why. Your test harnes is working, since it works 13 times before failing. I get this error on the 14th iteration: = java.lang.IllegalStateException: response already committed at weblogic.servlet.internal.ServletResponseImpl.sendRedirect(Ser vletResponseImpl.java:584) at servletunit.struts.StrutsResponseWrapper.sendRedirect(StrutsRe sponseWrapper.java:154) at org.apache.struts.action.RequestProcessor.processForwardConfig (RequestProcessor.java:385) at org.apache.struts.tiles.TilesRequestProcessor.processForwardCo nfig(TilesRequestProcessor.java:316) at org.apache.struts.action.RequestProcessor.process(RequestProce ssor.java:231) at
Re: Generating valid HTML from html:form tag
At 2:31 PM + 12/14/04, Niall Pemberton wrote: Joe, maybe you were thinking of this one: http://issues.apache.org/bugzilla/show_bug.cgi?id=15023 No, but that's just because I didn't remember it ;-) That one generated a lot of discussion, so apparently people think it's important. I have to admit that I gave up worrying about strict HTML validation a long time ago. Still, the one Niall points to documents most of the issues, so anyone who wants to jump in and figure out the implementation details and provide a patch is encouraged to do so! Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error in CactusStrutsTestCase
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:40 AM To: [EMAIL PROTECTED] Subject: RE: Error in CactusStrutsTestCase Importance: High Here is what I want to do. I want to loop through various scenarios. 1. add the parameters to each given scenario 2. execute the scenario 3. assert the outcome 4. start again from scratch. Now when I put the setUp() and tearDown() around the whole method, I get an ActionError thrown the very first iteration that I KNOW 100% is not true as when I remove them, I get 14 iterations done without error. So what to do without creating a new test method for each scenario as there are too many scenarios. Hm Okay... assuming that the failing test actually works when you do it by hand, these are the possibilities I can think of: 1) You're screaming through the list to fast. This makes no sense, except that I'm not familiar enough with Cactus to know how it works. If it's doing something funky with the requests then this could be a problem. Try putting a Thread.sleep(1000) or longer see if that helps. 2) Cactus is doing something odd with your requests in the setup you have. Basically what's happening is either the Action or the JSP is trying to write something to the reponse stream after it's been closed, and apparently from what you're saying only under Cactus. Since Cactus inserts itself into the request/response process, I'm thinking that maybe it's actually Cactus that's doing something weird in you setup. Might be worthwhile to check the cactus list and see what they say. Mick Knutson Wells Fargo Business Direct (415) 222-1020 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -Original Message- From: Jim Barrows [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 3:48 PM To: Struts Users Mailing List Subject: RE: Error in CactusStrutsTestCase -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 4:44 PM To: [EMAIL PROTECTED] Subject: RE: Error in CactusStrutsTestCase This one is a real pain because there is no real failure in my logs. Just the error I posted which came from my testcase page only. The closest thing I can figure, is this is where the error is happening: == === if( Constants.TRUE.equals( request.getParameter(Constants.BUS_CARD_SELECTED) ) ) { navigationBean.setHasBusinessCard(true); } else { request.getSession().removeAttribute(Constants.BUSINESSCARD_FORM); This is the only place you're writing anything, and it's not to the request. So, I don't think it's here, I think it's when you actually write to the request. THat's what the error message says. navigationBean.setHasBusinessCard(false); } Note that there are 17 iterations, and there are only 4 that have an if() for them. 1 for each of our 4 products. This is the second product in the list. So one of the products (businessLine), was already executed in this test before the businessCard which is where it fails. Move this one last, and see if the other three work. Mick Knutson Wells Fargo Business Direct (415) 222-1020 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -Original Message- From: Jim Barrows [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 3:33 PM To: Struts Users Mailing List Subject: RE: Error in CactusStrutsTestCase -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 4:20 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Error in CactusStrutsTestCase I have the following method that keeps failing and I don't know why. The method should really only set a NavigationBean into session, then forward to a page based on the action
Re: Generating valid HTML from html:form tag
The Struts doc does suggest that html:xhtml / should cause the form tag to be XHTML compliant but for some reason it does not. The W3C XHTML validator also does not like the Struts output of the input elements. Struts does not close them: input ... /. --Marty --- Derek Broughton [EMAIL PROTECTED] wrote: On Tuesday 14 December 2004 08:51, William Ferguson wrote: I noticed that the html generated form the html:form tag is not valid HTML according to the W3C validation service (http://validator.w3.org). It generates a form tag with a 'name' attribute which has been deprecated. Since I'm striving to conform to relevant standards as best as possible, I was wondering whether anyone else had faced the same issue and what approach had been taken. If I don't use the html:form tag then I can't use other tags like html:select etc, which means a fair bit of messing about for drop-downs. Does anyone else bother with HTML validation? And if so, how do you handle Forms and Form elements? Don't you need to use html:xhtm/l or html:html xhtml=true to get full standards compliance? From the Struts Developer guide: The output is HTML 4.01 compliant or XHTML 1.0 when in XHTML mode. -- derek - 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: ??? property naming convention problem
-Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.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: ??? property naming convention problem
Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ??? property naming convention problem
A property need not always imply a private member variable in a bean. for example: MyBean.java private map values = new HashMap(); public String getFirstName() { return (String)values.get(firstname); } public void setFirstName(String firstNameIn) { values.put(firstName,firstNameIn); } Here firstName is a property of MyBean that can be used in a jsp : html:text property=firstName / -Original Message- From: Jim Barrows [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 1:28 PM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.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] ** This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy,
Re: Generating valid HTML from html:form tag
On Tuesday 14 December 2004 13:13, Martin Wegner wrote: The Struts doc does suggest that html:xhtml / should cause the form tag to be XHTML compliant but for some reason it does not. The W3C XHTML validator also does not like the Struts output of the input elements. Struts does not close them: input ... /. Well, then, I'd have to agree it's a bug :-) I've never actually _tested_ the output - silly me, I thought if they said it was standards compliant, it would be :-) -- derek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: test
If you want a gmail account, I've got one for you. I know that one works just fine for these lists. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Frank W. Zammetti [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 8:58 AM Subject: Re: test No. The problem is that my webmail client, which is all I can use at work to access mailing lists, has a bug which causes messages to not get through to the lists. My web host has been working on it for some time and so the only way to see if they've fixed it or not is to send a message. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Guillaume Cottenceau wrote: Frank W. Zammetti (MLists) fzlists 'at' omnytex.com writes: Please ignore me. Just seeing if my web host fixed the webmail problem I've been having. Thanks! No offense, but is it not possible to test that from one email of yours to another one? - 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]
submitting multiple option items to struts action
-I have an html:select element which has several option items. -This is kind of unusual situation where I have to select multiple option items instead of only one and submit that array of option items to the struts action. -The select element contains a lot of option items so using check boxes and multiboxes for this purpose does not seem like a good idea. -Is there any other way to do this? -- Thanx, Sudip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ??? property naming convention problem
Is that supposed to be some sort of bluff? What do variable names have to do with bean properties? By default, property names are derived from *method* names. For example, the property exposed by TimeZone.getID() is ID, but the property exposed by SSLSession.getId() is id. Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Generating valid HTML from html:form tag
Martin Wegner wrote: The Struts doc does suggest that html:xhtml / should cause the form tag to be XHTML compliant but for some reason it does not. The W3C XHTML validator also does not like the Struts output of the input elements. Struts does not close them: input ... /. This might help as a reference: http://struts.apache.org/faqs/kickstart.html#xhtml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Localize a dropdown select list
Is this possible with struts ? i don't find a mention of it but can't imagine it hasn't been implemented. For example in the jsp html-el:select property=swimmingPool html-el:optionsCollection property=swimmingPoolOptions value=name label=name/ /html-el:select Which generates the following ... select name=swimmingPooloption value=type.yestype.yes/option option value=type.notype.no/option option value=type.option_to_buildtype.option_to_build/option option value=type.undefinedtype.undefined/option/select Is it possible to map type.no to a value in the resource bundles ?? --b -- http://www.revoltingdigits.com https://jestate.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Generating valid HTML from html:form tag
Niall, I would agree with you until a customer makes XHTML conformance a requirement in the contract. Strict XHTML conformance is very important to some customers, for various reasons. As previously posted, getting rid of the name attribute on the form tag could be troublesome. But closing the input tags shouldn't be that hard in XHTML mode. Hopefully someone can be kind and make the changes. --Marty --- Joe Germuska [EMAIL PROTECTED] wrote: At 2:31 PM + 12/14/04, Niall Pemberton wrote: Joe, maybe you were thinking of this one: http://issues.apache.org/bugzilla/show_bug.cgi?id=15023 No, but that's just because I didn't remember it ;-) That one generated a lot of discussion, so apparently people think it's important. I have to admit that I gave up worrying about strict HTML validation a long time ago. Still, the one Niall points to documents most of the issues, so anyone who wants to jump in and figure out the implementation details and provide a patch is encouraged to do so! Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - 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: ??? property naming convention problem
-Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 12:51 PM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Is that supposed to be some sort of bluff? What do variable names have to do with bean properties? By default, property names are derived from *method* names. For example, the property exposed by TimeZone.getID() is ID, but the property exposed by SSLSession.getId() is id. No. The original question dealt with variable names, which is what I was responding to, not a general discussion of Beans that this thread has turned into. Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For
Tips on testing pages with multiple potential paths?
We have an application where each page has about 8 different paths depending upon the DTO in session, and the values passed in the request. I have only started on the 1st page right now, and feel overwhelmed with the limitless possibilities I have to test for. I am hoping someone can give me some tips to be able make my test writing easier, and potentially re-usable. The generic examples just don't address trying to do complex multi-path scenarios. I am using CactusStrutsTestCase currently. Mick Knutson Wells Fargo Business Direct Information Systems (415) 222-1020 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Preventing concurrent execution of an Action
Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Preventing concurrent execution of an Action
You might be able to get away with simply adding 'synchronized' to the execute method's signature. synchronized public ActionForward execute(...) { updateXml(); } private void updateXml() { ... } The lock/key threading techniques have to do with, I think, a more complex threading issue than the one you've presented. - Dave -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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: ??? property naming convention problem
Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Preventing concurrent execution of an Action
Replace synchronized(UpdateXmlAction.class) with synchronized(this) and you have the same behaviour, as if you would make the whole method synchronized. You don't need your locked flag, it's provided by java object monitors automatically. BUT, synchronizing doExecute in an action is a _very_ bad idea, since the actions are in fact designed to have multiple threads running with it (it would work in most cases, but it's fine). Better in your case: just make updateXml() synchronized. Ah, and also: if you have basic variables you check in different threads, make them volatile (and don't make them static, since you have exactly one instance of an action, it could be an instance variable in this case). Last question: if two users click the link simultaneously, what should happen? In your code, the second user overwrites the changes of the first user (silently). Regards Leon -Ursprüngliche Nachricht- Von: Durham David R Jr Contr 805 CSPTS/SCE [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 14. Dezember 2004 23:46 An: Struts Users Mailing List Betreff: RE: Preventing concurrent execution of an Action You might be able to get away with simply adding 'synchronized' to the execute method's signature. synchronized public ActionForward execute(...) { updateXml(); } private void updateXml() { ... } The lock/key threading techniques have to do with, I think, a more complex threading issue than the one you've presented. - Dave -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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]
AW: Preventing concurrent execution of an Action
Replace synchronized(UpdateXmlAction.class) with synchronized(this) and you have the same behaviour, as if you would make the whole method synchronized. You don't need your locked flag, it's provided by java object monitors automatically. BUT, synchronizing doExecute in an action is a _very_ bad idea, since the actions are in fact designed to have multiple threads running with it (it would work in most cases, but it's fine). Better in your case: just make updateXml() synchronized. Ah, and also: if you have basic variables you check in different threads, make them volatile (and don't make them static, since you have exactly one instance of an action, it could be an instance variable in this case). Last question: if two users click the link simultaneously, what should happen? In your code, the second user overwrites the changes of the first user (silently). Regards Leon -Ursprüngliche Nachricht- Von: Durham David R Jr Contr 805 CSPTS/SCE [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 14. Dezember 2004 23:46 An: Struts Users Mailing List Betreff: RE: Preventing concurrent execution of an Action You might be able to get away with simply adding 'synchronized' to the execute method's signature. synchronized public ActionForward execute(...) { updateXml(); } private void updateXml() { ... } The lock/key threading techniques have to do with, I think, a more complex threading issue than the one you've presented. - Dave -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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]
Documentation for validator regular expression
Hello, Can anyone point me to documentation I can refer to for struts validator regular expressions. Regards, Muhammad Momin Rashid - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Preventing concurrent execution of an Action
Small correction, In your example there is a difference whether you have a multiprocessor machine. On a single-proc machine it will work fine (prevent second user from overwriting), on a multi-processor machine it's undefined. Regards Leon -Ursprüngliche Nachricht- Von: Durham David R Jr Contr 805 CSPTS/SCE [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 14. Dezember 2004 23:46 An: Struts Users Mailing List Betreff: RE: Preventing concurrent execution of an Action You might be able to get away with simply adding 'synchronized' to the execute method's signature. synchronized public ActionForward execute(...) { updateXml(); } private void updateXml() { ... } The lock/key threading techniques have to do with, I think, a more complex threading issue than the one you've presented. - Dave -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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: Preventing concurrent execution of an Action (example)
Ok, just in case it was more confusing then helping. Here is the (imho) safe solution (haven't tested it, but it should work fine): The isLock method is needed to ensure, that all threads have the same lock value. Volatile should guarantee it, but it's not supported on all vms. You should call the unlock method after you know, that the processing of the file is finished. Another problem, you could have, is to ensure, that the page where the link is placed is still valid. You can ensure it, by giving your call to the action a timestamp parameter and check whether it's still the proper timestamp for the file. Here the code (without timestamp): public class youraction ...{ private volatile boolean lock; private void lock() throws AlreadyLockedException{ if (lock) throw new AlreadyLockedException(); lock = true; } private void unlock(){ lock = false; } private synchronized boolean isLocked(){ return lock; } private synchronized void updateXML() throws AlreadyLockedException{ //double check needed, in case another thread was already //between first isLocked and updateXML call. if (isLocked()) throw new AlreadyLockedException(); lock(); // generate the xml file. unlock(); } public ActionForward execute( ActionMapping mapping, ActionForm af, HttpServletRequest req, HttpServletResponse res) throws Exception { //... if (isLocked()) return mapping.findForward(noupdate); try{ updateXML(); return mapping.findForward(updatecomplete); }catch(AlreadyLockedException e){ return mapping.findForward(noupdate); } } } -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Documentation for validator regular expression
-Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Muhammad Momin Rashid Sent: Tuesday, December 14, 2004 4:10 PM To: [EMAIL PROTECTED] Subject: Documentation for validator regular expression Hello, Can anyone point me to documentation I can refer to for struts validator regular expressions. Any search for regular expression on google will provide you with a plethora of good resources. Regards, Muhammad Momin Rashid - 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: AW: Preventing concurrent execution of an Action
Hi Thanks for the responses. You don't need your locked flag, it's provided by java object monitors automatically. I actually used the lock so if the updateXML is being executed the next request won't even try and wait to aquire the lock for it and simply return. Last question: if two users click the link simultaneously, what should happen? In your code, the second user overwrites the changes of the first user (silently). I guess what I have done ignores the second click as the control returns from the doExecute method before reaching the updateXml method. Regards, Behrang S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionMessages and Struts-EL Tags
This isn't a Struts-EL issue. The html:messages tag can be used to iterate over either messages or errors, but not both. It defaults to errors. You can change it to iterate over messages by setting the message atttribute to true. -Original Message- From: Hariharan V [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 12:50 AM To: Struts Users Mailing List Subject: ActionMessages and Struts-EL Tags In my application I want to differentiate b/w error and normal messages Here is the code in my Controller ActionMessages messages = new ActionMessages(); ActionMessages errors = new ActionMessages(); messages.add(sample.message, new ActionMessage(sample.message)); messages.add(sample.message2, new ActionMessage(sample.message2)); errors.add(sample.error, new ActionMessage(sample.error)); errors.add(sample.error2, new ActionMessage(sample.error2)); super.addMessages(req, messages); super.addErrors(req, errors); in my jsp I have added following piece of code html-el:errors/ html-el:messages id=message c:out value=${message}/ /html-el:messages But the problem is that I see only error messages in the output , I don't get hold of my normal messages using html-el:messages tag. Sample Error Sample Error2 Sample Error Sample Error2 Resource Bundle entries sample.error=Sample Error sample.error2=Sample Error2 sample.message=Sample Message sample.message2=Sample Message2 Is anything wrong with the way Iam storing errors and normal messages -- -Hari - 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: Preventing concurrent execution of an Action (example)
Thanks. This helped me alot. Regards, Behrang S. On Wed, 15 Dec 2004 00:18:46 +0100, Leon Rosenberg [EMAIL PROTECTED] wrote: Ok, just in case it was more confusing then helping. Here is the (imho) safe solution (haven't tested it, but it should work fine): The isLock method is needed to ensure, that all threads have the same lock value. Volatile should guarantee it, but it's not supported on all vms. You should call the unlock method after you know, that the processing of the file is finished. Another problem, you could have, is to ensure, that the page where the link is placed is still valid. You can ensure it, by giving your call to the action a timestamp parameter and check whether it's still the proper timestamp for the file. Here the code (without timestamp): public class youraction ...{ private volatile boolean lock; private void lock() throws AlreadyLockedException{ if (lock) throw new AlreadyLockedException(); lock = true; } private void unlock(){ lock = false; } private synchronized boolean isLocked(){ return lock; } private synchronized void updateXML() throws AlreadyLockedException{ //double check needed, in case another thread was already //between first isLocked and updateXML call. if (isLocked()) throw new AlreadyLockedException(); lock(); // generate the xml file. unlock(); } public ActionForward execute( ActionMapping mapping, ActionForm af, HttpServletRequest req, HttpServletResponse res) throws Exception { //... if (isLocked()) return mapping.findForward(noupdate); try{ updateXML(); return mapping.findForward(updatecomplete); }catch(AlreadyLockedException e){ return mapping.findForward(noupdate); } } } -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preventing concurrent execution of an Action
Hi No.. you need to syncrhonize on the lock. Check the java tutorials on multi-threaded architecture for details. I guess I know enough about multi threading ;) but what I don't know enough is Struts' internals. A better solution might be to use one of the solutions discussed on the list on implementing a progress bar, or please wait page when the user clicks the link. http://www.mail-archive.com/cgi-bin/htsearch?config=user_struts_apache_orgrestrict=exclude=words=progress+b Lots of thanks for this. It would certainly help me alot. Regards, Behrang S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Localize a dropdown select list
It has come up before: http://issues.apache.org/bugzilla/show_bug.cgi?id=9748 http://issues.apache.org/bugzilla/show_bug.cgi?id=17600 but it hasn't been implemented in Struts Niall - Original Message - From: bryan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 8:10 PM Subject: Localize a dropdown select list Is this possible with struts ? i don't find a mention of it but can't imagine it hasn't been implemented. For example in the jsp html-el:select property=swimmingPool html-el:optionsCollection property=swimmingPoolOptions value=name label=name/ /html-el:select Which generates the following ... select name=swimmingPooloption value=type.yestype.yes/option option value=type.notype.no/option option value=type.option_to_buildtype.option_to_build/option option value=type.undefinedtype.undefined/option/select Is it possible to map type.no to a value in the resource bundles ?? --b -- http://www.revoltingdigits.com https://jestate.dev.java.net - 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: ??? property naming convention problem
Jim, you're kidding, right? The original post had nothing to do with variable names and specifically related to bean property names. The key question from the original post is: Is there a property naming convention to be followed in STRUTS The answer is, yes. In general, property names follow the JavaBeans Spec. However, by leveraging Commons BeanUtils: http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api/org/apache/commons/beanutils/package-summary.html Struts is able to provide some additional functionality, like mapped properties. Jim Barrows wrote: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 12:51 PM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Is that supposed to be some sort of bluff? What do variable names have to do with bean properties? By default, property names are derived from *method* names. For example, the property exposed by TimeZone.getID() is ID, but the property exposed by SSLSession.getId() is id. No. The original question dealt with variable names, which is what I was responding to, not a general discussion of Beans that this thread has turned into. Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:45 AM To: Struts Users Mailing List Subject: RE: ??? property naming convention problem Quoting Jim Barrows [EMAIL PROTECTED]: -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 7:52 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: ??? property naming convention problem This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. WHat's confusing? Bean property names must begin with lowercase first letter. Getters and Setters capitalize this. I've never had this issue. properties are always eCoupon and setECoupon and getEcoupon. Actually, no. It's perfectly legal for a property name to begin with an upper case letter. Again, see: http://wiki.apache.org/struts/JavaBeans I see your specification and raise you the coding style: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 Variables Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary throwaway variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. int i; charc; float myWidth; Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: test
Any word on when they might open that to GA? I'm curious to get a peek at it ... Eddie - Original Message - From: James Mitchell [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 1:30 PM Subject: Re: test If you want a gmail account, I've got one for you. I know that one works just fine for these lists. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Frank W. Zammetti [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 8:58 AM Subject: Re: test No. The problem is that my webmail client, which is all I can use at work to access mailing lists, has a bug which causes messages to not get through to the lists. My web host has been working on it for some time and so the only way to see if they've fixed it or not is to send a message. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Guillaume Cottenceau wrote: Frank W. Zammetti (MLists) fzlists 'at' omnytex.com writes: Please ignore me. Just seeing if my web host fixed the webmail problem I've been having. Thanks! No offense, but is it not possible to test that from one email of yours to another one? - 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] --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0451-1, 12/14/2004 Tested on: 12/14/2004 10:23:54 PM avast! - copyright (c) 2000-2004 ALWIL Software. http://www.avast.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Localize a dropdown select list
Bryan, Here's some thoughts: - Leverage the Java language's inherent ability to internationalize things. - Leverage commons-resources to internationalize things. - Use a database to internationalize things. They aren't necessarily mutually-exclusive options, although there's little reason to use the first if you're using the second. The third can be a very powerful option, if you build your database in such a way that it allows you to store your text in different languages. Put a dozen programmers in a room and you'll come up with 20 different ways to do that - all of them better than the other, depending upon the requirements at hand. I'll leave determining a method as an exercise to you. What I'm trying to say, and probably doing an exceedingly poor job of is that the view really should just display data. Your model, invoked through your actions, should determine the apropriate data to hand over to the view. Beyond that, it's really moot how you do it. My personal tendency is to use some sort of resource bundle, commons-resources or other, to handle the static items, and to handle a database for dynamic ones. Google Java i18n, Java internationalization, or visit jakarta.apache.org/commons/resources for the static approaches. Good Luck! Eddie - Original Message - From: bryan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 2:10 PM Subject: Localize a dropdown select list Is this possible with struts ? i don't find a mention of it but can't imagine it hasn't been implemented. For example in the jsp html-el:select property=swimmingPool html-el:optionsCollection property=swimmingPoolOptions value=name label=name/ /html-el:select Which generates the following ... select name=swimmingPooloption value=type.yestype.yes/option option value=type.notype.no/option option value=type.option_to_buildtype.option_to_build/option option value=type.undefinedtype.undefined/option/select Is it possible to map type.no to a value in the resource bundles ?? --b -- http://www.revoltingdigits.com https://jestate.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0451-1, 12/14/2004 Tested on: 12/14/2004 10:40:25 PM avast! - copyright (c) 2000-2004 ALWIL Software. http://www.avast.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with starting the samplecode-urgent help
The error says that class strutsTutorial.UserRegistrationAction is not found. Check whether class is there in WEB-INF/classes directroty rgds Antony Paul On Mon, 13 Dec 2004 21:24:39 -0800, S.B. [EMAIL PROTECTED] wrote: No, it still doesn't work. I am copying the error I get when I give: http://localhost:8080/strutsTutorial/userRegistration.do Can you tellme exactly where you are saying to change this? Also, I think it's the tilesprocessor request. I am not using tiles just default. Is default requestprocessor? If so, what do I add to the struts-config.xml? StrutsConsole is not giving any errors. here's the output I get: INFO: Jk running ID=0 time=0/200 config=C:\open_source\jakarta-tomcat-4.1.30\co nf\jk2.properties Dec 13, 2004 9:19:09 PM org.apache.struts.tiles.TilesRequestProcessor initDefini tionsMapping INFO: Tiles definition factory found for request processor ''. Dec 13, 2004 9:19:09 PM org.apache.struts.action.RequestProcessor processMapping SEVERE: Invalid path /UserRegistration was requested Dec 13, 2004 9:19:18 PM org.apache.struts.action.RequestProcessor processActionC reate SEVERE: No action instance for path /userRegistration could be created java.lang.ClassNotFoundException: strutsTutorial.UserRegistrationAction at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa der.java:1443) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa der.java:1289) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.jav a:207) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils. java:231) at org.apache.struts.action.RequestProcessor.processActionCreate(Request Processor.java:326) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja -- -Original Message- From: Sebastián Gorgo [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 12:52 PM To: Struts Users Mailing List Subject: Re: Problem with starting the samplecode-urgent help You must change strutsTutorial.UserRegistrationAction to StrutsTutorial.UserRegistrationAction. Its case-sensitive. S.B. wrote: I have a created a subclass of Action, called UserRegistrationAction: package StrutsTutorial; 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 UserRegistrationAction extends Action{ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ return mapping.findForward(success); } } I have following struts-config file: (i have added the last action mapping action path=/UserRegistration type=strutsTutorial.UserRegistrationAction parameter=/pages/regSuccess.jsp forward name=success path=/pages/strutsTutorial/regSuccess.jsp / /action ) !-- === Global Forward Definitions -- global-forwards !-- Default forward to Welcome action -- !-- Demonstrates using index.jsp to forward -- forward name=welcome path=/Welcome.do / /global-forwards !-- === Action Mapping Definitions -- action-mappings !-- Default Welcome action -- !-- Forwards to Welcome.jsp -- action path=/Welcome type=org.apache.struts.actions.ForwardAction parameter=/pages/Welcome.jsp / !-- sample input and input submit actions action path=/Input type=org.apache.struts.actions.ForwardAction parameter=/pages/Input.jsp/ action path=/InputSubmit type=app.InputAction name=inputForm scope=request validate=true input=/pages/Input.jsp/ end samples -- action path=/UserRegistration type=strutsTutorial.UserRegistrationAction parameter=/pages/regSuccess.jsp forward name=success path=/pages/strutsTutorial/regSuccess.jsp / /action /action-mappings -- The jsp file is just like hello world jsp. I have UserRegistrationAction.class in the directory structure at: C:\\webapps\strutsTutorial\WEB-INF\classes\StrutsTutorial\UserRegi st rationAction.class Ant is ok. Building ok. Deployed war on tomcat 4.1. but- --- What's the problem? When I give : http://localhost:8080/strutsTutorial/UserRegistration.do it gives me error:
Re: test
No. The problem is that my webmail client, which is all I can use at work to access mailing lists, has a bug which causes messages to not get through to the lists. My web host has been working on it for some time and so the only way to see if they've fixed it or not is to send a message. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Guillaume Cottenceau wrote: Frank W. Zammetti (MLists) fzlists 'at' omnytex.com writes: Please ignore me. Just seeing if my web host fixed the webmail problem I've been having. Thanks! No offense, but is it not possible to test that from one email of yours to another one? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Generating valid HTML from html:form tag
But that's 5 years during which a non standards-compliant browser has had 90% of the browser market... I dont know of any browser which gets upset at the form name attribute! As a side note, why does struts set the form name? is it used anywhere? I cant see any reason to use the name tag atall. There's no need to use it with javascript anymore. Daniel. -Original Message- From: William Ferguson [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 13:30 To: Struts Users Mailing List Cc: [EMAIL PROTECTED] Subject: Re: Generating valid HTML from html:form tag Well, the w3C validator certainly considers it to be invalid and is validating against the HTML 4.01 spec which came into being in December 1999. So I'd be inclined to say that 5 years is more than enough deprecation notice. William - Original Message - From: [EMAIL PROTECTED] Is it the opinion of others that deprecated is semantically equivalent to invalid? William Ferguson [EMAIL PROTECTED] I noticed that the html generated form the html:form tag is not valid HTML according to the W3C validation service (http://validator.w3.org). It generates a form tag with a 'name' attribute which has been deprecated. Since I'm striving to conform to relevant standards as best as possible, I was wondering whether anyone else had faced the same issue and what approach had been taken. If I don't use the html:form tag then I can't use other tags like html:select etc, which means a fair bit of messing about for drop-downs. Does anyone else bother with HTML validation? And if so, how do you handle Forms and Form elements? William -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.5.2 - Release Date: 13-Dec-04 - 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: ??? property naming convention problem
This is confusing. The bean spec / article is talking about going from a method name into a property name. The problem here is the other way round. Eg, decapitalise method-property will convert: getECoupon - ECoupon But it doesnt mention property-method capitalise: eCoupon - getECoupon / geteCoupon I think the assumption has been made that if youre going to go from getECoupon -ECoupon that you must go from ECoupon-getECoupon and therefore eCoupon-geteCoupon However the spec doesnt say that this should be a reversible process, so why not eCoupon-getECoupon Daniel. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: 14 December 2004 14:01 To: Struts Users Mailing List Subject: Re: ??? property naming convention problem Sure is mate!. Its all in the javabean specs This post should enlighten you further: http://marc.theaimsgroup.com/?l=struts-userm=98900256403524w=2 And for another getter/setter 'gotcha' you can read this thread through http://marc.theaimsgroup.com/?l=struts-userm=102696975022454w=2 hth Andrew Vinod Easaw Varghese wrote: Hi, I have a textbox in a JSP whose property has been named as eCoupon. I have created the necessary ActionForm with the necessary setter and getter methods such as setECoupon and getECoupon. When I run submit the form within the corresponding JSP I get the error message not able to find the corresponding getter method for property eCoupon The moment I changed the property name to ecoupon and made the necessary adjustments within the ActionForm all began to work well. Is there a property naming convention to be followed in STRUTS With thanks and Regards Vinod Easaw Varghese - 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: Generating valid HTML from html:form tag
On Tuesday 14 December 2004 08:51, William Ferguson wrote: I noticed that the html generated form the html:form tag is not valid HTML according to the W3C validation service (http://validator.w3.org). It generates a form tag with a 'name' attribute which has been deprecated. Since I'm striving to conform to relevant standards as best as possible, I was wondering whether anyone else had faced the same issue and what approach had been taken. If I don't use the html:form tag then I can't use other tags like html:select etc, which means a fair bit of messing about for drop-downs. Does anyone else bother with HTML validation? And if so, how do you handle Forms and Form elements? Don't you need to use html:xhtm/l or html:html xhtml=true to get full standards compliance? From the Struts Developer guide: The output is HTML 4.01 compliant or XHTML 1.0 when in XHTML mode. -- derek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Usign displaytag
Hi all I'm trying to use displaytag http://demo.raibledesigns.com/appfuse/demos/users-edit.jsp http://demo.raibledesigns.com/appfuse/demos/users-edit.jsp and I'm trying to reproduce the table on this page. I need the checkboxes to select/deselect all the other ones and I need the checkboxes to hold the ID from my bean class. Here is my code. Can anybody tell me how to achieve this? Thanks Donie html:form action=/mmsc/ca/terminalProfilesFormMainAction display:table name=sessionScope.grid id=row pagesize=10 display:column width=240 maxLength=40 property=profileID title=Profile ID sortable=true url=/mmsc/ca/terminalProfileFormMainAction.do/ display:column width=200 maxLength=30 property=userAgentName title=User Agent Name/ display:column width=5 title=input type=\checkbox\ name=\allbox\ onclick=\checkAll(this.form)\/ input type=checkbox name=id value=${SHOUND CONTAIN grid.profileID} onclick=radio(this)/ /display:column display:setProperty name=paging.banner.placement value=bottom / display:footer trtdc:out value=br/ //tdtr /display:footer /display:table /html:form
Re: Problems initializing form objects
Hi Jeff, thanks for your answer. I was already doing that, using two actions (well, using two different methods of a LookupAction), one to initialize the list and the other to process it, but the problem arises when I submit the form in page.jsp. Jeff Beal wrote: When I have this sort of thing, I usually put it in an initializer Action that I always link to in place of the JSP. action path=initPage name=BasicContentForm validate=false type=com.example.InitAction !-- This action populates the form -- forward path=page.jsp redirect=false name=success / /action action path=processPage name=BasicContentForm validate=true input=initPage.do ... !-- this action processes the form -- /action -- Jeff Diego Manilla Suárez wrote: Hi! I have a problem with form members initialization. I have this form. public class BasicContentForm extends ValidatorForm { protected java.util.List propertyValues; public BasicContentForm() { this.propertyValues = new java.util.ArrayList(); } public void setPropertyValues( java.util.List propertyValues ) { this.propertyValues = propertyValues; }public java.util.List getPropertyValues() { return this.propertyValues; } public Object getPropertyValue(int index) { return propertyValues.get(index); } public void reset(ActionMapping mapping, HttpServletRequest request) { this.propertyValues = new java.util.ArrayList(); } } And this jsp: logic:iterate name=basicContentForm property=propertyValues id=propertyValue html:text name=propertyValue property=value indexed=true/ /logic:iterate The problem is that the number and type of the elements of propertyValues list is calculated dynamically (from the database). I was doing that on my Action class, but I've realized that this doesn't work: when I submit the form, I get an Exception at BeanUtils.populate, because the list is not properly initialized. If I can't initialize it on the reset() method (I need to access the database), what else can I do? Thanks 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: Tips on testing pages with multiple potential paths?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 3:15 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Tips on testing pages with multiple potential paths? Importance: High We have an application where each page has about 8 different paths depending upon the DTO in session, and the values passed in the request. I have only started on the 1st page right now, and feel overwhelmed with the limitless possibilities I have to test for. I am hoping someone can give me some tips to be able make my test writing easier, and potentially re-usable. The generic examples just don't address trying to do complex multi-path scenarios. I am using CactusStrutsTestCase currently. This is one of the reasons why I stopped using Cactus a long time ago. I found it easier to test the individual action (http://strutstestcase.sourceforge.net/) then I did the page, conceptually for me at least. However, I think what you posted earlier was a great start. You're right though, it is a daunting task to build a robust test suite. If you're thinking I'll have as many lines of code in your test suite as your project, you're probably right there too. It's not easy. The best piece of advice I've ever heard is to write your test software with the same attitude you write your main code. If a test case, or the entire suite needs to be refactored, do it. I've also noticed that with rare exception each project tends to end up with it's own unique patterns to a large degree. Test one thing at a time. If you're testing the Presentation layer, leave the business objects and dao objects out of the picture. If you can't do that easily, it's probably time to re-factor your architecture so you can test it easier. Read every thing you can on Mock Objects... they are great things if you know how to use them. Mick Knutson Wells Fargo Business Direct Information Systems (415) 222-1020 This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. - 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: Preventing concurrent execution of an Action
-Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 3:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? No.. you need to syncrhonize on the lock. Check the java tutorials on multi-threaded architecture for details. A better solution might be to use one of the solutions discussed on the list on implementing a progress bar, or please wait page when the user clicks the link. http://www.mail-archive.com/cgi-bin/htsearch?config=user_struts_apache_orgrestrict=exclude=words=progress+b public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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]
AW: Preventing concurrent execution of an Action
Small correction, In your example there is a difference whether you have a multiprocessor machine. On a single-proc machine it will work fine (prevent second user from overwriting), on a multi-processor machine it's undefined. Regards Leon -Ursprüngliche Nachricht- Von: Durham David R Jr Contr 805 CSPTS/SCE [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 14. Dezember 2004 23:46 An: Struts Users Mailing List Betreff: RE: Preventing concurrent execution of an Action You might be able to get away with simply adding 'synchronized' to the execute method's signature. synchronized public ActionForward execute(...) { updateXml(); } private void updateXml() { ... } The lock/key threading techniques have to do with, I think, a more complex threading issue than the one you've presented. - Dave -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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: Preventing concurrent execution of an Action (example)
Ok, just in case it was more confusing then helping. Here is the (imho) safe solution (haven't tested it, but it should work fine): The isLock method is needed to ensure, that all threads have the same lock value. Volatile should guarantee it, but it's not supported on all vms. You should call the unlock method after you know, that the processing of the file is finished. Another problem, you could have, is to ensure, that the page where the link is placed is still valid. You can ensure it, by giving your call to the action a timestamp parameter and check whether it's still the proper timestamp for the file. Here the code (without timestamp): public class youraction ...{ private volatile boolean lock; private void lock() throws AlreadyLockedException{ if (lock) throw new AlreadyLockedException(); lock = true; } private void unlock(){ lock = false; } private synchronized boolean isLocked(){ return lock; } private synchronized void updateXML() throws AlreadyLockedException{ //double check needed, in case another thread was already //between first isLocked and updateXML call. if (isLocked()) throw new AlreadyLockedException(); lock(); // generate the xml file. unlock(); } public ActionForward execute( ActionMapping mapping, ActionForm af, HttpServletRequest req, HttpServletResponse res) throws Exception { //... if (isLocked()) return mapping.findForward(noupdate); try{ updateXML(); return mapping.findForward(updatecomplete); }catch(AlreadyLockedException e){ return mapping.findForward(noupdate); } } } -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 4:34 PM To: [EMAIL PROTECTED] Subject: Preventing concurrent execution of an Action Hi I've an action that creates an XML file on the server. It's executed by clicking on a link. I don't want multiple instances of it to be executed concurrently. Does an approach like the following work? public class UpdateXmlAction ... { private static final boolean locked; public void execute(...) { if (UpdateXmlAction.locked) { return; } Synchronized(UpdateXmlAction.class) { locked = true; updateXml(); locked = false; } } } Thanks in advance. -- Behrang Saeedzadeh http://www.jroller.com/page/behrangsa - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: submitting multiple option items to struts action
-Original Message- From: Sudip Shrestha [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 10:16 AM To: Struts Users Mailing List Subject: submitting multiple option items to struts action -I have an html:select element which has several option items. -This is kind of unusual situation where I have to select multiple option items instead of only one and submit that array of option items to the struts action. -The select element contains a lot of option items so using check boxes and multiboxes for this purpose does not seem like a good idea. -Is there any other way to do this? Yes... html:select will do it. You have to set multiple to true, and use an array or Collection. html:select property=selectedItemList multiple=true html:optionBLAH blah/ /html:select http://struts.apache.org/userGuide/struts-html.html#select -- Thanx, Sudip - 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: Annotations and Struts
Im not so sure that would work too well as the actionforms are representations of the view state, and whats in a form on the view doesnt necessarily correspond directly to the objects that are modelled at the business tier, and often contains other stuff that is view specific, or exists to workaround view layer issues (like the need for a reset method). Mike Duffy wrote: The Austin JUG meeting tonight featured the J2SE 5.0 presentation from Sum. I am currently using the new annotations feature on a test project using EJB 3.0 and JBoss. It is very cool; just annotate your entity beans and the server does all the database mappings. As I was listening to tonight's presentation, I thought it would be a good idea to annotate the same entity beans with formParameter annotations; i.e., do away with form beans and the mapping of form beans to business model objects. I know this is exactly what is planned for JSF (making the backing beans and entity beans one in the same); however, I do not want to move to JSF at this time (maybe the change will be worth while when JSF truly has some rich client components; until then, why make such a radical change from something that is working well). In any case, has anyone given serious thought to doing away with form beans in Struts and moving to annotations? Mike __ Do you Yahoo!? Send holiday email and support a worthy cause. Do good. http://celebrity.mail.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]