Re: Eliminate Setup Actions
If your app is using tiles, take a look at Tile controllers. http://struts.apache.org/api/org/apache/struts/tiles/Controller.html The controller will get called right before rendering the jsp, allowing you to put your info into the request. Corey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why complicate? was: Eliminate Setup Actions
I really like the idea of adding the *setup_definitions* (whatever they are eventually called) to the forward elements in struts-config. To me, this would be the most logical place to add them. This means that they (the setup methods) would only be processed when it's 100% sure that we are going to process this particular forward. It also allow a mapping to have several forwards defined. It could also apply to global forwards. Another thought, what about redirecting forwards? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator with more than one module
By adding a comma separated list of struts config files, you are not specifying multiple *modules*, just multiple config files. ValidatorResources are stored in the ServletContext after being read by the plugin. So, when struts-config-two is read, it overwrites the info stored for struts-config-one. To specify multiple modules you need to declare in the ActionServlet init params something like this... config /WEB-INF/struts-config-one.xml config/module1 /WEB-INF/struts-config-two.xml Corey This link describes both ways (multiple config files and modules)... http://struts.apache.org/userGuide/configuration.html > I'm trying to use the validator with one that more Struts module, but > I've found that if you've more than one module, only one of them load > the validation xmls correctly, the others don't. > > Having this in the web.xml > > /WEB-INF/struts-config-one.xml, /WEB-INF/struts-config-two.xml: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BeanUtils.copyProperties Cannot find...
There's a method in the static PropertyUtils class. Also, look at the same method in PropertyUtilsBean. The javadocs will explain the differences. http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.7.0/docs/api/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BeanUtils.copyProperties Cannot find...
Sorry Scott... I wasn't thinking correctly. BeanUtils.copyProperties is in 1.7. It's also in 1.6. http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.7.0/docs/api/org/apache/commons/beanutils/BeanUtils.html Corey On Thu, 17 Mar 2005 09:44:45 -0600, Corey Probst <[EMAIL PROTECTED]> wrote: > There's a method in the static PropertyUtils class. Also, look at the > same method in PropertyUtilsBean. > > The javadocs will explain the differences. > http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.7.0/docs/api/ > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MessageResources in ActionForm
> That said, I don't know how you differentiate between > messages and errors if you do that... This two links on the Wiki explain a lot about ActionErrors and ActionMessages usage... http://wiki.apache.org/struts/ActionErrorsAndActionMessages?highlight=%28actionerrors%29 http://wiki.apache.org/struts/StrutsDeprecatedActionErrors?highlight=%28actionerrors%29 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Load message resources from DB???
> Even if I could just get some general directions on what method to pull the > data in, and what method to put the data into what type of container. > Just something would be good. I think I remember reading a post about this before. Start by looking at the PropertyMessageResources source code, specifically, the loadLocale and getMessage methods. This is where the properties are read from the file (for that implementation). You can probably extend that class and load the messages from a database by overriding one of those methods (loadLocale). You would also need a method to clear the cache of messages when they are updated. (Be careful in a clustered environment) On second thought you can probably just extend MessageResources and implement the getMessage method. Hope that helps... even if it's just a little bit. Corey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3
> But I can't find a link on where to download it.. The nightly builds are located here. http://svn.apache.org/builds/struts/maven/nightly/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing session variables in java Bean(In business logic Layer)
I don't know of a way to access the session from your business logic other than passing it in as a parameter (which I would *NOT* recommend). Even if you could access it, you would be tying the business layer to the servlet api, which is what you are trying to avoid by not passing the session directly. Take a look at ThreadLocal, I've never used it but it should do what you want. http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html You would set it somewhere at the beginning of the request and then it would be available as long as the thread stays alive. Someone correct me if this is not a good idea or won't work Hope it helps. Corey On 4/13/05, Mallik <[EMAIL PROTECTED]> wrote: > I can use getSesssion and setSession in the action class but I need to access > session variable in my java bean where I perform my business logic, not in > action class methods. (java beans are called from action class). I hope I am > clear this time. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message tag, resource bundle
> 1) Why does the globalResources.properties live under /WEB-INF/classes? Is > there a way to configure this differently? I'm not an expert but I'll try to help... The properties file is loaded using a ClassLoader. So the short answer is that the /WEB-INF/classes folder is on the class path by default. > 2) The book says the following: >The message tag is one of the most widely used tags within teh Struts tab > libraries. It recives an internationalized message for the specified locale, > using the specified message key, and writes it to the output stream. > I could use some clarification as to what that statement means. > I interpret it, as I can use a .properties file for different messages?? You can define different properties files for different locales. This way, you externalize these strings. The file that gets loaded depends on the locale that is set. You could create a globalResources_es.properties file for Spain. This would contain all of your messages in Spanish. Then when the Locale was set to Spain these messages would be loaded instead of your default messages. -- Corey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TilesController perform() depreciated and required in v1.2????
> I would appreciate any help with the following problem. I just upgraded one > of my applications from v1.1 to v1.2.4. I have resolved all upgrade issues > except the following. The Controller interface has depreciated the > perform() in favor of the execute(), but I am forced to implement both in > order to compile the code. Since I am implementing perform() I get many > depreciation warnings from the compiler. Does anyone have a solution? I > have provided a code sample and error message below. You can extend the ControllerSupport concrete class and override the execute() method instead. That seems to work but I'd like to hear it from somebody who knows for sure. The javadocs *seems* to indicate that is the intent... http://struts.apache.org/api/org/apache/struts/tiles/ControllerSupport.html Corey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TilesController perform() depreciated and required in v1.2????
On Tue, 1 Feb 2005 19:53:52 -0600, Jason Long <[EMAIL PROTECTED]> wrote: > Thank you for your reply. This tip let me remove the perform method from my > base class, but this is actually equivalent to what I was doing. The method > perorm() is simply implemented exactly the way I had done it. Why would a > method be both depreciated and required? Well, what I get from the javadocs is that, by doing it this way you won't be affected when the perform method is actually removed. The ControllerSupport class will only have the execute method in future releases. This leaves your implementation un-broken in future releases and leaves those that use the old way backwards compatible today. Can anyone confirm this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionError / ActionMessage
> > Does this mean I should always use the ActionMessage, or does the > ActionError come in useful for certain situations? > ActionError was deprecated in version 1.2.0. Even if you are using a version prior to this you should still use ActionMessage for future considerations. ActionErrors would be deprecated but it is part of the ActionForm.validate() signature. http://wiki.apache.org/struts/StrutsDeprecatedActionErrors - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionError / ActionMessage
> If so does anyone know why locale is now deprecated? A locale attribute of true stores a Locale object in the session and creates that session if it doesn't exist. This is not a good thing for apps that don't support them. Use the lang attribute to correctly accomplish this. http://struts.apache.org/userGuide/struts-html.html#html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]