Re: Simple way to configure an action?
On 2005-01-24, Larry Meadors [EMAIL PROTECTED] wrote: Maybe we are approaching this from the wrong direction. what is the problem you are trying to solve? Perhaps I am. I have an action which retrieves a couple of values from a database. If the retreival fails, it return some reasonable default values instead. It is these defaults which I want to be user configurable, that is, configurable from some initialization file. The introspection/set-parameter feature, found in PlugIns, would solve my problem, but it isn't available for actions, only actionmappings. On Sun, 23 Jan 2005 17:09:45 -0600, Eddie Bush [EMAIL PROTECTED] wrote: Actions are, effectively, singletons. [...] This means actions have to be thread-safe, and suggests that the best place to configure things would be in the mapping itself, or some other way (resource bundle, propeties file, singleton, factory). The action is specialized, it is only responsible for making sure the values are set in the request's session, so it will not be called from different actionmappings. Further, as soon as the action have been instantiated the configurable member variables will be used as read-only values. So there is no concurrency issue involved. -- Fredrik Jonson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] support for *.do files
Since this is rather OT, I have marked the subject as such. Rather than use mod_jk, I have been in the habit of using mod_proxy and have httpd.conf as follows: It works fine for me - but I'm unsure - are there performance disadvantages with mod_proxy? Ah - yes and to answer the original question - there is no need to set a mime type for *.do LoadModule proxy_module modules/mod_proxy.so ProxyRequests off ProxyPreserveHost on ProxyVia on ProxyPass /foo http://127.0.0.1:8080/foo/ ProxyPassReverse /foo http://127.0.0.1:8080/foo/ db -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: 24 January 2005 05:38 To: Struts Users Mailing List Subject: RE: support for *.do files Actually guys, I think the main configuration file for mod_jk is called either workers.properties or workers2.properties. What is in httpd.conf should be one or two simple load module statements. The real configuration is usually located in the Apache (not Tomcat) web server's conf or conf.d directory. Further configuration information for mod_jk or mod_jk2 is available at the URL: http://jakarta.apache.org/tomcat/connectors-doc/index.html See the configuration, howto, and FAQ sections. Regards, David -Original Message- From: Eddie Bush [mailto:[EMAIL PROTECTED] Sent: Sunday, January 23, 2005 11:53 PM To: Struts Users Mailing List Subject: Re: support for *.do files You get a 404 because the default port for HTTP traffic is 80, and Apache knows nothing about your web application. That's why you have to specify a port - Tomcat, which is running on the port you specify, does know about the web app. You've got to setup a mapping in your Apache config (httpd.conf, I think) that tells apache, for a given path, to pass control to Tomcat. There should be some documentation on that available with your mod_jk implementation. It's been long enough since I've done this that I don't remember the exact syntax and such. The examples I found back then were hard to find. I like to think they're easier to come by nowadays. I know there was a movement to make it easier for folks to configure this sort of thing ... Good Luck! On Mon, 24 Jan 2005 10:11:15 +0530, Kalluru Uma. Maheswar [EMAIL PROTECTED] wrote: Hi, My server is running Apache HTTP server with Tomcat. My web.xml file is configured to support *.do files and all my struts apps works directly on Tomcat i.e. using 8080 port. But If I request for *.do files through Apache i.e. without giving port number, then I get 404 file not found. Apache HTTP Mail lists are telling to use mod_jk but this component is already installed in the server. And the Admin person is asking to give mime types for *.do Can some one throw some light on me please? What should I do to make *.do work in Apache HTTP Server? Any idea on Handlers would be helpful. Thanks Uma -- Eddie Bush - 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 message has been scanned for viruses and dangerous content using Vet Anti-Virus Protection and is believed to be clean. === - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a sample for DBConnection Pooling code
Finally I could get the things running. The things are working when i specified into GlobalResources and GlobalContext inside server.xml My server.xml is something like below.. - GlobalNamingResources Resource auth=Container name=mspool type=javax.sql.DataSource/ ResourceParams name=mspool parameter nameurl/name valuejdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sbcs/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxActive/name value100/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valuemanisha/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameselectMethod/name valuecursor/value /parameter parameter namepassword/name valuemanisha/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter /ResourceParams /GlobalNamingResources ... Host appBase=webapps name=localhost DefaultContext className=org.apache.catalina.core.StandardDefaultContext ResourceLink global=mspool name=mspool type=javax.sql.DataSource/ /DefaultContext Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=localhost_log. suffix=.txt timestamp=true/ /Host I did not change anything inside Web.xml as everything in inside Global. But i do not want it inside global naming resources / default context - but i want it only specific to my web application. i also understand that Context - should not be used for TomCat5.0 - but need to put inside /META-INF/context.xml. 1)My problem is my working directory is different. I use ant to create war file and then i manually stop the server - delete existing war file / existing directory (This is due to some Win TomCat problem .??..). Then i deploy it using TomCat Manager. It automatically creates META-INF file for me, i do not have such thing inside my working directory. So where i can put my context.xml ? 2) What shall i put inside context.xml and what shall i put inside server.xml / web/xml ? I tried many different ways but when i use context and as there is no such application (because i delete and i re-deploy it) - tomcat server does not run my application. Pls guide me regards Manisha Pavel Kolesnikov [EMAIL PROTECTED] wrote: On Thu, 20 Jan 2005 16:01:55 -0800 (PST), Manisha Sathe wrote: Oh! sorry, i did not make it clear. I do went thr this. Currently i am on TomCat but live environment may not be. (I believe this is for TomCat ?? I Yes, the link I've sent is about Tomcat configuration, but only the part about configuring a datasource is Tomcat specific. But the sample Java code for accessing the datasource using JNDI should work with any application server. Also in instructions MSSQL Database is not mentioned - so not sure what to do. Would appreciate if u guide me pls. I guess it should be be similar as examples for other databases, just change the class name of database driver, JDBC url and access information. Pavel __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
still have export problem
hi unfortunately i still miss something. i use struts 1.1 , j2ee1.3 container , jdeveloper10g, i tried jim's sample and mine but i got the same error.page opens with blank page. i dont want my table sortable or another utility just export future. i use export filter.but when i click it opens blank page. i need advice.is there somebody tried my problem before ? sincerely - Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone.
OT newbie - java class question
Hi friends, I have a method like this, the 3rd param, category contains ArrayList of classes Category. Here I am copying the Category class from the ArrayList to lALCategories (Line 11) and storing its property name into a local variable lsName (Line15) and doing some processing and writing it back on line 19. Then adding this class to lALOutPut. Here the changes I made to the class property name is reflected in HashMap category also. I don't want the changes to be reflected in the passed HashMap category. How do I do this? Please help. TIA Sudheer 01. public static ArrayList listTree(Integer parentID, HashMap tree, HashMap category) 02. { 03.Category lCCategory = null; 04.ArrayList lALCategories = new ArrayList(), lALOutPut = new ArrayList(); 05.Integer liNext = null; 06.Integer liTree[] = (Integer[]) tree.get(parentID); 07.String lsName = ; 08.for (short liElm = 0; liElm liTree.length; liElm++) 09.{ 10. liNext = liTree[liElm]; 11. lALCategories = (ArrayList) category.get(liNext); 12. for (int liIElm = 0; liIElm lALCategories.size(); liIElm++) 13. { 14.lCCategory = (Category) lALCategories.get(liIElm); 15.lsName = lCCategory.getName() 16./* 17.Some processing here on lsName. 18.*/ 19.lCCategory.setName(lsName); 20.lALOutPut.add(lCCategory); 21. } 22.} 23.return lALOutPut; 24.}
R: OT newbie - java class question
Hi, You can clone the Category object implementanting the java.lang.Cloneable interface (see the java api documentation) and correct the code in the following way: 12. for (Iterator iterator = lALCategories.iterator(); iterator.hasNext(); ) 13. { 14.lCCategory = ((Category) iterator.next()).clone(); 15.lsName = lCCategory.getName() 16./* 17.Some processing here on lsName. 18.*/ 19.lCCategory.setName(lsName); 20.lALOutPut.add(lCCategory); 21. } BR /Amleto -Messaggio originale- Da: Sudheer [mailto:[EMAIL PROTECTED] Inviato: lunedì 24 gennaio 2005 9.59 A: Struts Users Mailing List Oggetto: OT newbie - java class question Hi friends, I have a method like this, the 3rd param, category contains ArrayList of classes Category. Here I am copying the Category class from the ArrayList to lALCategories (Line 11) and storing its property name into a local variable lsName (Line15) and doing some processing and writing it back on line 19. Then adding this class to lALOutPut. Here the changes I made to the class property name is reflected in HashMap category also. I don't want the changes to be reflected in the passed HashMap category. How do I do this? Please help. TIA Sudheer 01. public static ArrayList listTree(Integer parentID, HashMap tree, HashMap category) 02. { 03.Category lCCategory = null; 04.ArrayList lALCategories = new ArrayList(), lALOutPut = new ArrayList(); 05.Integer liNext = null; 06.Integer liTree[] = (Integer[]) tree.get(parentID); 07.String lsName = ; 08.for (short liElm = 0; liElm liTree.length; liElm++) 09.{ 10. liNext = liTree[liElm]; 11. lALCategories = (ArrayList) category.get(liNext); 12. for (int liIElm = 0; liIElm lALCategories.size(); liIElm++) 13. { 14.lCCategory = (Category) lALCategories.get(liIElm); 15.lsName = lCCategory.getName() 16./* 17.Some processing here on lsName. 18.*/ 19.lCCategory.setName(lsName); 20.lALOutPut.add(lCCategory); 21. } 22.} 23.return lALOutPut; 24.} -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 21/01/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 21/01/2005 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A table on a form from a List of Lists
Hi, i have been trying to create a table on my form from a single property in my actionForm. the property is a List (actually an ArrayList) containg the rows of the table, each element (i.e row on the table) is represented by a List of Strings representing the fields of the list. i can code my JSP page to display the contents of the proprety in a table but i cant get it to set the values of the property from the page on submit. all the efforts has failed, i my latest effort, i coded the property as property[row][col] but i get an error that dia is no getter method for property[0][0]. i wrote the access methods like String getProperty(int row, int col){ return (String)((List)property.get(row)).get(col); } it did not work, any ideas will be apreciated.
Re: Simple way to configure an action?
OK, I think i understand what you are trying to do. You could override the constructor of your action to read in a properties file. If you have multiple actions, you could make it a base class that uses some common naming convention, that may simplify things. On Mon, 24 Jan 2005 08:02:04 + (UTC), [EMAIL PROTECTED] wrote: On 2005-01-24, Larry Meadors [EMAIL PROTECTED] wrote: Maybe we are approaching this from the wrong direction. what is the problem you are trying to solve? Perhaps I am. I have an action which retrieves a couple of values from a database. If the retreival fails, it return some reasonable default values instead. It is these defaults which I want to be user configurable, that is, configurable from some initialization file. The introspection/set-parameter feature, found in PlugIns, would solve my problem, but it isn't available for actions, only actionmappings. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
error and warning messages
Hi I have the requirement to perform server side validation on a form, no probs. The problem is that i have a set of error rules and a set of warning rules. There is no problem defining the errors in my validation.xml and returning the user to the page to correct them, however at some point probably when all error messages have been validated i need to show warning messages. For example value X is outside of the normal range do you want to continue? If not i want the user to be able to change their value, however this then means i need to do the error checking again incase the user has changed there warning value to an error value!! I thought of the idea of having error rules in my validation.xml and then dynamically validating the warning rules progmatically in my action (not sure if this is the best method though). Has anyone come across a solution or able to think of a better method of implementing this functionality. Many thanks Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sorting
Hi, Can anyone suggest the best way to order data in a JSP (from mysql database) using struts? i.e. list of names and address, can click a column to order by first name, or last name or address etc Thanks Suzy
Re: max file size - validator - javascript
On Mon, 24 Jan 2005 15:01:37 +0800, Nathan Coast [EMAIL PROTECTED] wrote: Hi, Does the validator support max file size for an uploaded file? I have found various threads covering how to specify the max file size and how to check if it is exceeded but this all seems to be server-side and outside of the validator mechanism e.g. http://www.mail-archive.com/user@struts.apache.org/msg12942.html The validator mechanism is server side, or client side, so it will work. I'm not even sure if it is possible to find the size of a file upload within javascript. Obviously if it isn't possible from javascript, it can't be implemented in the validator (not in the client at least). cheers Nathan -- Nathan Coast Managing Director Codeczar Ltd mob : (852) 9049 5581 tel : (852) 2834 8733 fax : (852) 2834 8755 web : http://www.codeczar.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: still have export problem
On Mon, 24 Jan 2005 09:00:56 + (GMT), Metin Erksan [EMAIL PROTECTED] wrote: hi unfortunately i still miss something. i use struts 1.1 , j2ee1.3 container , jdeveloper10g, i tried jim's sample and mine but i got the same error.page opens with blank page. i dont want my table sortable or another utility just export future. i use export filter.but when i click it opens blank page. i need advice.is there somebody tried my problem before ? What are you trying to export? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT newbie - java class question
On Mon, 24 Jan 2005 14:29:21 +0530, Sudheer [EMAIL PROTECTED] wrote: Hi friends, I have a method like this, the 3rd param, category contains ArrayList of classes Category. Here I am copying the Category class from the ArrayList to lALCategories (Line 11) and storing its property name into a local variable lsName (Line15) and doing some processing and writing it back on line 19. Then adding this class to lALOutPut. Here the changes I made to the class property name is reflected in HashMap category also. I don't want the changes to be reflected in the passed HashMap category. How do I do this? Please help. This is pretty basic Java. Java is pass by reference, so there is only one copy of the ICCategory. If you want multiple copies your going to have to clone it. TIA Sudheer 01. public static ArrayList listTree(Integer parentID, HashMap tree, HashMap category) 02. { 03.Category lCCategory = null; 04.ArrayList lALCategories = new ArrayList(), lALOutPut = new ArrayList(); 05.Integer liNext = null; 06.Integer liTree[] = (Integer[]) tree.get(parentID); 07.String lsName = ; 08.for (short liElm = 0; liElm liTree.length; liElm++) 09.{ 10. liNext = liTree[liElm]; 11. lALCategories = (ArrayList) category.get(liNext); 12. for (int liIElm = 0; liIElm lALCategories.size(); liIElm++) 13. { 14.lCCategory = (Category) lALCategories.get(liIElm); 15.lsName = lCCategory.getName() 16./* 17.Some processing here on lsName. 18.*/ 19.lCCategory.setName(lsName); 20.lALOutPut.add(lCCategory); 21. } 22.} 23.return lALOutPut; 24.} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple way to 'configure' an action?
Another possible approach is to create a DefaultValues class, something along these lines: public class DefaultValues { private HashMap defaultValues; { setDefaultValues(); } public static HashMap getDefaultValues() { return defaultValues; } private static void setDefaultValues() { // Insert code to read in property file here // and store them in defaultValues } public static void resetDefaultValues() { setDefaultValues(); } } The benefit I think is that it keeps your default values independant of the Actions. Having the resetDefaultValues() method gives you a way to reinitialize the values without taking your app down (i.e., maybe on an Admin page you provide a Reset Default Values button that results in that method being called). By putting the property file read in the Action constructor, I'm not sure you'd be able to do this since Struts creates the one instance of your Action and gets a reference to it per request. I suppose you could do the above in an Action essentially and call setDefaultValues() from the constructor rather than a static initializer, but then you get into the question of whether that's thread-safe, since an Action has to be. In either case, just mentioning another possibility. :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, January 24, 2005 8:13 am, Larry Meadors said: OK, I think i understand what you are trying to do. You could override the constructor of your action to read in a properties file. If you have multiple actions, you could make it a base class that uses some common naming convention, that may simplify things. On Mon, 24 Jan 2005 08:02:04 + (UTC), [EMAIL PROTECTED] wrote: On 2005-01-24, Larry Meadors [EMAIL PROTECTED] wrote: Maybe we are approaching this from the wrong direction. what is the problem you are trying to solve? Perhaps I am. I have an action which retrieves a couple of values from a database. If the retreival fails, it return some reasonable default values instead. It is these defaults which I want to be user configurable, that is, configurable from some initialization file. The introspection/set-parameter feature, found in PlugIns, would solve my problem, but it isn't available for actions, only actionmappings. - 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: Simple way to configure an action?
On Mon, 24 Jan 2005 06:13:23 -0700, Larry Meadors [EMAIL PROTECTED] wrote: OK, I think i understand what you are trying to do. You could override the constructor of your action to read in a properties file. If you have multiple actions, you could make it a base class that uses some common naming convention, that may simplify things. You could also implement this as a filter, which will give you more options then an action for this kind of thing. Espeically in terms of adding this check to a lot of different URLS. On Mon, 24 Jan 2005 08:02:04 + (UTC), [EMAIL PROTECTED] wrote: On 2005-01-24, Larry Meadors [EMAIL PROTECTED] wrote: Maybe we are approaching this from the wrong direction. what is the problem you are trying to solve? Perhaps I am. I have an action which retrieves a couple of values from a database. If the retreival fails, it return some reasonable default values instead. It is these defaults which I want to be user configurable, that is, configurable from some initialization file. The introspection/set-parameter feature, found in PlugIns, would solve my problem, but it isn't available for actions, only actionmappings. - 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: error and warning messages
On Mon, 24 Jan 2005 13:34:50 +, Andy Richards [EMAIL PROTECTED] wrote: Hi I have the requirement to perform server side validation on a form, no probs. The problem is that i have a set of error rules and a set of warning rules. There is no problem defining the errors in my validation.xml and returning the user to the page to correct them, however at some point probably when all error messages have been validated i need to show warning messages. For example value X is outside of the normal range do you want to continue? If not i want the user to be able to change their value, however this then means i need to do the error checking again incase the user has changed there warning value to an error value!! I thought of the idea of having error rules in my validation.xml and then dynamically validating the warning rules progmatically in my action (not sure if this is the best method though). Has anyone come across a solution or able to think of a better method of implementing this functionality. Struts, I believe, has no real mechanism for warnings, so your going to have to put that into the session yourself. I think the better place would be in the validation method of your form. Make sure you call super.validate. Any errors it returns will be errors, then you can check for warnings, putting those messages into your warning attribute. Many thanks Andy - 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: Fw: Sorting
On Mon, 24 Jan 2005 09:17:03 -0500, James Mitchell [EMAIL PROTECTED] wrote: Please ask on the user list. The dev list is for issues with the actual framework, not how to use it. Thanks. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Suzy Fynes [EMAIL PROTECTED] To: dev@struts.apache.org Sent: Monday, January 24, 2005 8:53 AM Subject: Sorting Hi, Can anyone suggest the best way to order data in a JSP (from mysql database) using struts? i.e. list of names and address, can click a column to order by first name, or last name or address etc Display tag library: http://displaytag.sourceforge.net/ Thanks Suzy - 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: Sorting
Hello Suzy, You could use the display tag library: it does excatly what you are looking for; sorting by clicking on column headers. See http://displaytag.sourceforge.net/ HTH Renaud Suzy Fynes [EMAIL PROTECTED] 24/01/2005 15:23 Please respond to Struts Users Mailing List user@struts.apache.org To user@struts.apache.org cc Subject Sorting Hi, Can anyone suggest the best way to order data in a JSP (from mysql database) using struts? i.e. list of names and address, can click a column to order by first name, or last name or address etc Thanks Suzy
Re: A table on a form from a List of Lists
Take a look at the nested tags. In your case, your code may end up looking like: nested:form action=/myAction table nested:iterate property=listOfRows tr nested:iterate property=listOfFields td nested:text property=myField /td /nested:iterate tr/ /nested:iterate /table /nested:form Hubert On Mon, 24 Jan 2005 10:31:59 +0100, Olasoji Ajayi [EMAIL PROTECTED] wrote: Hi, i have been trying to create a table on my form from a single property in my actionForm. the property is a List (actually an ArrayList) containg the rows of the table, each element (i.e row on the table) is represented by a List of Strings representing the fields of the list. i can code my JSP page to display the contents of the proprety in a table but i cant get it to set the values of the property from the page on submit. all the efforts has failed, i my latest effort, i coded the property as property[row][col] but i get an error that dia is no getter method for property[0][0]. i wrote the access methods like String getProperty(int row, int col){ return (String)((List)property.get(row)).get(col); } it did not work, any ideas will be apreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error and warning messages
Thanks Jim, this was along the lines off what i was thinking. Can i not just say validate=true in my struts config for my error validation, or must i call super.validate from my action form before i do my warning logic? cheers Andy Jim Barrows wrote: On Mon, 24 Jan 2005 13:34:50 +, Andy Richards [EMAIL PROTECTED] wrote: Hi I have the requirement to perform server side validation on a form, no probs. The problem is that i have a set of error rules and a set of warning rules. There is no problem defining the errors in my validation.xml and returning the user to the page to correct them, however at some point probably when all error messages have been validated i need to show warning messages. For example value X is outside of the normal range do you want to continue? If not i want the user to be able to change their value, however this then means i need to do the error checking again incase the user has changed there warning value to an error value!! I thought of the idea of having error rules in my validation.xml and then dynamically validating the warning rules progmatically in my action (not sure if this is the best method though). Has anyone come across a solution or able to think of a better method of implementing this functionality. Struts, I believe, has no real mechanism for warnings, so your going to have to put that into the session yourself. I think the better place would be in the validation method of your form. Make sure you call super.validate. Any errors it returns will be errors, then you can check for warnings, putting those messages into your warning attribute. Many thanks Andy - 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: max file size - validator - javascript
At 3:01 PM +0800 1/24/05, Nathan Coast wrote: Hi, Does the validator support max file size for an uploaded file? I have found various threads covering how to specify the max file size and how to check if it is exceeded but this all seems to be server-side and outside of the validator mechanism e.g. http://www.mail-archive.com/user@struts.apache.org/msg12942.html I'm not even sure if it is possible to find the size of a file upload within javascript. Obviously if it isn't possible from javascript, it can't be implemented in the validator (not in the client at least). I don't believe there is any standard client-side mechanism for enforcing something like this. Here's an unauthoritative reference: http://www.cs.tut.fi/~jkorpela/forms/file.html#restr Interestingly, the original File upload RFC (1867) suggested that the meaning of maxlength in a file type input element be used as a hint to the maximum acceptable upload size. However, the HTML 4 spec clearly says that in this context, maxlength refers to the length of the file path (a silly thing to enforce, since the client-side file path should be immaterial to the server.) Furthermore, I would think there would be scoping/timing problems, as before the form is submitted, the browser wouldn't want to fool with the file, because it might be lag-inducing, and once the form is submitted, there's no longer a chance for JavaScript to execute. Seems like a shortcoming of the spec to not permit page authors to specify this in the tag, but it's probably because they didn't want to clutter the input element spec with too many modal details. (Although there is the rarely-used accept element which is supposed to accept an enumeration of permitted MIME types for the upload.) 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: Where to send !isTokenValid(request)
Thanks for your response. It was helpful since it brought up some other instances that I hadn't really thought of, such as allowing a double submit for certain actions. Here is the flow we have for this application. 1. User searches for a profile 2. List of matching profiles is displayed 3. User clicks the EDIT link for the profile they want to update 4. Profile is displayed with a TOKEN embedded in a hidden form field 5. User hits Submit to update changes (possibly hitting it twice). 6. If isValidToken == TRUE, call resetToken(request) and the Action will Forward to: a) A confim page using redirect on SUCCESS b) Back to the form page with error msgs on FAILURE So where do I go if isValidToken != TRUE? Personally I wouldn't want to check for double submit if the action is going to do an Update similar to your case (Profile Update) for the simple reason that the form could have been changed between two submits (If the Update is taking 5 secs, let's say (for whatever reason), the user has enough time to change his profile and do another submit before the previous submit is completed. In this case, it's better to save the latest changes by the user) The truth is, the section that's really causing us problems is our enrollment section (adding a user). The problem is really a transactional issue. User fills out a form, submits it, which is then supposed to take that info, create a profile for our website and and then submit that info to a 3rd party which will create a linked account on their side. The problem is caused when the user submit twice. If we send the same request to our 3rd party, their web service throws an exception. We have now idea what the result of the first request was. So in your opinion, in a case like this, is it best to just take them to an error page? If so, do you take them to a blank error page or take them back to the form they filled out with the error on top? Here's what I'd like to do. I'd like to basically store in the session the Token, the requested ActionMapping and the UID of the object being handled (in this case a profile_ID). Then if the isValidToken returns false, look in the session for the last *successful* token that matched the ActionMapping and profile_ID for this request and send them to the same result page. Does that make sense? I wouldn't want to store the ActionMapping in the session because I get the same ActionMapping to the execute method. Well one pitfall I think will potentially happen is this [ User successfully updates a profile with profile id : 150 (no double submit) and you show him a success page saying profile with profile id 150 is successfully updated Next thing the user does, being in the same session, is that he tries to update profile with profile id 151 (but clicking multiple times). Now your application will show the user profile with profile id 150 is successfully updated instead of showing profile with profile id 151 is successfully updated (Also with the potential of ignoring the user's latest changes) Why wouldn't the message be updated to show 151? Wouldn't the first request on the double click have over written the 150? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple way to configure an action?
Eddie Bush's solution is the right one. The ActionMapping is specifically intended for the purpose you have in mind, and is available every time an Action's execute method is called. Even if the Action will not be called from different action mappings, it will always have one action mapping. What's the problem with reading the values from the ActionMapping when the action executes? I'm generally believing that the original motivation for Struts to work this way (pool actions instead of creating one per request) has proven not to be all that useful, and some of the benefits of being able to treat an Action as a request-scoped instance are part of what people like about frameworks like Webwork. It might be worth investigating whether there actually are meaningful performance implications to instantiating an Action upon every request, although a bug in the Struts Chain code (fixed only a month or two ago) was causing this very situation, and it didn't have a noticeable impact on a production application I had built upon it. Don Brown's Struts-Spring project had a proxy action which created a new Action instance for each request based on a Spring configuration. The project is discontinued in favor of equivalent behavior in the Spring core, but you can get the details on that (and a link to currently active substitutes) at http://struts.sourceforge.net/struts-spring/index.html Joe At 8:02 AM + 1/24/05, Fredrik Jonson wrote: On 2005-01-24, Larry Meadors [EMAIL PROTECTED] wrote: Maybe we are approaching this from the wrong direction. what is the problem you are trying to solve? Perhaps I am. I have an action which retrieves a couple of values from a database. If the retreival fails, it return some reasonable default values instead. It is these defaults which I want to be user configurable, that is, configurable from some initialization file. The introspection/set-parameter feature, found in PlugIns, would solve my problem, but it isn't available for actions, only actionmappings. On Sun, 23 Jan 2005 17:09:45 -0600, Eddie Bush [EMAIL PROTECTED] wrote: Actions are, effectively, singletons. [...] This means actions have to be thread-safe, and suggests that the best place to configure things would be in the mapping itself, or some other way (resource bundle, propeties file, singleton, factory). The action is specialized, it is only responsible for making sure the values are set in the request's session, so it will not be called from different actionmappings. Further, as soon as the action have been instantiated the configurable member variables will be used as read-only values. So there is no concurrency issue involved. -- Fredrik Jonson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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: max file size - validator - javascript
Its to do with the browser security manager, in i.e. anyway, you can't script the File field in any fashion with regards to file location, size etc.. You'll need to write an applet and do some io to do the checking if you need to validate client side. In Netscape their are ways round this with special javascript functions that have access to disk client side. Devedge.com is where I was reading this. However in a public domain the lowest common denominator is what your looking for. The problem with the applet is if you have more fields than just a file field to submit then your going to want to have the applet make the actual http post. Once it validates your file field it can call a javascript function which can then pass the rest of the form element values into the applet for posting to your server. You won't be able to do the reverse, again due to the security manager. -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: 24 January 2005 15:22 To: Nathan Coast; Struts Users Mailing List Subject: Re: max file size - validator - javascript At 3:01 PM +0800 1/24/05, Nathan Coast wrote: Hi, Does the validator support max file size for an uploaded file? I have found various threads covering how to specify the max file size and how to check if it is exceeded but this all seems to be server-side and outside of the validator mechanism e.g. http://www.mail-archive.com/user@struts.apache.org/msg12942.html I'm not even sure if it is possible to find the size of a file upload within javascript. Obviously if it isn't possible from javascript, it can't be implemented in the validator (not in the client at least). I don't believe there is any standard client-side mechanism for enforcing something like this. Here's an unauthoritative reference: http://www.cs.tut.fi/~jkorpela/forms/file.html#restr Interestingly, the original File upload RFC (1867) suggested that the meaning of maxlength in a file type input element be used as a hint to the maximum acceptable upload size. However, the HTML 4 spec clearly says that in this context, maxlength refers to the length of the file path (a silly thing to enforce, since the client-side file path should be immaterial to the server.) Furthermore, I would think there would be scoping/timing problems, as before the form is submitted, the browser wouldn't want to fool with the file, because it might be lag-inducing, and once the form is submitted, there's no longer a chance for JavaScript to execute. Seems like a shortcoming of the spec to not permit page authors to specify this in the tag, but it's probably because they didn't want to clutter the input element spec with too many modal details. (Although there is the rarely-used accept element which is supposed to accept an enumeration of permitted MIME types for the upload.) 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: OT newbie - java class question
The answer is to clone the Category object prior to setting the name and add that clone to the IALOutpPut object. I know you have not asked, but I think you might want to make things a bit more readable for others by doing at least something *like* as follows. Your present code is very hard to read, which is an important part of good code. I assume you are fairly new at this game and hope you take this as an attempt to be helpful. If you are a grizzlied veteran with your own ideas, forget what I said. /* This method takes all the Category held in ArrayLists objects from the HashMap category (with a key of liTree.length or greater) and puts them in one master ArrayList (1ALOutPut) after processing their names. */ public ArrayList getCategoriesTree(Integer parentId, HashMap tree, HashMap category) { return listTree(getLiTree(parentId,tree),category); } /* This method gets an array of Integers held in the HashMap tree under the key parentId. */ private Integer [] getLiTree(Integer parentId, HashMap tree) { return (Integer[])tree.get(parentId); } private static ArrayList listTree(Integer [] liTree, HashMap category) { /* The map category holds ArrayLists (which contain Category objects) which are temporarily processed under this alias. The keys are integers relating to the length of liTree. */ ArrayList lALCategories = null; /* This ArrayList holds all the Category objects in all the ArrayLists in category where the key is liTree.length or greater. Prior to putting the Category objects in this extended ArrayList, the names in the Category objects are processed. */ ArrayList lALOutPut = null; Integer liNext = null; Category lCCategory = null; String lsName = null; int treeLength = liTree.length; int arrayLength = 0; for (int i = 0; i treeLength; i++) { liNextKey = liTree[i]; lALCategories = (ArrayList)category.get(liNextKey); arrayLength = 1ALCategories.size(); for (int j = 0; j arrayLength; j++) { lCCategory = (Category)lALCategories.get(j); lsName = lCCategory.getName() /* Some processing here on lsName. */ lCCategory.setName(lsName); lALOutPut.add(lCCategory); } } return lALOutPut; } Jack On Mon, 24 Jan 2005 14:29:21 +0530, Sudheer [EMAIL PROTECTED] wrote: Hi friends, I have a method like this, the 3rd param, category contains ArrayList of classes Category. Here I am copying the Category class from the ArrayList to lALCategories (Line 11) and storing its property name into a local variable lsName (Line15) and doing some processing and writing it back on line 19. Then adding this class to lALOutPut. Here the changes I made to the class property name is reflected in HashMap category also. I don't want the changes to be reflected in the passed HashMap category. How do I do this? Please help. TIA Sudheer 01. public static ArrayList listTree(Integer parentID, HashMap tree, HashMap category) 02. { 03.Category lCCategory = null; 04.ArrayList lALCategories = new ArrayList(), lALOutPut = new ArrayList(); 05.Integer liNext = null; 06.Integer liTree[] = (Integer[]) tree.get(parentID); 07.String lsName = ; 08.for (short liElm = 0; liElm liTree.length; liElm++) 09.{ 10. liNext = liTree[liElm]; 11. lALCategories = (ArrayList) category.get(liNext); 12. for (int liIElm = 0; liIElm lALCategories.size(); liIElm++) 13. { 14.lCCategory = (Category) lALCategories.get(liIElm); 15.lsName = lCCategory.getName() 16./* 17.Some processing here on lsName. 18.*/ 19.lCCategory.setName(lsName); 20.lALOutPut.add(lCCategory); 21. } 22.} 23.return lALOutPut; 24.} -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- 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.
Generic
Hi All, I need help about struts and tiles. I have an application using tiles and I have a jsp page that can be used as output page for several different actions. In this page I'd like to have a link to recall the input action (with different parameters). Something like ActionMapping.getPath() method. The problem is that I don't know how to identify the input action directly into the JSP! In other words, Let's suppose I have 2 actions: action path=/act1 ... forward name=success path=mypage.jsp/ /action action path=/act2 ... forward name=success path=mypage.jsp/ /action How can I get the /act1.do or /act2.do into the JSP page? I have tried request.getRequestURI() but, as I use tiles, I always receive the URI of the main layout page (E.g. /miro/pages/layout/mainLayout.jsp) Thanks for the help, gianpiero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get the input action path?
Hi All, I need help about struts and tiles. I have an application using tiles and I have a jsp page that can be used as output page for several different actions. In this page I'd like to have a link to recall the input action (with different parameters). Something like ActionMapping.getPath() method. The problem is that I don't know how to identify the input action directly into the JSP! In other words, Let's suppose I have 2 actions: action path=/act1 ... forward name=success path=mypage.jsp/ /action action path=/act2 ... forward name=success path=mypage.jsp/ /action How can I get the /act1.do or /act2.do into the JSP page? I have tried request.getRequestURI() but, as I use tiles, I always receive the URI of the main layout page (E.g. /miro/pages/layout/mainLayout.jsp) Thanks for the help, gianpiero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
There will be a request attribute under the name org.apache.struts.action.mapping.instance. Call getPath() on that (after casting to an ActionMapping). I'd take a look around to see if there's a static method somewhere that gets this for you rather than coding the name of the attribute because should it ever change in a future Struts version and you upgrade, your code would break. But, that should work for you now. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, January 24, 2005 10:58 am, Gianpiero Caretti said: Hi All, I need help about struts and tiles. I have an application using tiles and I have a jsp page that can be used as output page for several different actions. In this page I'd like to have a link to recall the input action (with different parameters). Something like ActionMapping.getPath() method. The problem is that I don't know how to identify the input action directly into the JSP! In other words, Let's suppose I have 2 actions: action path=/act1 ... forward name=success path=mypage.jsp/ /action action path=/act2 ... forward name=success path=mypage.jsp/ /action How can I get the /act1.do or /act2.do into the JSP page? I have tried request.getRequestURI() but, as I use tiles, I always receive the URI of the main layout page (E.g. /miro/pages/layout/mainLayout.jsp) Thanks for the help, gianpiero - 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: Generic
On Mon, 24 Jan 2005 16:54:49 +0100, Gianpiero Caretti [EMAIL PROTECTED] wrote: Hi All, I need help about struts and tiles. I have an application using tiles and I have a jsp page that can be used as output page for several different actions. In this page I'd like to have a link to recall the input action (with different parameters). Something like ActionMapping.getPath() method. The problem is that I don't know how to identify the input action directly into the JSP! In other words, Let's suppose I have 2 actions: action path=/act1 ... forward name=success path=mypage.jsp/ /action action path=/act2 ... forward name=success path=mypage.jsp/ /action How can I get the /act1.do or /act2.do into the JSP page? Either get the referer header, which is not always guranteed to be there, or have your actions put the return into a request scope variable. I have tried request.getRequestURI() but, as I use tiles, I always receive the URI of the main layout page (E.g. /miro/pages/layout/mainLayout.jsp) Thanks for the help, gianpiero - 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: How to get the input action path?
[EMAIL PROTECTED] wrote: There will be a request attribute under the name org.apache.struts.action.mapping.instance. Call getPath() on that (after casting to an ActionMapping). It works! Thanks to all, Gianpiero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
Good news! :) FYI, all of my Actions call a common setup function at the start of execute(), and one of the things it does is set an attribute command in the request with the value of getPath() called on the ActionMapping. I use that in JSPs sometimes as you are doing, but I didn't want to worry about the attribute name ever changing. This insulates me from that problem (assuming getPath() is always present of course!) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, January 24, 2005 11:43 am, Gianpiero Caretti said: [EMAIL PROTECTED] wrote: There will be a request attribute under the name org.apache.struts.action.mapping.instance. Call getPath() on that (after casting to an ActionMapping). It works! Thanks to all, Gianpiero - 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: How to get the input action path?
[EMAIL PROTECTED] wrote: FYI, all of my Actions call a common setup function at the start of execute(), and one of the things it does is set an attribute command in the request with the value of getPath() called on the ActionMapping. FYI, that's exactly what I am doing rigth now! As I use Jakarta Velocity I cannot use static fields such as org.apache.struts.Globals.MAPPING_KEY (the constant for org.apache.struts.action.mapping.instance). So I am implementing this solution. The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. If you use jakarta velocity, another easy and probably less restricted solution could be to extend the StrutsLinkTool and register it into toolbox.xml instead of the standar link tool: tool keylink/key scoperequest/scope classyourpackage.MyStrutsLinkTool/class /tool regards, gianpiero MyStrutLinkTool.java Description: java/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
Gianpiero Caretti wrote: If you use jakarta velocity, another easy and probably less restricted solution could be to extend the StrutsLinkTool and register it into toolbox.xml instead of the standar link tool And using into the VM files directly the methods: $link.inputAction and $link.inputActionPath - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can we bounce: bounce@atphypotheken.nl bounce@atphypotheken.nl and info@atphypotheken.nl ??
These sites are littering my mailbox. Can the administrator do something about them. Jack -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- 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]
Re: How to get the input action path?
On Mon, January 24, 2005 12:37 pm, Gianpiero Caretti said: FYI, that's exactly what I am doing rigth now! Great minds think alike :) The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. True enough, but at some point you have to trust those under you. So long as you make this information known, you have to trust that they will use it. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
On Mon, 24 Jan 2005 18:37:35 +0100, Gianpiero Caretti [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: FYI, all of my Actions call a common setup function at the start of execute(), and one of the things it does is set an attribute command in the request with the value of getPath() called on the ActionMapping. FYI, that's exactly what I am doing rigth now! As I use Jakarta Velocity I cannot use static fields such as org.apache.struts.Globals.MAPPING_KEY (the Please take a look at FieldMethodizer, which allows access to static fields from the template http://jakarta.apache.org/velocity/api/org/apache/velocity/app/FieldMethodizer.html constant for org.apache.struts.action.mapping.instance). So I am implementing this solution. The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. If you use jakarta velocity, another easy and probably less restricted solution could be to extend the StrutsLinkTool and register it into toolbox.xml instead of the standar link tool: tool keylink/key scoperequest/scope classyourpackage.MyStrutsLinkTool/class /tool regards, gianpiero - 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: How to get the input action path?
On Mon, 24 Jan 2005 10:05:08 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Mon, January 24, 2005 12:37 pm, Gianpiero Caretti said: FYI, that's exactly what I am doing rigth now! Great minds think alike :) The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. True enough, but at some point you have to trust those under you. So long as you make this information known, you have to trust that they will use it. If they remember, don't get in a hurry or otherwise do something human. Why not do something like private static blah execute(blah) throws Exception { criticalSetupstuff; continueExecute(blah); } protected blah continueExecute(bladh) throws Exception { whatever the execute should do. } That way you can gurantee that anyone inheriting from this action will get the crttical setup stuff. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.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: How to get the input action path?
Gianpiero Caretti wrote: [EMAIL PROTECTED] wrote: FYI, all of my Actions call a common setup function at the start of execute(), and one of the things it does is set an attribute command in the request with the value of getPath() called on the ActionMapping. The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. You can use a custom RequestProcessor instead of a common Action method to make sure your Action writers don't forget to call the setup method. Another trick is to write a base Action class with a final execute method so Action writers can't skip steps: public class MyBaseAction extends Action { public final ActionForward execute(form, mapping, request, response) { initializeRequestAttributes(form, mapping, request, response); return realExecute(form, mapping, request, response); } protected final void initializeRequestAttributes(form, mapping, request, response) { request.setAttribute(command,mapping.getPath()); } protected ActionForward realExecute(form,mapping,request,response) { // this method is what Action developers write } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
I thought of something similar too Jim, but my thought was that now they are coding classes that don't truly adere to the general form of an Action. I would rather have the basic structure remain the same and just make them have to remember to call the setup code. Think of it this way... the more a team veers from standard Struts (or standard anything for that matter!), the more a new team member has to learn and comprehend before they can really be effective. In my mind, a single method call that someone has to remember is better with the idea of swappable human resources in mind than having to learn and understand a new structure for an Action (even if it is very simple, as what you show is). I suppose we could have the best of both worlds if you implement a custom RequestProcessor that looks for some flag attribute in request that is only set from the setup code and redirects to some error page if it's not set. That way, the Actions can remain structured as usual, and if a developer forgets that setup call, they'll know about it right away. But then, that starts to feel like babysitting my developers, and I for one don't do that. I hire those that I have confidence in, and I let them do their thing based on my architectural blueprints. I trust them to get it right, or at least quickly and efficiently fix it if they don't! :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, January 24, 2005 1:15 pm, Jim Barrows said: On Mon, 24 Jan 2005 10:05:08 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Mon, January 24, 2005 12:37 pm, Gianpiero Caretti said: FYI, that's exactly what I am doing rigth now! Great minds think alike :) The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. True enough, but at some point you have to trust those under you. So long as you make this information known, you have to trust that they will use it. If they remember, don't get in a hurry or otherwise do something human. Why not do something like private static blah execute(blah) throws Exception { criticalSetupstuff; continueExecute(blah); } protected blah continueExecute(bladh) throws Exception { whatever the execute should do. } That way you can gurantee that anyone inheriting from this action will get the crttical setup stuff. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the input action path?
On Mon, 24 Jan 2005 10:24:56 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I thought of something similar too Jim, but my thought was that now they are coding classes that don't truly adere to the general form of an Action. I would rather have the basic structure remain the same and just make them have to remember to call the setup code. If you have to revert back to a standard action, just rename the method call, it shoudl be the exact same format as the original execute. Think of it this way... the more a team veers from standard Struts (or standard anything for that matter!), the more a new team member has to learn and comprehend before they can really be effective. In my mind, a single method call that someone has to remember is better with the idea of swappable human resources in mind than having to learn and understand a new structure for an Action (even if it is very simple, as what you show is). Except that a newbie is less likely to remember exceptions like this action has to call a special method first. If a newbie tries to inherit from the final execute, he gets an error, goes to investigate and goes oh.. okay. I suppose we could have the best of both worlds if you implement a custom RequestProcessor that looks for some flag attribute in request that is only set from the setup code and redirects to some error page if it's not set. That way, the Actions can remain structured as usual, and if a developer forgets that setup call, they'll know about it right away. But then, that starts to feel like babysitting my developers, and I for one don't do that. I hire those that I have confidence in, and I let them do their thing based on my architectural blueprints. I trust them to get it right, or at least quickly and efficiently fix it if they don't! :) I trust them to I just excpect them to be human. In addition the less extra stuff they have to remember, the fewer mistakes they can make. If you see code where ti spends most of it's time figuring out exceptions then it does doing work, you probably immediately think Time to refactor. Same thing with processes we have to use when coding. The fewer exceptions I have to think about, the better. In my suggestion, the programmer can forget about what they have to call and the langauge takes care of larting them if they forgeet, and telling them how to fix before they even run a unit test. As for using a custom request processer, that's further afield from standard struts then my suggestion. You could use a filter for the same thing, and not have to worry about what happens when you upgrade struts. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Mon, January 24, 2005 1:15 pm, Jim Barrows said: On Mon, 24 Jan 2005 10:05:08 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Mon, January 24, 2005 12:37 pm, Gianpiero Caretti said: FYI, that's exactly what I am doing rigth now! Great minds think alike :) The only think I don't like with this solution is that the JSP writer has to know the existence of the command attribute into request. Moreover if the Action writer forgot to call the setup method the request attribute will not set. True enough, but at some point you have to trust those under you. So long as you make this information known, you have to trust that they will use it. If they remember, don't get in a hurry or otherwise do something human. Why not do something like private static blah execute(blah) throws Exception { criticalSetupstuff; continueExecute(blah); } protected blah continueExecute(bladh) throws Exception { whatever the execute should do. } That way you can gurantee that anyone inheriting from this action will get the crttical setup stuff. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT]Applet question, open in new JVM
Hi I was working on a Applet in which i had some static methods in a class with some applet data, it was working great untill i had to develop another applet which uses these static methods, now the problem is the data is getting mixed when i open both the applets. i want to know if i can open the second applet in new JVM so it will be a different applet JVM, as if the applet is from 2 different web sites = A$HI$H __ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Select Multiple Issues
I had posted earlier concerning this, and haven't gotten any response, but I think it got lost in all the spirited discussions about constants interfaces, leadership voting, etc. over the past week. I've done a lot of searching, and AFAICT, I'm trying all the right things, but it's still not working... I promise I google'd first I'm trying to use a multiple-select select box, for example: html:select multiple=true property=bar size=5 html:option value=1One/html:option html:option value=2Two/html:option html:option value=3Three/html:option html:option value=4Four/html:option /html:select And I've tried backing my form bean with String[] AND with an ArrayList. When I try to use a String[] as the backing, the form displays, but when I submit, I get an argument type mismatch: DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:876) setProperty([EMAIL PROTECTED], bar, [2,4,8]) DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:418) Convert string '2' to class 'java.lang.String' DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:426) Using converter [EMAIL PROTECTED] DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1756) setSimpleProperty: Invoking method public void com.boa.cis.portal.forms.FooForm.setBar(java.lang.String[]) with value 2 (class java.lang.String) ERROR 2005-01-19 10:51:56 org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1777) Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch It looks like it's iterating through the values, calling a simple String set on each one. So I tried backing with an array list, like so: package com.boa.cis.portal.forms; import java.util.ArrayList; import org.apache.struts.action.ActionForm; public class FooForm extends ActionForm { private ArrayListString bar; public FooForm() { bar = new ArrayListString(); } public String getBar(int index) { return this.bar.get(index); } public String[] getBar() { return (String[])this.bar.toArray(); } public void setBar(int index, String bar) { this.bar.set(index,bar); } public void setBar(String[] bar) { this.bar.clear(); for (int i = 0; i bar.length; i++) { this.bar.set(i,bar[i]); } } public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { bar = new ArrayListString(); super.reset(mapping, request); } } But that won't even render the form - I get a ClassCastException: ERROR 2005-01-19 10:58:58 org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:918) ServletException in 'foo.jsp': Getter for property bar threw exception: java.lang.ClassCastException: [Ljava.lang.Object; javax.servlet.ServletException: Getter for property bar threw exception: java.lang.ClassCastException: [Ljava.lang.Object; at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) I'm using Struts 1.2.6. From all I can tell of the error reporting, is that possibly the Struts taglib is not using the multiple=true property the way it ought, so it doesn't think it's supposed to be looking for an array type from the getter method on my form bean. Has anybody had any success with this? Thanks Will - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Select Multiple Issues
I have ActionForm's that contain String array variables like: private String[] parmTypeCd = null; With the normal: public String[] getParmTypeCd() { return parmTypeCd; } public void setParmTypeCd(String parmTypeCd[]) { this.parmTypeCd = parmTypeCd; } My form has: html:select property=parmTypeCd multiple=true size=3 html:option value=1Value1/html:option html:option value=2Value2/html:option ... /html:select Then, underneath I build my ArrayList to pass to my iBatis query like: ArrayList parmTypeCds = null; if(form.getParmTypeCd() != null form.getParmTypeCd().length 0) { parmTypeCds = new ArrayList(); String typeCds[] = form.getParmTypeCd(); for(int i=0; iform.getParmTypeCd().length; i++) { parmTypeCds.add(typeCds[i]); } } Pretty simple. There may be a better way to do it, but this works just fine for me. --Brad -Original Message- From: Will Stranathan [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 3:11 PM To: user@struts.apache.org Subject: Select Multiple Issues I had posted earlier concerning this, and haven't gotten any response, but I think it got lost in all the spirited discussions about constants interfaces, leadership voting, etc. over the past week. I've done a lot of searching, and AFAICT, I'm trying all the right things, but it's still not working... I promise I google'd first I'm trying to use a multiple-select select box, for example: html:select multiple=true property=bar size=5 html:option value=1One/html:option html:option value=2Two/html:option html:option value=3Three/html:option html:option value=4Four/html:option /html:select And I've tried backing my form bean with String[] AND with an ArrayList. When I try to use a String[] as the backing, the form displays, but when I submit, I get an argument type mismatch: DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:87 6) setProperty([EMAIL PROTECTED], bar, [2,4,8]) DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java: 418) Convert string '2' to class 'java.lang.String' DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java: 426) Using converter [EMAIL PROTECTED] DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUti lsBean.java:1756) setSimpleProperty: Invoking method public void com.boa.cis.portal.forms.FooForm.setBar(java.lang.String[]) with value 2 (class java.lang.String) ERROR 2005-01-19 10:51:56 org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBea n.java:1777) Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch It looks like it's iterating through the values, calling a simple String set on each one. So I tried backing with an array list, like so: package com.boa.cis.portal.forms; import java.util.ArrayList; import org.apache.struts.action.ActionForm; public class FooForm extends ActionForm { private ArrayListString bar; public FooForm() { bar = new ArrayListString(); } public String getBar(int index) { return this.bar.get(index); } public String[] getBar() { return (String[])this.bar.toArray(); } public void setBar(int index, String bar) { this.bar.set(index,bar); } public void setBar(String[] bar) { this.bar.clear(); for (int i = 0; i bar.length; i++) { this.bar.set(i,bar[i]); } } public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { bar = new ArrayListString(); super.reset(mapping, request); } } But that won't even render the form - I get a ClassCastException: ERROR 2005-01-19 10:58:58 org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja va:918) ServletException in 'foo.jsp': Getter for property bar threw exception: java.lang.ClassCastException: [Ljava.lang.Object; javax.servlet.ServletException: Getter for property bar threw exception: java.lang.ClassCastException: [Ljava.lang.Object; at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI mpl.java:825) I'm using Struts 1.2.6. From all I can tell of the error reporting, is that possibly the Struts taglib is not using the multiple=true property the way it ought, so it doesn't think it's supposed to be looking for an array type from the getter method on my form bean. Has anybody had any success with this? Thanks Will - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT]Applet question, open in new JVM
On Mon, 24 Jan 2005 12:57:49 -0800 (PST), Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi I was working on a Applet in which i had some static methods in a class with some applet data, it was working great untill i had to develop another applet which uses these static methods, now the problem is the data is getting mixed when i open both the applets. i want to know if i can open the second applet in new JVM so it will be a different applet JVM, as if the applet is from 2 different web sites U... this isn't Struts related. The answer I believe is no. You would haev to tell the browser to use a different VM, and that would be browser specific I would think. = A$HI$H __ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 - 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: Select Multiple Issues
THANKS! After all that work, I *think* BeanUtils was having issues with setNumber(int, String) for some reason - when I took out the setters for indexed values, and just have setters/getters for the arrays - it works like a champ! Thanks a TON! Will Stranathan On Mon, 24 Jan 2005 15:16:55 -0600 Brad Balmer [EMAIL PROTECTED] wrote: I have ActionForm's that contain String array variables like: private String[] parmTypeCd = null; With the normal: public String[] getParmTypeCd() { return parmTypeCd; } public void setParmTypeCd(String parmTypeCd[]) { this.parmTypeCd = parmTypeCd; } My form has: html:select property=parmTypeCd multiple=true size=3 html:option value=1Value1/html:option html:option value=2Value2/html:option ... /html:select Then, underneath I build my ArrayList to pass to my iBatis query like: ArrayList parmTypeCds = null; if(form.getParmTypeCd() != null form.getParmTypeCd().length 0) { parmTypeCds = new ArrayList(); String typeCds[] = form.getParmTypeCd(); for(int i=0; iform.getParmTypeCd().length; i++) { parmTypeCds.add(typeCds[i]); } } Pretty simple. There may be a better way to do it, but this works just fine for me. --Brad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Select Multiple Issues
On Mon, 24 Jan 2005 15:16:55 -0600, Brad Balmer [EMAIL PROTECTED] wrote: I have ActionForm's that contain String array variables like: private String[] parmTypeCd = null; With the normal: public String[] getParmTypeCd() { return parmTypeCd; } public void setParmTypeCd(String parmTypeCd[]) { this.parmTypeCd = parmTypeCd; } My form has: html:select property=parmTypeCd multiple=true size=3 html:option value=1Value1/html:option html:option value=2Value2/html:option ... /html:select Then, underneath I build my ArrayList to pass to my iBatis query like: ArrayList parmTypeCds = null; if(form.getParmTypeCd() != null form.getParmTypeCd().length 0) { parmTypeCds = new ArrayList(); String typeCds[] = form.getParmTypeCd(); for(int i=0; iform.getParmTypeCd().length; i++) { parmTypeCds.add(typeCds[i]); } } Pretty simple. There may be a better way to do it, but this works just fine for me. And your not usinng the generics package like Will is. --Brad -Original Message- From: Will Stranathan [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 3:11 PM To: user@struts.apache.org Subject: Select Multiple Issues I had posted earlier concerning this, and haven't gotten any response, but I think it got lost in all the spirited discussions about constants interfaces, leadership voting, etc. over the past week. I've done a lot of searching, and AFAICT, I'm trying all the right things, but it's still not working... I promise I google'd first I'm trying to use a multiple-select select box, for example: html:select multiple=true property=bar size=5 html:option value=1One/html:option html:option value=2Two/html:option html:option value=3Three/html:option html:option value=4Four/html:option /html:select And I've tried backing my form bean with String[] AND with an ArrayList. When I try to use a String[] as the backing, the form displays, but when I submit, I get an argument type mismatch: DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:87 6) setProperty([EMAIL PROTECTED], bar, [2,4,8]) DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java: 418) Convert string '2' to class 'java.lang.String' DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java: 426) Using converter [EMAIL PROTECTED] DEBUG 2005-01-19 10:51:56 org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUti lsBean.java:1756) setSimpleProperty: Invoking method public void com.boa.cis.portal.forms.FooForm.setBar(java.lang.String[]) with value 2 (class java.lang.String) ERROR 2005-01-19 10:51:56 org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBea n.java:1777) Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch It looks like it's iterating through the values, calling a simple String set on each one. So I tried backing with an array list, like so: package com.boa.cis.portal.forms; import java.util.ArrayList; import org.apache.struts.action.ActionForm; public class FooForm extends ActionForm { private ArrayListString bar; public FooForm() { bar = new ArrayListString(); } public String getBar(int index) { return this.bar.get(index); } public String[] getBar() { return (String[])this.bar.toArray(); } public void setBar(int index, String bar) { this.bar.set(index,bar); } public void setBar(String[] bar) { this.bar.clear(); for (int i = 0; i bar.length; i++) { this.bar.set(i,bar[i]); } } public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { bar = new ArrayListString(); super.reset(mapping, request); } } But that won't even render the form - I get a ClassCastException: ERROR 2005-01-19 10:58:58 org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja va:918) ServletException in 'foo.jsp': Getter for property bar threw exception: java.lang.ClassCastException: [Ljava.lang.Object; javax.servlet.ServletException: Getter for property bar threw exception: java.lang.ClassCastException: [Ljava.lang.Object; at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI mpl.java:825) I'm using Struts 1.2.6. From all I can tell of the error reporting, is that possibly the Struts taglib is not using the multiple=true property the way it ought, so it doesn't think it's supposed to be looking for an array type from the getter method on my form bean. Has anybody had any success with this? Thanks Will - To
Re: Select Multiple Issues
It's related to a difference in how the HTTP request parameters are built. With the indexed properties that you had, the BeanUtils classes are going to look for parameters whose names include the index. That is 'bar[1]', 'bar[2]', etc. HTML:select with multiple=true sends multiple parameters, all with the name of 'bar'. So, instead of 'bar[1]=1bar[2]=2' the HTTP request will just be 'bar=1bar=2'. The Java Servlet API exposes these multiple requests with the same name as a String[], or the first one as a single String. The only time the Struts ActionForm framework is going to call an ActionForm setter 'setBar(int index, String value)' is if the request includes parameters named as in the first example. It will call the setter 'setBar(String[] values)' if it sees multiple values for the same parameter. -- Jeff Will Stranathan wrote: THANKS! After all that work, I *think* BeanUtils was having issues with setNumber(int, String) for some reason - when I took out the setters for indexed values, and just have setters/getters for the arrays - it works like a champ! Thanks a TON! Will Stranathan On Mon, 24 Jan 2005 15:16:55 -0600 Brad Balmer [EMAIL PROTECTED] wrote: I have ActionForm's that contain String array variables like: private String[] parmTypeCd = null; With the normal: public String[] getParmTypeCd() { return parmTypeCd; } public void setParmTypeCd(String parmTypeCd[]) { this.parmTypeCd = parmTypeCd; } My form has: html:select property=parmTypeCd multiple=true size=3 html:option value=1Value1/html:option html:option value=2Value2/html:option ... /html:select Then, underneath I build my ArrayList to pass to my iBatis query like: ArrayList parmTypeCds = null; if(form.getParmTypeCd() != null form.getParmTypeCd().length 0) { parmTypeCds = new ArrayList(); String typeCds[] = form.getParmTypeCd(); for(int i=0; iform.getParmTypeCd().length; i++) { parmTypeCds.add(typeCds[i]); } } Pretty simple. There may be a better way to do it, but this works just fine for me. --Brad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best practice for dynamic Title values using Tiles?
I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. Thanks -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Select Multiple Issues
Well, I understand the way HTTP is working there, it just SEEMS to be that having the additional method (setBar(int, String)) confused BeanUtils or something - because removing those methods (making no other changes) cleared the problem up. w On Mon, 24 Jan 2005 17:15:01 -0500 Jeff Beal [EMAIL PROTECTED] wrote: It's related to a difference in how the HTTP request parameters are built. With the indexed properties that you had, the BeanUtils classes are going to look for parameters whose names include the index. That is 'bar[1]', 'bar[2]', etc. HTML:select with multiple=true sends multiple parameters, all with the name of 'bar'. So, instead of 'bar[1]=1bar[2]=2' the HTTP request will just be 'bar=1bar=2'. The Java Servlet API exposes these multiple requests with the same name as a String[], or the first one as a single String. The only time the Struts ActionForm framework is going to call an ActionForm setter 'setBar(int index, String value)' is if the request includes parameters named as in the first example. It will call the setter 'setBar(String[] values)' if it sees multiple values for the same parameter. -- Jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Select Multiple Issues
From: Will Stranathan [EMAIL PROTECTED] Well, I understand the way HTTP is working there, it just SEEMS to be that having the additional method (setBar(int, String)) confused BeanUtils or something - because removing those methods (making no other changes) cleared the problem up. Your original code violated the JavaBeans specification-- you're only allowed one pair of get/set methods, and the types have to match. (Boolean properties have slightly different rules.) Any additional methods will, as you found out, confuse the introspection process. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Best practice for dynamic Title values using Tiles?
Rick, Did you consider making your Action a TilesAction so you can put the title into the context however you want? That way, if you do a CRUD methodology, you could do a context.putAttribute(title,new String(Edit)); or Add depending on your Action's CRUD method. Heck, you could also do that to the body attribute and change a JSP inserted into the middle of your template. You could have a definition look like this: definition name=.generic path=/WEB-INF/pages/common.jsp put name=title value=Default Value / put name=body value=/WEB-INF/pages/default-center.jsp / /definition Then, in the extreme, all of your actions could se the title and their own body choice. Viola! One template fits all! Regards, David -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 5:18 PM To: Struts Users Mailing List Subject: Best practice for dynamic Title values using Tiles? I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. Thanks -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Redirecting to outside the webapp
Hello All, Long time lurker, first time poster. I'm trying integrate our Java Struts webapplication with an existing web app. After logging into the Java site, I want to redirect to outside the webapp, but struts keeps prepending the webapp name. For example. in my struts-config.xml I have the following: action path=/LoginSubmit name=loginForm scope=request validate=false input=/WEB-INF/pages/common/login.jsp type=com.company.frontend.action.LoginAction forward name=success path=/index.pxt redirect=true / forward name=failure path=/WEB-INF/pages/common/login.jsp / /action I want to be sent to http://hostname/index.pxt after the LoginSubmit action has been executed. But we always get sent to http://hostname/webappname/index.pxt which causes a 404. Is there anyway to get out of the webapp either through configuration or through customization? Sincerely, Jesus Rodriguez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirecting to outside the webapp
From: Jesus M. Rodriguez [EMAIL PROTECTED] I want to be sent to http://hostname/index.pxt after the LoginSubmit action has been executed. But we always get sent to http://hostname/webappname/index.pxt which causes a 404. IIRC, from execute you can either create your own ActionForward (rather than looking it up from the ActionMapping) and return it, or just do the redirect yourself and return null. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirecting to outside the webapp
If you create your own ActionForward, and you redirect with a string that starts with /, the result will still be the same. You can either do the redirect yourself as Wendy suggested or put the entire URL on the path you've configured: forward name=success path=http://hostname/index.pxt; redirect=true/ Hubert On Mon, 24 Jan 2005 16:37:03 -0700, Wendy Smoak [EMAIL PROTECTED] wrote: From: Jesus M. Rodriguez [EMAIL PROTECTED] I want to be sent to http://hostname/index.pxt after the LoginSubmit action has been executed. But we always get sent to http://hostname/webappname/index.pxt which causes a 404. IIRC, from execute you can either create your own ActionForward (rather than looking it up from the ActionMapping) and return it, or just do the redirect yourself and return null. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: upgrading from 1.1 to 1.2.6 -- any guides?
There are 1.1 to 1.2.4 Upgrade notes which should also work for 1.1 to 1.2.6: http://wiki.apache.org/struts/StrutsUpgradeNotes11to124 The only additional things for 1.2.6 (as far as I know) is that the dependencies for Struts changed - so make sure you also upgrade to BeanUtils 1.7.0 and Digester 1.6. I put some notes on 1.2.6 here: http://www.niallp.pwp.blueyonder.co.uk/strutsversion.html Niall - Original Message - From: Dakota Jack [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, January 23, 2005 6:18 AM Subject: upgrading from 1.1 to 1.2.6 -- any guides? Are there any guides for upgrading from 1.1 to 1.2.6? I did what should be obvious and had no success. Jack -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- 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: OT newbie - Thanks eveybody
Hi, Thank u very much for all the support and your valuable advise. Sudheer -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 9:21 PM To: Struts Users Mailing List Subject: Re: OT newbie - java class question The answer is to clone the Category object prior to setting the name and add that clone to the IALOutpPut object. I know you have not asked, but I think you might want to make things a bit more readable for others by doing at least something *like* as follows. Your present code is very hard to read, which is an important part of good code. I assume you are fairly new at this game and hope you take this as an attempt to be helpful. If you are a grizzlied veteran with your own ideas, forget what I said. /* This method takes all the Category held in ArrayLists objects from the HashMap category (with a key of liTree.length or greater) and puts them in one master ArrayList (1ALOutPut) after processing their names. */ public ArrayList getCategoriesTree(Integer parentId, HashMap tree, HashMap category) { return listTree(getLiTree(parentId,tree),category); } /* This method gets an array of Integers held in the HashMap tree under the key parentId. */ private Integer [] getLiTree(Integer parentId, HashMap tree) { return (Integer[])tree.get(parentId); } private static ArrayList listTree(Integer [] liTree, HashMap category) { /* The map category holds ArrayLists (which contain Category objects) which are temporarily processed under this alias. The keys are integers relating to the length of liTree. */ ArrayList lALCategories = null; /* This ArrayList holds all the Category objects in all the ArrayLists in category where the key is liTree.length or greater. Prior to putting the Category objects in this extended ArrayList, the names in the Category objects are processed. */ ArrayList lALOutPut = null; Integer liNext = null; Category lCCategory = null; String lsName = null; int treeLength = liTree.length; int arrayLength = 0; for (int i = 0; i treeLength; i++) { liNextKey = liTree[i]; lALCategories = (ArrayList)category.get(liNextKey); arrayLength = 1ALCategories.size(); for (int j = 0; j arrayLength; j++) { lCCategory = (Category)lALCategories.get(j); lsName = lCCategory.getName() /* Some processing here on lsName. */ lCCategory.setName(lsName); lALOutPut.add(lCCategory); } } return lALOutPut; } Jack On Mon, 24 Jan 2005 14:29:21 +0530, Sudheer [EMAIL PROTECTED] wrote: Hi friends, I have a method like this, the 3rd param, category contains ArrayList of classes Category. Here I am copying the Category class from the ArrayList to lALCategories (Line 11) and storing its property name into a local variable lsName (Line15) and doing some processing and writing it back on line 19. Then adding this class to lALOutPut. Here the changes I made to the class property name is reflected in HashMap category also. I don't want the changes to be reflected in the passed HashMap category. How do I do this? Please help. TIA Sudheer 01. public static ArrayList listTree(Integer parentID, HashMap tree, HashMap category) 02. { 03.Category lCCategory = null; 04.ArrayList lALCategories = new ArrayList(), lALOutPut = new ArrayList(); 05.Integer liNext = null; 06.Integer liTree[] = (Integer[]) tree.get(parentID); 07.String lsName = ; 08.for (short liElm = 0; liElm liTree.length; liElm++) 09.{ 10. liNext = liTree[liElm]; 11. lALCategories = (ArrayList) category.get(liNext); 12. for (int liIElm = 0; liIElm lALCategories.size(); liIElm++) 13. { 14.lCCategory = (Category) lALCategories.get(liIElm); 15.lsName = lCCategory.getName() 16./* 17.Some processing here on lsName. 18.*/ 19.lCCategory.setName(lsName); 20.lALOutPut.add(lCCategory); 21. } 22.} 23.return lALOutPut; 24.} -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- 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
Re: Best practice for dynamic Title values using Tiles?
Rick Reumann wrote: I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. If you already have an action parameter or somesuch on the form, you can just use that -- e.g.: tiles:put name='title' type=string logic:equal name=bookForm property=action scope=request value=Create bean:message key=book.title.create/ /logic:equal logic:equal name=bookForm property=action scope=request value=Update bean:message key=book.title.update/ /logic:equal /tiles:put May not be the best, but keeps display stuff separate. Phil Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best practice for dynamic Title values using Tiles?
You need to send some parameter to the page in order to determine what to display. The determination logic can be put into tile controller class. Phil Steitz wrote: Rick Reumann wrote: I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. If you already have an action parameter or somesuch on the form, you can just use that -- e.g.: tiles:put name='title' type=string logic:equal name=bookForm property=action scope=request value=Create bean:message key=book.title.create/ /logic:equal logic:equal name=bookForm property=action scope=request value=Update bean:message key=book.title.update/ /logic:equal /tiles:put May not be the best, but keeps display stuff separate. Phil Thanks - 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]
Validation is not working for me
It looks like they are set-up, but nothing happens. It goes right into my dispatch action method. If I submit the form with nothing entered, it goes into the add method. It was working last night, but Here is my form action: (it works) watchActionAdd.do?method=add Here is the form declaration: action path=/watchActionAdd parameter=method type=com.appriss.jxportal.watch.WatchAction name=watchForm scope=request validate=true input=/watch/watchAdd.jsp forward name=watchView path=/watch/watchView.jsp contextRelative=true/ /action Here is the validation declaration: formset form name=watchForm field property=lastName depends=required,minlength arg0 key=lastName/ arg1 name=minlength key=${var:minlength} resource=false/ var var-nameminlength/var-name var-value2/var-value /var /field field property=firstName depends=required,minlength arg0 key=firstName/ /field field property=dobBegin depends=date arg0 key=dobBegin/ var var-namedatePattern/var-name var-valueMM/dd//var-value /var /field /form /formset It acts as if there is no validation turned on. = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LazyValidatorForm incompatible with using dot separated, etc., method indicators
Using nested properties can be an issue with LazyDynaBeans (but it can also be an issue using a POJO Beans or regular DynaBeans). Say you have a property named foo.bar - in order to set this value BeanUtils populate method will try to do the following: * call the get(foo) method to retrieve the foo property * call the set(bar, value) method on the foo object to set the value If the foo property doesn't exist in your LazyDynaBean then it will return null and you get the NestedNullException you're seeing. The usual way to resolve this would be (if you have a Foo class which has a default empty constructor) to define the foo property for your LazyValidatorForm in your struts-config: form-bean name=... type=org.apache.struts.validator.LazyValidatorForm form-property name=foo type=myPackage.Foo/ /form-bean or use a LazyDynaBean for the foo property form-bean name=... type=org.apache.struts.validator.LazyValidatorForm form-property name=foo type=org.apache.commons.beanutils.LazyDynaBean/ /form-bean LazyValidatorForm will try and instantiate the foo property for you. I'm not sure why you're getting the No bean specified error - looks to me like the ActionForm you're passing to BeanUtils populate() is null - check your logs to see if there are errors instantiating the ActionForm. Niall - Original Message - From: Dakota Jack [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Sunday, January 23, 2005 8:07 AM Subject: LazyValidatorForm incompatible with using dot separated, etc., method indicators I have discovered that LazyValidatorForm is incompatible with using a dot separated name to pass on information about which submit method is used. E.g. property='webmasterHostsOptions.method' in html:image will get the following exception: http-error org.apache.commons.beanutils.NestedNullException: Null property value for 'webmasterHostsOptions' org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUti lsBean.java:669) org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean .java:715) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:88 4) org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) /http-error If I change this to property='webmasterHostsOptions-*-method', then I get: http-error java.lang.IllegalArgumentException: No bean specified org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(Propert yUtilsBean.java:751) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:93 7) org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) /http-error Anyone know what bean this is talking about? I can go through the process, of course, but if someone has a quick answer, that would be appreciated. Jack - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where is the Struts 1.2.6 API for taglibs?
Sorry, late to this discussion. One thought from this (and oither) thread - did you upgrade BeanUtils to version 1.7.0? LazyValidatorForm depends on LazyDynaBean which is only in Version 1.7.0 of BeanUtils. What makes me think that is it doesn't seem that LazyValidator form works for you in any way - if it can't find the class then there should be errors logged. Wendy is right (I think) - if its a DynaBean then BeanUtils should ignore any regular properties youve added and just use the DynaBean get/set methods. Rather than extending LazyValidatorForm, you could define these as beans in the struts-config - then LazyValidatorForm should try and instantiate them: form-bean name=... type=org.apache.struts.validator.LazyValidatorForm form-property name=adminFormtype=mypackage.AdminForm/ form-property name=chatFormtype=mypackage.ChatForm/ /form-bean Niall - Original Message - From: Dakota Jack [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, January 24, 2005 6:25 AM Subject: Re: Where is the Struts 1.2.6 API for taglibs? I have the impression taht LazyValidatorForm was a little different and allowed us to use it in conjunction with a regular ActionForm, so I had my AdminForm, ChatForm, etc. subclasses of LazyValidatorForm. I am thinking of a different solution, including maybe a subclass of html:select that does what I need. Jack On Sun, 23 Jan 2005 22:04:35 -0700, Wendy Smoak [EMAIL PROTECTED] wrote: From: Dakota Jack [EMAIL PROTECTED] If I use the code and LazyValidatorForm, then I get no HTML because it bails because of LazyValidatorForm. You really need to post the exact error messages. This isn't going to be a drop-in solution. Just as in moving from ActionForm to DynaActionForm, you have to change how you define [or not in this case] and access the form properties. http://struts.apache.org/userGuide/building_controller.html#dyna_action_form_classes However, you cannot mix conventional properties and DynaProperties. A conventional getter or setter on a DynaActionForm won't be found by the reflection utilities. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- 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]
[OT] Re: Best practice for dynamic Title values using Tiles?
Hello Rick. Happy New Year to you. I'm just curious. Why are you switching? I remember you advocating Sitemesh (I think it was on your site) instead of Tiles at some point. I haven't tried either one yet, but was going to try Sitemesh based largely on your recommendation, next time I saw a good opportunity. So far I haven't needed a layout framework, but I've gotta catch up with the times at some point . . . Erik Rick Reumann wrote: I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Re: Best practice for dynamic Title values using Tiles?
+1 on Erik's request. I sometimes go about things the wrong way. I was thinking I should use SiteMesh to figure out which HTML page to use as the final layout for each virtual host (the SiteMesh decorator I'm going to write will figure that out and make sure it exists) OR use tiles with div's plus a CSS to lay out the locations of the divs. The SiteMesh option will work with older browsers who aren't handy with CSS but the tiles+div+CSS option would be much more modern. I could then use tiles to change the CSS if someone wanted a more printable layout (i.e. hide ads or other un-printer friendly components). This makes me curious about what shortcoming you found in SiteMesh related to your particular project. Regards, David -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Monday, January 24, 2005 10:47 PM To: Struts Users Mailing List Subject: [OT] Re: Best practice for dynamic Title values using Tiles? Hello Rick. Happy New Year to you. I'm just curious. Why are you switching? I remember you advocating Sitemesh (I think it was on your site) instead of Tiles at some point. I haven't tried either one yet, but was going to try Sitemesh based largely on your recommendation, next time I saw a good opportunity. So far I haven't needed a layout framework, but I've gotta catch up with the times at some point . . . Erik Rick Reumann wrote: I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. Thanks - 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: Select Multiple Issues
Nope, actually, it is bean-utils that is at fault here (something all struts developers should be accustomed to saying - IMO, bean-utils is the single weakest component in struts). According to the javabeans specification (http://java.sun.com/products/javabeans/docs/spec.html), indexed properties should look like this: 1) void setter(int index, PropertyType value); // indexed setter 2) PropertyType getter(int index); // indexed getter 3) void setter(PropertyType values[]); // array setter 4) PropertyType[] getter(); // array getter But the last time I looked, bean-utils never used the indexed getter/setter methods (#1 or #2) - in fact, it never even called the array setter (#3). Instead, it got a reference to the array by calling method #4, and set the elements in it directly. Larry On Mon, 24 Jan 2005 15:39:44 -0700, Wendy Smoak [EMAIL PROTECTED] wrote: From: Will Stranathan [EMAIL PROTECTED] Well, I understand the way HTTP is working there, it just SEEMS to be that having the additional method (setBar(int, String)) confused BeanUtils or something - because removing those methods (making no other changes) cleared the problem up. Your original code violated the JavaBeans specification-- you're only allowed one pair of get/set methods, and the types have to match. (Boolean properties have slightly different rules.) Any additional methods will, as you found out, confuse the introspection process. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to add your own validation + make use of existing validator
I am using validator framework. But for some business logic - i need to some other validation depending on some conditions. I want to keep validation of validator framework as it is + after that i want to add my own. First of all is it possible If yes, then how ? regards Manisha - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
[ANN] Expresso 5.6 Released
The Expresso team is proud to announce the newest release of its Struts based architectural framework. See the press release at: http://www.jcorporate.com/html/news/Press/ExpressoRelease5.6.html Expresso 5.6 release reflects over 1000 cvs code commits. This release integrates several new open source packages, and offers feature improvements, package updates, code cleanup, bug fixes as well as JavaDoc and documentation updates. Download freely from: http://www.jcorporate.com/expresso.html Download link (both Expresso source and binaries available). Highlights of the Expresso 5.6 release include: - Struts Validator Integration - Velocity supports the view. - Maven integration - Better Tiles support - Stored Procedure Support - New JDK 1.4 and Servlet 2.3 Requirements - 35 bug fixes - Expresso Developer's Guide has been substantially updated - Updated Weblog Example and Tutorial available at: http://www.jcorporate.com/examples.html Downloads link - and much more including performance improvements, feature improvements, many PMD Code Violations fixed, updated javadocs etc. You can find a more complete overview on the Release notes: http://www.jcorporate.com/expresso/doc/release.html. Please refer to the Change log for the complete list: http://www.jcorporate.com/econtent/Content.do? state=resourceresource=798. Expresso 5.6 is also now complemented by: - Jcorporate's Professional Services Team at http://www.jcorporate.com/html/services/team.html - Premium Support and Development Services: http://www.jcorporate.com/html/services/servicesfm.html - Expresso WebServices component NOW **FREE** to all Expresso Premium Support customers. - Migration Services to bring your application current to 5.6 is now available. Please contact Mike Traum ([EMAIL PROTECTED]) for more information. - Expresso 5.6 Training Courses are now available: http://www.jcorporate.com/html/services/training.html Please contact Raul Davidovich ([EMAIL PROTECTED]) for more information. Special thanks for this release go to Expresso's developers Michael Traum (Lead Developer), Michael Rimov, Larry Hamel, Peter Pilgrim, Raul Davidovich, David Lloyd, Yves Henri Amaizo, Malcolm Wise, Sandra Cann, and all others who contributed to make Expresso a great product. If it has been some time since you evaluated Expresso, please consider doing so again. Expresso is a popular open source architectural J2EE framework comprising application development components which extends Struts for developing database-driven web applications. Expresso has about 170,000 downloads and over 34,000 registered developers. Regards Sandra Cann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Select Multiple Issues
From: Larry Meadors [EMAIL PROTECTED] Nope, actually, it is bean-utils that is at fault here (something all struts developers should be accustomed to saying - IMO, bean-utils is the single weakest component in struts). I stand corrected, it even _says_ (8.3.3) that 'an indexed property might be represented by four accessor methods.' So your code was correct, sorry! Personally, I've never gotten anything but grief from having more than a single pair of methods. Then again... all of my 'bean' experience is with Struts and by extension, BeanUtils. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation is not working for me
On Mon, 24 Jan 2005 18:38:18 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: It looks like they are set-up, but nothing happens. It goes right into my dispatch action method. If I submit the form with nothing entered, it goes into the add method. It was working last night, but I would check the following things: * Make sure that the validation plugin is defined * Make sure that watchForm extends ValidatorForm and not ValidatorActionForm * Make sure that the validate method calls the super.validate() and takes the errors into account, if the validate method is overridden Here is my form action: (it works) watchActionAdd.do?method=add Here is the form declaration: action path=/watchActionAdd parameter=method type=com.appriss.jxportal.watch.WatchAction name=watchForm scope=request validate=true input=/watch/watchAdd.jsp forward name=watchView path=/watch/watchView.jsp contextRelative=true/ /action Here is the validation declaration: formset form name=watchForm field property=lastName depends=required,minlength arg0 key=lastName/ arg1 name=minlength key=${var:minlength} resource=false/ var var-nameminlength/var-name var-value2/var-value /var /field field property=firstName depends=required,minlength arg0 key=firstName/ /field field property=dobBegin depends=date arg0 key=dobBegin/ var var-namedatePattern/var-name var-valueMM/dd//var-value /var /field /form /formset It acts as if there is no validation turned on. = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] Expresso 5.6 Released
Hi friends , Could somebody give some feedback on Expresso 5.6 , if they have used or evaluated the product ... Does it really helps to shift to this framework ..? Has it overcome some problems faced by struts ..? Is it equally flexible as struts where we can modify some source ( Like requestprocessors , action classes , etc..) according to our own needs ? Thanks in Advance .. cheers , Sachin Hegde Paradyne Infotech Limited , Mumbai 09324546711 -- Original Message --- From: Sandra Cann [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Mon, 24 Jan 2005 23:43:27 -0500 Subject: [ANN] Expresso 5.6 Released The Expresso team is proud to announce the newest release of its Struts based architectural framework. See the press release at: http://www.jcorporate.com/html/news/Press/ExpressoRelease5.6.html Expresso 5.6 release reflects over 1000 cvs code commits. This release integrates several new open source packages, and offers feature improvements, package updates, code cleanup, bug fixes as well as JavaDoc and documentation updates. Download freely from: http://www.jcorporate.com/expresso.html Download link (both Expresso source and binaries available). Highlights of the Expresso 5.6 release include: - Struts Validator Integration - Velocity supports the view. - Maven integration - Better Tiles support - Stored Procedure Support - New JDK 1.4 and Servlet 2.3 Requirements - 35 bug fixes - Expresso Developer's Guide has been substantially updated - Updated Weblog Example and Tutorial available at: http://www.jcorporate.com/examples.html Downloads link - and much more including performance improvements, feature improvements, many PMD Code Violations fixed, updated javadocs etc. You can find a more complete overview on the Release notes: http://www.jcorporate.com/expresso/doc/release.html. Please refer to the Change log for the complete list: http://www.jcorporate.com/econtent/Content.do? state=resourceresource=798. Expresso 5.6 is also now complemented by: - Jcorporate's Professional Services Team at http://www.jcorporate.com/html/services/team.html - Premium Support and Development Services: http://www.jcorporate.com/html/services/servicesfm.html - Expresso WebServices component NOW **FREE** to all Expresso Premium Support customers. - Migration Services to bring your application current to 5.6 is now available. Please contact Mike Traum ([EMAIL PROTECTED]) for more information. - Expresso 5.6 Training Courses are now available: http://www.jcorporate.com/html/services/training.html Please contact Raul Davidovich ([EMAIL PROTECTED]) for more information. Special thanks for this release go to Expresso's developers Michael Traum (Lead Developer), Michael Rimov, Larry Hamel, Peter Pilgrim, Raul Davidovich, David Lloyd, Yves Henri Amaizo, Malcolm Wise, Sandra Cann, and all others who contributed to make Expresso a great product. If it has been some time since you evaluated Expresso, please consider doing so again. Expresso is a popular open source architectural J2EE framework comprising application development components which extends Struts for developing database-driven web applications. Expresso has about 170,000 downloads and over 34,000 registered developers. Regards Sandra Cann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- End of Original Message --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fw: Sorting
Please ask on the user list. The dev list is for issues with the actual framework, not how to use it. Thanks. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: Suzy Fynes [EMAIL PROTECTED] To: dev@struts.apache.org Sent: Monday, January 24, 2005 8:53 AM Subject: Sorting Hi, Can anyone suggest the best way to order data in a JSP (from mysql database) using struts? i.e. list of names and address, can click a column to order by first name, or last name or address etc Thanks Suzy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Best practice for dynamic Title values using Tiles?
Erik Weber wrote the following on 1/24/2005 10:47 PM: Hello Rick. Happy New Year to you. I'm just curious. Why are you switching? I remember you advocating Sitemesh (I think it was on your site) instead of Tiles at some point. I haven't tried either one yet, but was going to try Sitemesh based largely on your recommendation, The reason I'm switching is that some of the pages we display can possibly be very very large in size (reporting information). SitemMesh has to store the entire response as a String in an object (I think backed as StringBuffer but not positive). So you can see the problem if you potentially have a huge page to display. Locally, I actually crashed my version of Tomcat when trying to render a page since it ran out of memory when trying to buffer such a large page. Tiles doesn't have this problem since it flushes the response out as it goes along. Tiles, although more work to configure, saves me from having to worry about these potential memory problems. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to add your own validation + make use of existing validator
On Mon, 24 Jan 2005 20:17:12 -0800 (PST), Manisha Sathe [EMAIL PROTECTED] wrote: I am using validator framework. But for some business logic - i need to some other validation depending on some conditions. I want to keep validation of validator framework as it is + after that i want to add my own. First of all is it possible If yes, then how ? This has been discussed multiple times on this list. In brief: 1) Override validate method, and call super.validate, then provide your validation. 2) Write your own custom validator. 3)Some validations are applications of business rules, and as such may belong in your business layer rather then in the validator framework. for more details please search the list. regards Manisha - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best practice for dynamic Title values using Tiles?
Phil Steitz wrote the following on 1/24/2005 7:25 PM: tiles:put name='title' type=string logic:equal name=bookForm property=action scope=request value=Create bean:message key=book.title.create/ /logic:equal logic:equal name=bookForm property=action scope=request value=Update bean:message key=book.title.update/ /logic:equal /tiles:put May not be the best, but keeps display stuff separate. This would be way to combersome since the title will be displayed in a reusable header page. The result would be that you'd have to code one huge long logic construct to decide what to display for the title for every possible action. I'm not totally opposed to using the request approach mentioned where I stuff a title attribute into the request in the Action and can then display it on the page... title${title}/title however, I'm starting to lean towards adding redundant code in the tiles config. At least all the titles will be in one place. Unfortunately this also requires me to have unique action forward mappings so that the correct tiles definition will be called. So I can't just have the forward go to a default myForm.page for both edit and add. I have to use edit.form.page and add.form.page simply so that the tiles defintion can add the correct title even though I'm going to the same JSP. I'm still torn on which approach to use:) -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best practice for dynamic Title values using Tiles?
I just have a c:out value='state.title'/ and feed the appropriate value to the request. State is a class as follows: public class StateContainer implements Map { private Map map; public StateContainer() { int size = 89; this.map = Collections.synchronizedMap(new HashMap(size)); } public void setStateContainerMap(Map map) { this.map = map; } public void setProperty(Object key, Object value) { map.put(key,value); } public MapgetStateContainerMap() { return map; } public Object getProperty(Object key) { return map.get(key); } public StateContainer putState(String key, Object value) { this.put(key,value); return this; } public void clear() { map.clear(); } public booleancontainsKey(Object key) { return map.containsKey(key);} public booleancontainsValue(Object value) { return map.containsValue(value); } public SetentrySet(){ return map.entrySet(); } public booleanequals(Object object) { return map.equals(object); } public Object get(Object key) { return map.get(key); } public inthashCode(){ return map.hashCode(); } public booleanisEmpty() { return map.isEmpty(); } public SetkeySet() { return map.keySet(); } public Object put(Object key, Object value) { return map.put(key,value); } public void putAll(Map map) { map.putAll(map); } public Object remove(Object key){ return map.remove(key); } public intsize(){ return map.size(); } public Collection values() { return map.values(); } public String toString(){ return StateContainer[map= + map.toString() + ]; } } Whatever values the page author wants to be dynamic can be assumed to be in state. Then, the Action author can make sure that the values are there. There is, by the way, good reason to use the composite pattern here. I have discussed that before so I won't repeat it. Jack On Mon, 24 Jan 2005 17:18:01 -0500, Rick Reumann [EMAIL PROTECTED] wrote: I'm switching back to using Tiles instead of Sitemesh and I remember one issue that I found annoying with Tiles and I'd be curious how you guys handle it. Say I have a form that is going to be reused for both Edit and Add. I want the title attribute to read something like Add Employee or Edit Employee, depending on what I'm doing. It seems silly to have to create multiple definitions in my tiles-definitions that are essentially the same exact definition except that the title has changed (potentially you might want a definition to be used for more than just the two that I mentioned). This also requires that my struts config has to be set up to forward to multiple tiles definitions when its really the same page layout but with a different title and could really just require one definition to use. I've thought of different ways I might want to handle this (ie set a title in request scope before leaving action and have the header.jsp look for this, or maybe use a filter or over-ride RequestProcessor?) I'm curious if others have run into this. Maybe the latest Struts/Tiles has a solution that I have not looked into. Thanks -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --- 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]
Re: How to add your own validation + make use of existing validator
finally i could figure it out as ActionErrors errors = super.validate(...) ( i am new to java too) With this i could get the server side validation + my own validation. The same thing i want to do it for Javascript validation. I want to make use of JavaScript validation created by validator + i want to add my own javascript validation any idea ? regards Manisha Manisha Sathe [EMAIL PROTECTED] wrote: I am using validator framework. But for some business logic - i need to some other validation depending on some conditions. I want to keep validation of validator framework as it is + after that i want to add my own. First of all is it possible If yes, then how ? regards Manisha - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term' - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'