Re: Validator documentation
Wednesday, June 18, 2003 3:46 PM , David Graham [EMAIL PROTECTED] a écrit : Hello, I'm looking for an exaustive documentation of the struts validator's rules defined in validator-rules.xml. Where can I find the name, values and meaning of heach variable the rules can take ? Neither : http://jakarta.apache.org/struts/userGuide/dev_validator.html nor the javadoc document this. And the sample chapter from Struts in action is obsolet for 1.1rc1. The link you sited does contain examples of the most common variables. The mask validation accepts a mask variable, the intRange validation accepts min and max variables (which are also applicable to the minlength and maxlength validations). And what about requiredif and its numerous variables, and about the future validatewhen syntaxe ?A example is not by definition exaustive. I think everybody does the way I do when using validator, e.g. guess the right use from samples taken form site to site and from the errors thrown. IMHO a true doc on that subject may be very usefull. For exemple : - The variables name and possible value. - The logic of each rules. - Whether the rules is aviable client side or not or if there is a difference between client side and server side logic. - The evolution along struts versions. - And samples of course. More, about all this item can be found from different places so it's rather a need to regroup them. Maybe one can consider posting a doc enancement ticket in bugzilla ? Malik. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts-menu] how to use URL rewriting ?
I wrote a MenuDispalyer that can be configured in a properties file. It will not solve your problem but it show how you can write your own MenuDisplayer to add replacement variable you need. It will require you to retrieve the session id from the pageContext and then pass it as a parameter for message resource replacement. If you are interested by my code look at the patch section of the sourceforge account of Struts-Menu where I posted it as RecursiveMenuDisplayer. Then look at RecusrsiveMenuDisplayer.getDisplayString(String key, String content, MenuComponent menu) to see how the variable are prepared. Malik. Thursday, June 19, 2003 4:10 PM , Nicolas De Loof [EMAIL PROTECTED] a crit : The problem we have is that URL are set in menu-config.xml, and struts-menu use it to set links in DHTML menu. Thank you for your help. Nico. Try html:rewrite http://jakarta.apache.org/struts/userGuide/dev_html.html From: Nicolas De Loof [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: [struts-menu] how to use URL rewriting ? Date: Thu, 19 Jun 2003 15:53:56 +0200 Hi all, our application uses URL rewriting to track session (for some obscure reasons...) We use struts-menu taglib, and it doesn't urlrewrite links in menu items. From what I've seen in struts-menu sources, it is not possible because MenuDisplayer doesn't have any HttpResponse param. Do you know any struts-menu extension or patch that uses response.encodeURL() ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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]
Validator documentation
Hello, I'm looking for an exaustive documentation of the struts validator's rules defined in validator-rules.xml. Where can I find the name, values and meaning of heach variable the rules can take ? Neither : http://jakarta.apache.org/struts/userGuide/dev_validator.html nor the javadoc document this. And the sample chapter from Struts in action is obsolet for 1.1rc1. Thanks for your pointers. Malik Recoing. Almerys
Re: Multiple struts-config files without Modules
Tuesday, February 04, 2003 8:12 PM , Ted Husted [EMAIL PROTECTED] a écrit : Is it dumb ? Or may it be an advance of the feature promised in 1.2 that will allow inheritence of configs ? Just to be precise, no one is able to make any promises about any features for any possible future release. No need to be so defensive. My english (and myself) is not very accurate, so I correct : of the feature that some rumors whispered that will maybe allow a form of ineritence of configs in a forward version. At this point, 1.2 may just be the patches for minor enhancements that came in while 1.1 was in never-ending beta, along with the Commons Resources migration. I'd like to see the same type of element inheritance in all the configs that we have in the tiles-config, but someone will have to create and commit the patches for this before it gets slated for a release. I agree with the tiles-like solution. It's efficent and simple. There's no need to make a complete object-c++-like type of ineritence. Template, default values, and overloading is enought. But if I can give my opinion, one interest of inheritence in config files is not only the factorization of declarations (that multiple files yet allow) but also the ability for third party to deliver some ready-to-use applications that the final user will just need to customise (if he want to) by overloading some configuration such as data sources for exemple. (actualy maybe a final feature will be usefull to). Malik. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple struts-config files without Modules
Monday, February 03, 2003 8:19 PM , Craig R. McClanahan [EMAIL PROTECTED] a écrit : On Mon, 3 Feb 2003, Susan Bradeen wrote: Date: Mon, 3 Feb 2003 13:24:10 -0500 From: Susan Bradeen [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Multiple struts-config files without Modules Without using Modules, and given the following configuration: !-- Standard Action Servlet Configuration (with debugging) -- servlet servlet-nameaction/servlet-name [snip] servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value /WEB-INF/struts-config.xml, /WEB-INF/struts-config-SectionOne.xml, /WEB-INF/struts-config-SectionTwo.xml /param-value /init-param ... load-on-startup1/load-on-startup /servlet Is there a proper order for the list of config files? Is there any advantage to having the struts-config.xml listed first or last? Preliminary tests show that I can put global forwards, exceptions, and actions in any of the config files, and Struts seems to find it. Even having a DynaActionForm in one config file, and action mappings that reference it in another config file, seems to work fine. Does Struts somehow actually consider the three files to be one? I started using this for organizational purposes mainly, but I am curious if there are any pitfalls that I should be aware of. Any comments are appreciated. If the contentes of your three files are constructed correctly (i.e. you don't try to declare the same action path more than once, for example), then order does not matter at all -- Struts simply processes all of the files at initialization time. The ability to split is simply for the convenience of the application developer (particularly when you might have different subteams responsible for different parts of a single large single-module app). And may we use a list of struts-config in combination with a multi-modules config ? Like that : servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config-common.xml, /WEB-INF/struts-config-global.xml/param-value /init-param init-param param-nameconfig/market/param-name param-value/WEB-INF/struts-config-common.xml, /WEB-INF/struts-config-market.xml/param-value /init-param load-on-startup1/load-on-startup /servlet Is it dumb ? Or may it be an advance of the feature promised in 1.2 that will allow inheritence of configs ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: one desing question, Revisited
Friday, January 31, 2003 5:31 PM , Cory Newey [EMAIL PROTECTED] a écrit : I don't understand your response. The code I propose below does in fact use delegation to factorize the functions. I'm ok with that. However, by utilizing an interface, all code that works with MyAction and MyDispatchAction objects now has a contract that says that both objects support the CommonFunction methods. Thus that code can deal with both objects as CommonFunction objects if it wants to. I was just pointing out is that probably no client code will use the CommonFunction interface of MyAction and the MyDispatchAction but themselve so it's maybe not usefull to implement it. And even if a client need CommonFunction why should they use a MyAction or MyDispatchAction instance rather than a CommonFunctionImpl instance ? If there is a need for a contract here, it's also a contract for a behavior not just for an interface. When you multi-inherite you take the interface and the behavior of each parent classes. It's not garanteed here for the clients of CommonFunction interface that they will have the behavior of CommonFounctionImpl. If you implement a function of CommonFonction another way than delgating to CommonFunctionImpl nothing will warn you about. So it is not quite like if you extends Action and CommonFunctionImpl. Java does not support multiple inhereteance and so there is *no way* to replace it exactly. This said, and Ashish warned, your code is very clean, I have nothing about that. This is what I understood that Ashish wanted to do. IOW, what's your beef? --Cory [EMAIL PROTECTED] 01/31/03 09:17AM I don't agree with the interface solution. As the name sugest CommonFunction seems to be only factorization of code and not a real type. MyAction and MyDispatchAction will never be called from outside as some 'CommonFunction'. Interfaces are meant to be externals contracts not a way to replace inheritance. IMHO when you want to factorize functions in sevral Classes of different types you only need to delegate. But maybe I missunderstood what Ashish whant. Malik. Friday, January 31, 2003 4:55 PM , Cory Newey [EMAIL PROTECTED] a écrit : Yeah, if you read his entire post, he says that he knows that multiple inheritance isn't allowed in Java. It looks to me like you'll have to make CommonFunctions an interface. If the methods in CommonFunctions actually are identical for both MyAction and MyDispatchAction, you could avoid having duplicate code in the two classes by deligating to a third object that actually implements the methods. What you would end up with would look something like this: MyAction extends Action implements CommonFunctions { private CommonFunctionsImpl common = new CommonFunctionsImpl(); ... methods in CommonFunctions interface that just call the common object above to the real work ... } MyDispatchAction extends DispatchAction implements CommonFunctions { private CommonFunctionsImpl common = new CommonFunctionsImpl(); ... methods in CommonFunctions interface that just call the common object above to the real work ... } CommonFunctionsImpl implements CommonFunctions { ... methods that do the real work ... } --Cory Cory R. Newey [EMAIL PROTECTED] Senior Software Engineer Novell, the leading provider of Net services software [EMAIL PROTECTED] 01/31/03 08:41AM I'm going to save you from getting flamed java does not allow multiple inheritance. You can only extend from a single Object. -Jacob -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 9:34 AM To: [EMAIL PROTECTED] Subject: one desing question, Revisited Hi, When i was thinking about my problem, I think what i want to do in multiple inhereteance I want to define a class called CommonFunctions , this call will have methods which are common, (As name suggest) now i have to do some thing like public class MyAction extends Action, CommonFuntions and public class MyDisptachAction extends DispatchAction, CommonFuntions By doing this i will be able to access all the methods in the class which sybclasses MyAction or MyDispatchAction I know the code above is not possible to do, but i want to do some thing like that.. So what are the ways of achieving it = A$HI$H __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
Re: JSP's under WEB-INF and Struts modules
Hi, I've got the same problem. The solution is to use forwardPattern and inputForward options to have complex, pattern based, repalcement of the uri : http://jakarta.apache.org/struts/userGuide/configuration.html#controller_con fig But after few tests and a look at the source code of struts b3 and nigthly builds, it seems to me that there is two kinds of uri replacement. For forwards and input the RequestProcessor use the given forwardPattern to replace uri. But for the forward attribute of actions a trivial appending of the name of the module is performed. So all path are not replaced the same way witch gives me unresolvable errors. So I posted a bug report here : http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16603 As you are, I'm still waiting for the witness of a sucessfull configuration of a multi-modules app with pages and tiles under WEB-INF. Malik. Friday, January 31, 2003 9:18 PM , Moyer, Alan L [EMAIL PROTECTED] a écrit : I just read Chuck Cavaness' article Jakarta Struts: Seven Lessons from the Trenches In it he recommends putting the JSP pages underneath WEB-INF. In the article he shows how to write an action as action path=/logoff type=org.apache.struts.webapp.example.LogoffAction forward name=success path=/WEB-INF/jsp/index.jsp/ /action However, if the application uses multiple Struts modules, I don't see how this would work. If the application is foo and the module is bar, wouldn't the address of the JSP be expanded to ../foo/bar/WEB-INF/jsp/index.jsp but WEB-INF isn't under bar, so this won't work. If, however, index.jsp is in directory foo/bar/jsp/ above WEB-INF then path=/jsp/index.jsp expands to ../foo/bar/jsp/index.jsp which works. Any idea how to make the URL expansion work when the JSP's are under WEB-INF. Thanks, Al [EMAIL PROTECTED] This transmission is intended only for use by the addressee(s) named herein and may contain information that is proprietary, confidential and/or legally privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. - 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]
Modularization
Hi to all, Does somebody finaly have been able to set à modularized app with pages, tiles and stuf in another place than the root of the webApp ? For exemple under the /WEB-INF/ folder ? I yes how does it use forwardPattern and pagePattern ? Witch paths does he set contexte-relative and witch module-relative ? Can he give us his config files and a vue of is folders tree ? Because I think module-shifting of URI is bugged when one not place files right under /TheWebApp/ or at leat it's fuzzy. I found it is not the same behaviour for all given paths : action.forward, action.input, forward.path, ForwardAction.parameter, tiles, etc. Malik. -- N'envoyez jamais à tout votre carnet les mails qui vous disent de le faire.
Re: are static classes GC'd?
Friday, January 31, 2003 4:20 PM , Adolfo Miguelez [EMAIL PROTECTED] a écrit : I agree. But, could the hashtable be collected before since it has not references in the method? Or is TemplatesCache.getInstance().get(key); considered as a reference? If you use the Sigleton D.P. as it must be, I don't see any reason that your hashtable be collected for the durring of the VM. The siglton does'nt need the *Class* to be static but the *instance* attribute. So as soon as you do .getInstance(), the instance attribute of TemplateCache is affected to a new TemplatesCache and will stay as long as the app live if you don't don't re-affect 'instance' to another object (but you must not). By the way and to come back to the true subject of the list , I coded such a cache for xslt Templates, but I don't make it a singleton as I want severals caches for each struts module context. So the unicity of each instance is managed via a hashtable referenced in the ServletContext by a key like TemplatesCaches. Malik. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: one desing question, Revisited
Friday, January 31, 2003 4:34 PM , Ashish Kulkarni [EMAIL PROTECTED] a écrit : Hi, When i was thinking about my problem, I think what i want to do in multiple inhereteance I want to define a class called CommonFunctions , this call will have methods which are common, (As name suggest) now i have to do some thing like public class MyAction extends Action, CommonFuntions and public class MyDisptachAction extends DispatchAction, CommonFuntions By doing this i will be able to access all the methods in the class which sybclasses MyAction or MyDispatchAction I know the code above is not possible to do, but i want to do some thing like that.. So what are the ways of achieving it As mutiple inheritance is not possible, the only alternative is to delegate. You can do it by using a CommonFunction attribute in an MyAbstractAction classe. All the concrete sub-classes of it can then use this attribute as an access to the common functions. This is only interesting if you CommonFunction instances can be differents (differently configured) for each MyAction. An other common way to use utility Classes via delegation is by using it as a Singleton (look for Sigleton desing pattern) or by making all methods (functions) static if posssible. Malik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: one desing question, Revisited
I don't agree with the interface solution. As the name sugest CommonFunction seems to be only factorization of code and not a real type. MyAction and MyDispatchAction will never be called from outside as some 'CommonFunction'. Interfaces are meant to be externals contracts not a way to replace inheritance. IMHO when you want to factorize functions in sevral Classes of different types you only need to delegate. But maybe I missunderstood what Ashish whant. Malik. Friday, January 31, 2003 4:55 PM , Cory Newey [EMAIL PROTECTED] a écrit : Yeah, if you read his entire post, he says that he knows that multiple inheritance isn't allowed in Java. It looks to me like you'll have to make CommonFunctions an interface. If the methods in CommonFunctions actually are identical for both MyAction and MyDispatchAction, you could avoid having duplicate code in the two classes by deligating to a third object that actually implements the methods. What you would end up with would look something like this: MyAction extends Action implements CommonFunctions { private CommonFunctionsImpl common = new CommonFunctionsImpl(); ... methods in CommonFunctions interface that just call the common object above to the real work ... } MyDispatchAction extends DispatchAction implements CommonFunctions { private CommonFunctionsImpl common = new CommonFunctionsImpl(); ... methods in CommonFunctions interface that just call the common object above to the real work ... } CommonFunctionsImpl implements CommonFunctions { ... methods that do the real work ... } --Cory Cory R. Newey [EMAIL PROTECTED] Senior Software Engineer Novell, the leading provider of Net services software [EMAIL PROTECTED] 01/31/03 08:41AM I'm going to save you from getting flamed java does not allow multiple inheritance. You can only extend from a single Object. -Jacob -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 9:34 AM To: [EMAIL PROTECTED] Subject: one desing question, Revisited Hi, When i was thinking about my problem, I think what i want to do in multiple inhereteance I want to define a class called CommonFunctions , this call will have methods which are common, (As name suggest) now i have to do some thing like public class MyAction extends Action, CommonFuntions and public class MyDisptachAction extends DispatchAction, CommonFuntions By doing this i will be able to access all the methods in the class which sybclasses MyAction or MyDispatchAction I know the code above is not possible to do, but i want to do some thing like that.. So what are the ways of achieving it = A$HI$H __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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: one desing question, Revisited
I Ask : What the real apport of implementing CommonFunctionInterface in each classes rather than just using common.aFunction() where you need it ? (but maintaining more code). Malik. Friday, January 31, 2003 5:17 PM , Ashish Kulkarni [EMAIL PROTECTED] a écrit : Hi Thanx for the all the mails, this is what i plan to do public interface CommonFunctionInterface{ // all my common methods; public Connection getConnection(); } public class CommonFunction implements CommonFunctionInterface{ public Connection getConnection(){ // provide the implementation here } } public class MyAction extends Action implements CommonFunctionInterface{ private final CommonFunction common; public MyAction(){ common = new CommonFunction(); } public Connection getConnnection(){ return common.getConnection(); } } public MyClass extends MyAction{ // now you should inherit getConnection() without problem } Ashish --- John Espey [EMAIL PROTECTED] wrote: sorry, the action wouldn't pass itself, it would pass its class. -Original Message- From: John Espey [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 10:10 AM To: Struts Users Mailing List Subject: RE: one desing question, Revisited You could create a CommonFunctionsFactory, with a method: CommonFunctions getCommonFunctionsByClass(Class) Your action could pass itself to this call to retrieve a CommonFunctions implementation, determined by the Factory, which could look up in a properties file which implementation to create for the specified class. You wouldn't really need to have your action implement CommonFunctions. If you needed to modify the behavior of your CommonFunctionsImpl for a given action class, you could extend CommonFunctionsImpl, and then map the action class to that new subclass. -Original Message- From: Matthew Meyer [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 10:00 AM To: Struts Users Mailing List Subject: Re: one desing question, Revisited What you will want to is make your commonFunctions an interface. Next write a class to implement all of your common functions. Then Write your action extending Action and implementing your commonFunctions interface. Make your common funtions an instance variable of your action and then simply delegate all the commonFunction messages your action recieves to your commonFunction instance variable like so: public method(..., ) { return commonFuntionInstance.method(, ); } Hope this helps you out... Matt, On Fri, 31 Jan 2003 07:45:22 -0800 (PST) Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi, I know java does not allow multiple inheritance, but I gave that example so i can make it clear what i want to do, So i want to find out a work around to achieve what i have explanned in the example Ashish --- Jacob Hookom [EMAIL PROTECTED] wrote: I'm going to save you from getting flamed java does not allow multiple inheritance. You can only extend from a single Object. -Jacob -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 9:34 AM To: [EMAIL PROTECTED] Subject: one desing question, Revisited Hi, When i was thinking about my problem, I think what i want to do in multiple inhereteance I want to define a class called CommonFunctions , this call will have methods which are common, (As name suggest) now i have to do some thing like public class MyAction extends Action, CommonFuntions and public class MyDisptachAction extends DispatchAction, CommonFuntions By doing this i will be able to access all the methods in the class which sybclasses MyAction or MyDispatchAction I know the code above is not possible to do, but i want to do some thing like that.. So what are the ways of achieving it = A$HI$H __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = A$HI$H __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now.