Re: default interceptor overriding parent package default interceptor
thanks for the reply i will look into it more if problem persists, i will try to put a sample together. On Mon, Dec 17, 2018 at 10:41 PM Lukasz Lenart wrote: > This is strange, inheritance should work just one way. Can you prepare > a small Maven based demo to demonstrate this behaviour? > > > Regards > -- > Łukasz > + 48 606 323 122 http://www.lenart.org.pl/ > > śr., 12 gru 2018 o 10:26 Steven Yang napisał(a): > > > > Hi > > I have the following setup of my struts2 xml. > > > > in cus.xml > > > > > > ...no interceptors defined, using interceptors form defaultPackage > > > > in cus-cus.xml > > > > > > > > > > new interceptors > > > > > > > > > > > > But all now all the Actions defined in cus.xml uses the > newInterceptorStack > > as the default interceptor. > > I only want the Actions defined in cus-cus.xml to use the > > newInterceptorStack as the default interceptor. > > > > Using Struts 2.3.x > > > > Please advice > > > > Thanks > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
default interceptor overriding parent package default interceptor
Hi I have the following setup of my struts2 xml. in cus.xml ...no interceptors defined, using interceptors form defaultPackage in cus-cus.xml new interceptors But all now all the Actions defined in cus.xml uses the newInterceptorStack as the default interceptor. I only want the Actions defined in cus-cus.xml to use the newInterceptorStack as the default interceptor. Using Struts 2.3.x Please advice Thanks
Re: S2 - custom tag with Spring
thanks I will try that On Thu, Dec 5, 2013 at 4:29 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/12/4 Steven Yang kenshin...@gmail.com: I think I missed something. To be clear what I meant by tag as jsp tag with tld defined. Yes my resource beans are defined in Spring, using XML actually. However my tag classes are not. From what I understand, the life cycle of tag is controlled by the web container therefore not defined in Spring. However I know that Struts tags do get intervened by Struts during the life cycle that's why using the Struts @Inject works. But when Struts inject its own resource, does it/will it inject resource defined in Spring? Or did I miss something? Tag (or rather Tag's Model) isn't created via ObjectFactory but directly with new keyword and then internal (Struts) dependencies are injected into it. So basically you can annotate your tag with @Inject(ObjectFactory) and then use the factory to resolve external dependencies. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: S2 - custom tag with Spring
I think I missed something. To be clear what I meant by tag as jsp tag with tld defined. Yes my resource beans are defined in Spring, using XML actually. However my tag classes are not. From what I understand, the life cycle of tag is controlled by the web container therefore not defined in Spring. However I know that Struts tags do get intervened by Struts during the life cycle that's why using the Struts @Inject works. But when Struts inject its own resource, does it/will it inject resource defined in Spring? Or did I miss something? Thanks On Wed, Dec 4, 2013 at 5:26 PM, Miguel Almeida mig...@almeida.at wrote: If you @Autowire something into your class you're essentially doing the same as retrieving the resources from ApplicationContext. Once you define your class as a Spring bean in Spring's configuration (either by explicitly defining it in an XML or because it's in a classpath which you've told Spring to scan) it is managed by spring - so you'll be able to inject whatever you want onto the bean. Beware of the scope you give to that bean, though. If it's in a tag, you might want to give it a request scope. Miguel On Wed, 2013-12-04 at 11:00 +0800, Steven Yang wrote: Hi I am writing some custom tags. I want to access some resource from Spring. Is there a clean way of doing it, instead of getting the ApplicationContext in the Components? Will @Inject work for non-Struts values? Or @Autowire will work as well? I am using the spring plugin. Thanks
S2 - custom tag with Spring
Hi I am writing some custom tags. I want to access some resource from Spring. Is there a clean way of doing it, instead of getting the ApplicationContext in the Components? Will @Inject work for non-Struts values? Or @Autowire will work as well? I am using the spring plugin. Thanks
Re: interceptor init twice
finally got time to test it and it works wonder thanks On Fri, May 17, 2013 at 4:09 PM, Steven Yang kenshin...@gmail.com wrote: Thanks will do asap On Fri, May 17, 2013 at 2:39 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: Committed, please check with the latest snapshot. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/17 Steven Yang kenshin...@gmail.com: Wow that's fast here it is https://issues.apache.org/jira/browse/WW-4067 thanks On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart lukaszlen...@apache.org wrote: Fix is ready, I just need a JIRA task :-) 2013/5/16 Lukasz Lenart lukaszlen...@apache.org: I have been looking into that and I am sure that's the problem, could you register an issue with JIRA? Thanks in advance -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/16 Lukasz Lenart lukaszlen...@apache.org: Maybe your problem is related to: https://issues.apache.org/jira/browse/WW-3870 Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/9 Steven Yang kenshin...@gmail.com: thanks good to know i am not being forgotten :) On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: It's on my ToDo list ;-) 2013/5/9 Steven Yang kenshin...@gmail.com: Hi just wondering is anyone as any insight on this? Or do I need to provide more information? thanks On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang kenshin...@gmail.com wrote: same behavior for devMode=true and false i am not sure what you mean, shouldnt init only be called during initialization? or do you want to confirm that when I run my app after initialization, the init method wont be called again? so far the observation is that this only happen during initialization and before I access any of my actions, and no more init called after that On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart lukaszlen...@apache.org wrote: 2013/4/25 Felipe Lorenz felipe.lor...@idealogic.com.br: with version 2.3.12, same behavior. Is this happen only during initialisation? in devMode? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: interceptor init twice
Thanks will do asap On Fri, May 17, 2013 at 2:39 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: Committed, please check with the latest snapshot. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/17 Steven Yang kenshin...@gmail.com: Wow that's fast here it is https://issues.apache.org/jira/browse/WW-4067 thanks On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart lukaszlen...@apache.org wrote: Fix is ready, I just need a JIRA task :-) 2013/5/16 Lukasz Lenart lukaszlen...@apache.org: I have been looking into that and I am sure that's the problem, could you register an issue with JIRA? Thanks in advance -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/16 Lukasz Lenart lukaszlen...@apache.org: Maybe your problem is related to: https://issues.apache.org/jira/browse/WW-3870 Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/9 Steven Yang kenshin...@gmail.com: thanks good to know i am not being forgotten :) On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: It's on my ToDo list ;-) 2013/5/9 Steven Yang kenshin...@gmail.com: Hi just wondering is anyone as any insight on this? Or do I need to provide more information? thanks On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang kenshin...@gmail.com wrote: same behavior for devMode=true and false i am not sure what you mean, shouldnt init only be called during initialization? or do you want to confirm that when I run my app after initialization, the init method wont be called again? so far the observation is that this only happen during initialization and before I access any of my actions, and no more init called after that On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart lukaszlen...@apache.org wrote: 2013/4/25 Felipe Lorenz felipe.lor...@idealogic.com.br: with version 2.3.12, same behavior. Is this happen only during initialisation? in devMode? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: interceptor init twice
Wow that's fast here it is https://issues.apache.org/jira/browse/WW-4067 thanks On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart lukaszlen...@apache.orgwrote: Fix is ready, I just need a JIRA task :-) 2013/5/16 Lukasz Lenart lukaszlen...@apache.org: I have been looking into that and I am sure that's the problem, could you register an issue with JIRA? Thanks in advance -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/16 Lukasz Lenart lukaszlen...@apache.org: Maybe your problem is related to: https://issues.apache.org/jira/browse/WW-3870 Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/5/9 Steven Yang kenshin...@gmail.com: thanks good to know i am not being forgotten :) On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: It's on my ToDo list ;-) 2013/5/9 Steven Yang kenshin...@gmail.com: Hi just wondering is anyone as any insight on this? Or do I need to provide more information? thanks On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang kenshin...@gmail.com wrote: same behavior for devMode=true and false i am not sure what you mean, shouldnt init only be called during initialization? or do you want to confirm that when I run my app after initialization, the init method wont be called again? so far the observation is that this only happen during initialization and before I access any of my actions, and no more init called after that On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart lukaszlen...@apache.org wrote: 2013/4/25 Felipe Lorenz felipe.lor...@idealogic.com.br: with version 2.3.12, same behavior. Is this happen only during initialisation? in devMode? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: interceptor init twice
thanks good to know i am not being forgotten :) On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: It's on my ToDo list ;-) 2013/5/9 Steven Yang kenshin...@gmail.com: Hi just wondering is anyone as any insight on this? Or do I need to provide more information? thanks On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang kenshin...@gmail.com wrote: same behavior for devMode=true and false i am not sure what you mean, shouldnt init only be called during initialization? or do you want to confirm that when I run my app after initialization, the init method wont be called again? so far the observation is that this only happen during initialization and before I access any of my actions, and no more init called after that On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart lukaszlen...@apache.org wrote: 2013/4/25 Felipe Lorenz felipe.lor...@idealogic.com.br: with version 2.3.12, same behavior. Is this happen only during initialisation? in devMode? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: interceptor init twice
Hi just wondering is anyone as any insight on this? Or do I need to provide more information? thanks On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang kenshin...@gmail.com wrote: same behavior for devMode=true and false i am not sure what you mean, shouldnt init only be called during initialization? or do you want to confirm that when I run my app after initialization, the init method wont be called again? so far the observation is that this only happen during initialization and before I access any of my actions, and no more init called after that On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/25 Felipe Lorenz felipe.lor...@idealogic.com.br: with version 2.3.12, same behavior. Is this happen only during initialisation? in devMode? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: interceptor init twice
same behavior for devMode=true and false i am not sure what you mean, shouldnt init only be called during initialization? or do you want to confirm that when I run my app after initialization, the init method wont be called again? so far the observation is that this only happen during initialization and before I access any of my actions, and no more init called after that On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/25 Felipe Lorenz felipe.lor...@idealogic.com.br: with version 2.3.12, same behavior. Is this happen only during initialisation? in devMode? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How can I put multiple charts into a single JSP page using JFree Chart?
indeed just include multiple img tags that points to actions that generate images using JFreeChart see http://struts.apache.org/development/2.x/docs/jfreechart-plugin.html On Fri, Apr 26, 2013 at 3:01 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/17 Norah Jones nh.jone...@gmail.com: I am planning to use JFree Charts for my web application. I have a requirement to place multiple Charts (say multiple pie charts) on a single JSP page. How can I achieve using JFree Charts? I have limited knowledge about JFree CHarts but it shouldn't be a problem. Just put multiple tags or call an action with different params to generate different charts. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How can I put multiple charts into a single JSP page using JFree Chart?
I have no idea. I did not modify the document. I simply find the page and post for example and didnt even noticed it. On Fri, Apr 26, 2013 at 5:52 PM, Martin Gainty mgai...@hotmail.com wrote: Steven Error trying to draw image gallery org.apache.velocity.exception.ParseErrorException: Encountered = at /templates/gallery-dynamic-slideshow.vm[line 64, column 37] Was expecting one of: ... - ... + ... * ... / ... % ... ... who supplies the Velocity Macros for the JFreeChart example? Thanks, Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Fri, 26 Apr 2013 16:08:31 +0800 Subject: Re: How can I put multiple charts into a single JSP page using JFree Chart? From: kenshin...@gmail.com To: user@struts.apache.org indeed just include multiple img tags that points to actions that generate images using JFreeChart see http://struts.apache.org/development/2.x/docs/jfreechart-plugin.html On Fri, Apr 26, 2013 at 3:01 PM, Lukasz Lenart lukaszlen...@apache.org wrote: 2013/4/17 Norah Jones nh.jone...@gmail.com: I am planning to use JFree Charts for my web application. I have a requirement to place multiple Charts (say multiple pie charts) on a single JSP page. How can I achieve using JFree Charts? I have limited knowledge about JFree CHarts but it shouldn't be a problem. Just put multiple tags or call an action with different params to generate different charts. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
interceptor init twice
I was using 2.1.8 and recently upgraded to 2.3.14. And I realized that my interceptor got initialized twice and it didnt happen before. This happens when I declare a default package in struts.xml and include other xml which have packages that extends my default package. But the thing is no matter how many more xml I include the interceptor will only be initialize one extra time. the following is my sample struts.xml package name=default namespace=/ extends=struts-default interceptors interceptor name=baseGeneral class=GeneralInterceptor/interceptor interceptor-stack name=biStack interceptor-ref name=baseGeneral/ /interceptor-stack /interceptors default-action-ref name=index / global-results result name=error/error.jsp/result /global-results global-exception-mappings exception-mapping exception=java.lang.Exception result=error/ /global-exception-mappings action name=index result type=redirectAction param name=actionNameHelloWorld/param param name=namespace/example/param /result /action /package include file=example.xml/ my example.xml package name=example namespace=/example extends=default action name=HelloWorld class=example.HelloWorld result/example/HelloWorld.jsp/result /action /package I traced the log and see the that my default package is been initialized twice and it seems that struts knows about it but it still called init() on my interceptor. partial log: 2013-04-24 11:57:58,504 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Using default implementation of FileManager provided under name [system]: DefaultFileManager 2013-04-24 11:57:58,505 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default namespace:/ parents:[{PackageConfig Name:struts-default namespace: parents:[]}]} GeneralInterceptor.init() 2013-04-24 11:57:58,509 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig index () - action - file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30} 2013-04-24 11:57:58,510 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:example namespace:/example parents:[{PackageConfig Name:default namespace:/ parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}]} 2013-04-24 11:57:58,513 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example' package:{ActionConfig HelloWorld (example.HelloWorld) - action - file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62} 2013-04-24 11:57:58,514 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example' package:{ActionConfig Login_* (example.Login.{1}()) - action - file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67} 2013-04-24 11:57:58,514 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded /example/* in 'example' package:{ActionConfig * (example.ExampleSupport) - action - file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57} 2013-04-24 11:57:58,515 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default namespace:/ parents:[{PackageConfig Name:struts-default namespace: parents:[]}]} GeneralInterceptor.init() 2013-04-24 11:57:58,516 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig index () - action - file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30} 2013-04-24 11:57:58,516 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - The package name 'default' is already been loaded by the same location and could be removed: package - file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68 as you can see struts knows that default has been loaded before however my interceptor still prints out init message. If I remove the include or move the default package declaration out to another file and use include to include it in struts.xml the problem goes away. Is this behavior correct? or I am using something in the wrong way? Thanks
Re: interceptor init twice
@Maurizio I am indeed using Spring, I will try without Spring. @Dave what i mean by include is that I use the include file=/ tag I do understand that Interceptor is singleton-ish. And I do understand if I defined the same interceptor in two different stacks there should be two different instances. However the case is that I only have one interceptor stack and two packages that shares the same stack but the init() is still being called twice. Also I have not declared any other default package anywhere in any xml, you are seeing all the packages that I have declared which are default and example and yet struts complains that I have declared default twice. If I have two different packages the interceptor should be instantiated two times then if I add another package the interceptor should be instantiated three times right? but it only gets instantiated two times max. The clarify the sample I created is a very simple app created from the blank war, I only added the bare minimum to reproduce the problem, to be exact init() wasn't called twice when I was using 2.1.8, if I recall correctly this behavior started on 2.3.8. So I want to confirm that this behavior is expected. Thanks On Wed, Apr 24, 2013 at 9:46 PM, Maurizio Cucchiara mcucchi...@apache.orgwrote: Yep, it makes sense definitely, otherwise there would not be way to share a single instance with different params. Il giorno 24/apr/2013 15:31, Dave Newton davelnew...@gmail.com ha scritto: Definitely singleton-ish, although i thought there was an instance-per-package--I thought I had packages with the same interceptor configured in different ways, but I can't check at the moment. Dave On Wed, Apr 24, 2013 at 9:28 AM, Maurizio Cucchiara mcucchi...@apache.orgwrote: @Dave, I also could be wrong, but I remember that interceptors are singletone (maybe there is a single instance per package). @Steven looks like you're using Spring, if yes, could you check if you experience the same behavior w/o it? Il giorno 24/apr/2013 14:04, Dave Newton davelnew...@gmail.com ha scritto: I'm not sure I understand what you mean regarding using the include element (i.e., precisely what you're doing) but I thought that each package would have its own set of interceptors, meaning there would be two instances, hence init would be called twice. This would be trivial to determine by checking to see if it's the same instance. I could be misremembering. Dave On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang kenshin...@gmail.com wrote: I was using 2.1.8 and recently upgraded to 2.3.14. And I realized that my interceptor got initialized twice and it didnt happen before. This happens when I declare a default package in struts.xml and include other xml which have packages that extends my default package. But the thing is no matter how many more xml I include the interceptor will only be initialize one extra time. the following is my sample struts.xml package name=default namespace=/ extends=struts-default interceptors interceptor name=baseGeneral class=GeneralInterceptor/interceptor interceptor-stack name=biStack interceptor-ref name=baseGeneral/ /interceptor-stack /interceptors default-action-ref name=index / global-results result name=error/error.jsp/result /global-results global-exception-mappings exception-mapping exception=java.lang.Exception result=error/ /global-exception-mappings action name=index result type=redirectAction param name=actionNameHelloWorld/param param name=namespace/example/param /result /action /package include file=example.xml/ my example.xml package name=example namespace=/example extends=default action name=HelloWorld class=example.HelloWorld result/example/HelloWorld.jsp/result /action /package I traced the log and see the that my default package is been initialized twice and it seems that struts knows about it but it still called init() on my interceptor. partial log: 2013-04-24 11:57:58,504 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Using default implementation of FileManager provided under name [system]: DefaultFileManager 2013-04-24 11:57:58,505 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default namespace:/ parents:[{PackageConfig Name:struts-default namespace: parents:[]}]} GeneralInterceptor.init() 2013
Re: interceptor init twice
@Maurizio sorry in the sample app I do not using Spring. I am using Spring in my projects, sorry for the confusion And sorry this behavior started on 2.3.7 and 2.3.4.1 does not have this behavior On Thu, Apr 25, 2013 at 9:13 AM, Steven Yang kenshin...@gmail.com wrote: @Maurizio I am indeed using Spring, I will try without Spring. @Dave what i mean by include is that I use the include file=/ tag I do understand that Interceptor is singleton-ish. And I do understand if I defined the same interceptor in two different stacks there should be two different instances. However the case is that I only have one interceptor stack and two packages that shares the same stack but the init() is still being called twice. Also I have not declared any other default package anywhere in any xml, you are seeing all the packages that I have declared which are default and example and yet struts complains that I have declared default twice. If I have two different packages the interceptor should be instantiated two times then if I add another package the interceptor should be instantiated three times right? but it only gets instantiated two times max. The clarify the sample I created is a very simple app created from the blank war, I only added the bare minimum to reproduce the problem, to be exact init() wasn't called twice when I was using 2.1.8, if I recall correctly this behavior started on 2.3.8. So I want to confirm that this behavior is expected. Thanks On Wed, Apr 24, 2013 at 9:46 PM, Maurizio Cucchiara mcucchi...@apache.org wrote: Yep, it makes sense definitely, otherwise there would not be way to share a single instance with different params. Il giorno 24/apr/2013 15:31, Dave Newton davelnew...@gmail.com ha scritto: Definitely singleton-ish, although i thought there was an instance-per-package--I thought I had packages with the same interceptor configured in different ways, but I can't check at the moment. Dave On Wed, Apr 24, 2013 at 9:28 AM, Maurizio Cucchiara mcucchi...@apache.orgwrote: @Dave, I also could be wrong, but I remember that interceptors are singletone (maybe there is a single instance per package). @Steven looks like you're using Spring, if yes, could you check if you experience the same behavior w/o it? Il giorno 24/apr/2013 14:04, Dave Newton davelnew...@gmail.com ha scritto: I'm not sure I understand what you mean regarding using the include element (i.e., precisely what you're doing) but I thought that each package would have its own set of interceptors, meaning there would be two instances, hence init would be called twice. This would be trivial to determine by checking to see if it's the same instance. I could be misremembering. Dave On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang kenshin...@gmail.com wrote: I was using 2.1.8 and recently upgraded to 2.3.14. And I realized that my interceptor got initialized twice and it didnt happen before. This happens when I declare a default package in struts.xml and include other xml which have packages that extends my default package. But the thing is no matter how many more xml I include the interceptor will only be initialize one extra time. the following is my sample struts.xml package name=default namespace=/ extends=struts-default interceptors interceptor name=baseGeneral class=GeneralInterceptor/interceptor interceptor-stack name=biStack interceptor-ref name=baseGeneral/ /interceptor-stack /interceptors default-action-ref name=index / global-results result name=error/error.jsp/result /global-results global-exception-mappings exception-mapping exception=java.lang.Exception result=error/ /global-exception-mappings action name=index result type=redirectAction param name=actionNameHelloWorld/param param name=namespace/example/param /result /action /package include file=example.xml/ my example.xml package name=example namespace=/example extends=default action name=HelloWorld class=example.HelloWorld result/example/HelloWorld.jsp/result /action /package I traced the log and see the that my default package is been initialized twice and it seems that struts knows about it but it still called init() on my interceptor. partial log: 2013-04-24 11:57:58,504 DEBUG com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger (Slf4jLogger.java:69) - Using default implementation of FileManager provided under name [system]: DefaultFileManager
Re: generating taglib using Ant and Java 6
I asked whether I should do it in a new package because the new Processor is no longer using the APT and therefore there wont be Factory and the Processor the extending the annotation Processor in Java 6 On Wed, Apr 10, 2013 at 6:25 PM, Martin Gainty mgai...@hotmail.com wrote: Stephen your comment last nite said something about wrapping into APT package? I didnt see Factory, Processor, Environment or META-INF/services http://docs.oracle.com/javase/1.5.0/docs/guide/apt/GettingStarted.html ? Martin __ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. From: lukaszlen...@apache.org Date: Wed, 10 Apr 2013 07:51:14 +0200 Subject: Re: generating taglib using Ant and Java 6 To: user@struts.apache.org 2013/4/9 Steven Yang kenshin...@gmail.com: submitted please let me know if anything is wrong, first timer https://issues.apache.org/jira/browse/WW-4040 Thanks a lot! I will review it asap :-) Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
yes I was using it when my project was built against java 1.5 as it uses APT which is not in Java 1.6 anymore. so I ported it to use the new Annotation Processor. I basically did a direct translation On Mon, Apr 8, 2013 at 1:49 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/7 Steven Yang kenshin...@gmail.com: here is the source on git https://github.com/lunaspeed/struts-annotation-processor I am new on both git and maven so it seems I have not done somethings right. Please tell me where I can improve. Have you tried to use and modify Struts Annotation project? https://svn.apache.org/repos/asf/struts/maven/trunk/struts-annotations/ Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
sure but just that i have never done such thing before please inform me on the step and what should i do thanks On Mon, Apr 8, 2013 at 2:37 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/8 Steven Yang kenshin...@gmail.com: yes I was using it when my project was built against java 1.5 as it uses APT which is not in Java 1.6 anymore. so I ported it to use the new Annotation Processor. I basically did a direct translation Is it a problem for you to prepare a patch with your changes? I mean I would like to upgrade Struts Annotation to be aligned with the Annotation Processor. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
one question should i do it in a new package? the old one is for apt and should be kept right? On Mon, Apr 8, 2013 at 3:09 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/8 Steven Yang kenshin...@gmail.com: sure but just that i have never done such thing before please inform me on the step and what should i do Checkout the project with svn svn co https://svn.apache.org/repos/asf/struts/maven/trunk/struts-annotations/ modify the source in IDE svn diff changes.diff or use IDE to do the same (in IDEA: VCS - Create Patch...) Then you can register an issue [1] and attach your patch [1] https://issues.apache.org/jira/browse/WW Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
submitted please let me know if anything is wrong, first timer https://issues.apache.org/jira/browse/WW-4040 On Mon, Apr 8, 2013 at 4:43 PM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/4/8 Steven Yang kenshin...@gmail.com: one question should i do it in a new package? the old one is for apt and should be kept right? Hm... I think you're right, good idea :-) Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
here is the source on git https://github.com/lunaspeed/struts-annotation-processor I am new on both git and maven so it seems I have not done somethings right. Please tell me where I can improve. On Sat, Apr 6, 2013 at 1:48 PM, Steven Yang kenshin...@gmail.com wrote: Hi all I found out that I had srcdir set wrong, looks like I need to specify at least one package as well so StrutsTags/com will work. However, the old Processor does not implement javax.annotation.processing.Processor, therefore it cannot be used at all. I am currently porting the apt version to using the Processor. Need a bit more testing, I will share it when I am done testing with my own project. On Fri, Apr 5, 2013 at 12:10 PM, Steven Yang kenshin...@gmail.com wrote: I definitely will share when I figure out how and I am really interested in when Struts3 will be come GA, as I am just starting a new project will hope to adopt to the new version asap. On Fri, Apr 5, 2013 at 8:02 AM, Omar Ngarigari ngarigar...@yahoo.comwrote: Struts3 is coming? Great! how soon? From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 4, 2013 7:45 PM Subject: Re: generating taglib using Ant and Java 6 Nope. On Apr 4, 2013 7:39 PM, Omar Ngarigari ngarigar...@yahoo.com wrote: Did you mean Struts2? From: Lukasz Lenart lukaszlen...@apache.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 4, 2013 12:36 PM Subject: Re: generating taglib using Ant and Java 6 If you find a solution, please share it as we can use with Struts 3 then :-) 2013/4/4 Steven Yang kenshin...@gmail.com: Sorry this may not be directed to Struts2 I have written some Struts2 taglib and want to package them into a jar. I am not using maven so I used to use Ant with apt tag. And my task looks like the following target name=generate-taglib apt classpathref=tags.classpath factorypathref=tags.classpath srcdir=StrutsTags compile=false destdir=dist/apt fork=true preprocessdir=bin verbose=false source=1.5 encoding=utf-8 factory=org.apache.struts.annotations.taglib.apt.TLDAnnotationProcessorFactory includeantruntime=false compilerarg value=-AtlibVersion=1.0 / compilerarg value=-AjspVersion=2.0 / compilerarg value=-AshortName=mb / compilerarg value=-Auri=/struts-my-tags / compilerarg value=-Adescription='My Struts Tags' / compilerarg value=-AdisplayName='My Struts Tags' / compilerarg value=-AoutTemplatesDir=${basedir}/dist/taglib-doc / compilerarg value=-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld / /apt /target However since java 6 apt has been removed or not supported I want to use the Annotation Processor in the Java Compiler. But I couldnt find any direct example and I came up with the following target name=generate-taglib depends=compile javac destdir=bin debug=true failonerror=true compiler=javac1.6 srcdir=StrutsTags includeantruntime=false encoding=utf-8 verbose=true include name=**/*.java/ classpath refid=tags.classpath/ compilerarg line=-proc:only/ compilerarg line=-processor org.apache.struts.annotations.taglib.apt.TagAnnotationProcessor / compilerarg line=-s dist/apt / compilerarg line=-source 6/ compilerarg value=-AtlibVersion=1.0.1 / compilerarg value=-AjspVersion=2.0 / compilerarg value=-AshortName=mb / compilerarg value=-Auri=/struts-my-tags / compilerarg value=-Adescription='My Struts Tags' / compilerarg value=-AdisplayName='My Struts Tags' / compilerarg value=-AoutTemplatesDir=${basedir}/dist/taglib-doc / compilerarg value=-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld / /javac /target When I run this the task completes successfully however nothing is generated in the struts-my-tags.tld. Can someone tell me whats wrong? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
Hi all I found out that I had srcdir set wrong, looks like I need to specify at least one package as well so StrutsTags/com will work. However, the old Processor does not implement javax.annotation.processing.Processor, therefore it cannot be used at all. I am currently porting the apt version to using the Processor. Need a bit more testing, I will share it when I am done testing with my own project. On Fri, Apr 5, 2013 at 12:10 PM, Steven Yang kenshin...@gmail.com wrote: I definitely will share when I figure out how and I am really interested in when Struts3 will be come GA, as I am just starting a new project will hope to adopt to the new version asap. On Fri, Apr 5, 2013 at 8:02 AM, Omar Ngarigari ngarigar...@yahoo.comwrote: Struts3 is coming? Great! how soon? From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 4, 2013 7:45 PM Subject: Re: generating taglib using Ant and Java 6 Nope. On Apr 4, 2013 7:39 PM, Omar Ngarigari ngarigar...@yahoo.com wrote: Did you mean Struts2? From: Lukasz Lenart lukaszlen...@apache.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 4, 2013 12:36 PM Subject: Re: generating taglib using Ant and Java 6 If you find a solution, please share it as we can use with Struts 3 then :-) 2013/4/4 Steven Yang kenshin...@gmail.com: Sorry this may not be directed to Struts2 I have written some Struts2 taglib and want to package them into a jar. I am not using maven so I used to use Ant with apt tag. And my task looks like the following target name=generate-taglib apt classpathref=tags.classpath factorypathref=tags.classpath srcdir=StrutsTags compile=false destdir=dist/apt fork=true preprocessdir=bin verbose=false source=1.5 encoding=utf-8 factory=org.apache.struts.annotations.taglib.apt.TLDAnnotationProcessorFactory includeantruntime=false compilerarg value=-AtlibVersion=1.0 / compilerarg value=-AjspVersion=2.0 / compilerarg value=-AshortName=mb / compilerarg value=-Auri=/struts-my-tags / compilerarg value=-Adescription='My Struts Tags' / compilerarg value=-AdisplayName='My Struts Tags' / compilerarg value=-AoutTemplatesDir=${basedir}/dist/taglib-doc / compilerarg value=-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld / /apt /target However since java 6 apt has been removed or not supported I want to use the Annotation Processor in the Java Compiler. But I couldnt find any direct example and I came up with the following target name=generate-taglib depends=compile javac destdir=bin debug=true failonerror=true compiler=javac1.6 srcdir=StrutsTags includeantruntime=false encoding=utf-8 verbose=true include name=**/*.java/ classpath refid=tags.classpath/ compilerarg line=-proc:only/ compilerarg line=-processor org.apache.struts.annotations.taglib.apt.TagAnnotationProcessor / compilerarg line=-s dist/apt / compilerarg line=-source 6/ compilerarg value=-AtlibVersion=1.0.1 / compilerarg value=-AjspVersion=2.0 / compilerarg value=-AshortName=mb / compilerarg value=-Auri=/struts-my-tags / compilerarg value=-Adescription='My Struts Tags' / compilerarg value=-AdisplayName='My Struts Tags' / compilerarg value=-AoutTemplatesDir=${basedir}/dist/taglib-doc / compilerarg value=-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld / /javac /target When I run this the task completes successfully however nothing is generated in the struts-my-tags.tld. Can someone tell me whats wrong? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: generating taglib using Ant and Java 6
I definitely will share when I figure out how and I am really interested in when Struts3 will be come GA, as I am just starting a new project will hope to adopt to the new version asap. On Fri, Apr 5, 2013 at 8:02 AM, Omar Ngarigari ngarigar...@yahoo.comwrote: Struts3 is coming? Great! how soon? From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 4, 2013 7:45 PM Subject: Re: generating taglib using Ant and Java 6 Nope. On Apr 4, 2013 7:39 PM, Omar Ngarigari ngarigar...@yahoo.com wrote: Did you mean Struts2? From: Lukasz Lenart lukaszlen...@apache.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, April 4, 2013 12:36 PM Subject: Re: generating taglib using Ant and Java 6 If you find a solution, please share it as we can use with Struts 3 then :-) 2013/4/4 Steven Yang kenshin...@gmail.com: Sorry this may not be directed to Struts2 I have written some Struts2 taglib and want to package them into a jar. I am not using maven so I used to use Ant with apt tag. And my task looks like the following target name=generate-taglib apt classpathref=tags.classpath factorypathref=tags.classpath srcdir=StrutsTags compile=false destdir=dist/apt fork=true preprocessdir=bin verbose=false source=1.5 encoding=utf-8 factory=org.apache.struts.annotations.taglib.apt.TLDAnnotationProcessorFactory includeantruntime=false compilerarg value=-AtlibVersion=1.0 / compilerarg value=-AjspVersion=2.0 / compilerarg value=-AshortName=mb / compilerarg value=-Auri=/struts-my-tags / compilerarg value=-Adescription='My Struts Tags' / compilerarg value=-AdisplayName='My Struts Tags' / compilerarg value=-AoutTemplatesDir=${basedir}/dist/taglib-doc / compilerarg value=-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld / /apt /target However since java 6 apt has been removed or not supported I want to use the Annotation Processor in the Java Compiler. But I couldnt find any direct example and I came up with the following target name=generate-taglib depends=compile javac destdir=bin debug=true failonerror=true compiler=javac1.6 srcdir=StrutsTags includeantruntime=false encoding=utf-8 verbose=true include name=**/*.java/ classpath refid=tags.classpath/ compilerarg line=-proc:only/ compilerarg line=-processor org.apache.struts.annotations.taglib.apt.TagAnnotationProcessor / compilerarg line=-s dist/apt / compilerarg line=-source 6/ compilerarg value=-AtlibVersion=1.0.1 / compilerarg value=-AjspVersion=2.0 / compilerarg value=-AshortName=mb / compilerarg value=-Auri=/struts-my-tags / compilerarg value=-Adescription='My Struts Tags' / compilerarg value=-AdisplayName='My Struts Tags' / compilerarg value=-AoutTemplatesDir=${basedir}/dist/taglib-doc / compilerarg value=-AoutFile=${basedir}/bin/META-INF/struts-my-tags.tld / /javac /target When I run this the task completes successfully however nothing is generated in the struts-my-tags.tld. Can someone tell me whats wrong? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Using HashMap in selectbox
i think you can turn the map to a SetEntryK, V then use it as listKey as getKey() or key and listValue as getValue() or value On Wed, Mar 28, 2012 at 6:16 PM, Rakeshkumar Parmar rakeshkumar_par...@persistent.co.in wrote: I think it requires list. So you can get values from hashmap using values() method.then apply person.name. Regards, Rakesh -Original Message- From: Shrinivas Parashar [mailto:shrinivas_paras...@symantec.com] Sent: Wednesday, March 28, 2012 3:44 PM To: Struts Users Mailing List Subject: Using HashMap in selectbox Hi, How can use a hashMap in select box with Map key as listkey and Map values one of the property as listValue. For example I have a Map of type String,Person . In the listValue I want to provide person.name. Is this possible? Regards, Shrinivas DISCLAIMER == This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts, spring integration while using struts annotations
check this http://struts.apache.org/2.0.8/docs/spring-plugin.html you can use spring along with the annotation in the convention-plugin such as @Action, etc On Tue, Feb 28, 2012 at 6:01 PM, Puneet Babbar 2 pbabb...@sapient.comwrote: Hi, I am using struts annotations with my applications, I need to add spring's support to my application. I am not able to find any content on how to use the beans(the struts action classes) initialized using spring as my action when I am using struts annotations? Regards Puneet
Re: Nested Iterator tag...
try: s:iterator id=outerList value=outerList s:iterator id=innerList value=top s:property / /s:iterator /s:iterator or s:iterator id=outerList value=outerList var=il s:iterator id=innerList value=#il s:property / /s:iterator /s:iterator or since you used id, by the way i believe id is depricated s:iterator id=outerList value=outerList s:iterator id=innerList value=#outerList s:property / /s:iterator /s:iterator On Thu, Nov 24, 2011 at 5:44 AM, SATHYA itsprakas...@gmail.com wrote: Hi, I am facing a problem in Iterating the below collection using struts taglib. ListListlt;String outerList; s:iterator id=outerList value=outerList s:iterator id=innerList value=?? s:property / /s:iterator /s:iterator please let me know what i need to mention in place of ? Many thanks in advance. -- View this message in context: http://struts.1045723.n5.nabble.com/Nested-Iterator-tag-tp5018197p5018197.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Edit a list of Strings to action
try s:iterator value=*inputStrings* status=*sts* var=s s:textfield name=*inputStrings[%{#sts.index}].value* value=%{#s}/ s:textfield or s:iterator value=*inputStrings* status=*sts* s:textfield name=*inputStrings[%{#sts.index}].value* value=%{top}/ s:textfield On Mon, Oct 24, 2011 at 2:21 PM, roger roger.var...@googlemail.com wrote: s:textfield=inputStrings[%{#sts.index}].value value=%{inputStrings[#sts.index].value} -- View this message in context: http://struts.1045723.n5.nabble.com/Edit-a-list-of-Strings-to-action-tp4931270p4931445.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: an odd problem about struts2 annotation
sorry just to be clear did you jar the classes or did you war the classes? if you jar the classes then i dont think struts 2 will scan your classes in jars. On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng cmaj...@gmail.com wrote: hi,everyone I meet an odd problem with struts2 annotation,Let me elaborate it first import java.util.List; import lombok.Getter; import lombok.Setter; import org.apache.commons.lang.StringUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import org.apache.struts2.interceptor.validation.SkipValidation; import org.springframework.beans.factory.annotation.Autowired; import com.dbappsecurity.portal.model.PortalUser; import com.dbappsecurity.portal.service.PortalUserService; import com.opensymphony.xwork2.ActionSupport; @Results({ @Result(name=input,location=main.jsp), @Result(name=list,location=list.jsp) }) public class MainAction extends ActionSupport { @Getter @Setter private PortalUser user; @Autowired private PortalUserService portalUserService; public String execute() throws Exception { return INPUT; } @Action(addUser) public String addUser() throws Exception { portalUserService.addUser(user); return listUser(); } @Action(listUser) @SkipValidation public String listUser() throws Exception { List theUserList = portalUserService.getPortalUserList(null); ServletActionContext.getRequest().setAttribute(userList,theUserList); return list; } @Action(modifyUser) public String modifyUser() throws Exception { List theUserList = portalUserService.getPortalUserList(null); ServletActionContext.getRequest().setAttribute(userList,theUserList); return list; } this is the struts2 action class, I configure it correctly and type the url http://domain/listUser it will list all users http://domain/modifyUser it can modify the users all things go well in tomcat with exploded class files but when I build with the war file and deploy it into tomcat webapp folder, the page report there is no action name listUser the difference between the two scenario is exploded class files and archived class files that I compile and jar the action and other class files into it. I was puzzled about this phenomenon so any suggestions and advices will be very appreciated!
Re: an odd problem about struts2 annotation
for one reason is that struts2 will not scan your classes in jar is that if someone tempered with you jar or any of your jar has class with Struts Annotations then your user can access these actions without you knowing it. I believe this is the same reason why Spring doesnt scan files in jars and in order to use them you have to declare them explicitly in xml files. On Fri, Sep 30, 2011 at 10:49 AM, dan.zheng cmaj...@gmail.com wrote: I know some tricky about this problem the struts convention will scan action class in the specific package for example: struts.convention.package.locators indicate the action class suffix but when you jar the classes,I suppose that struts2 can't scan the action class in jar files,if this is true,I will always deploy war with class files exploded,I want to find a workaround,thanks On Fri, Sep 30, 2011 at 10:22 AM, dan.zheng cmaj...@gmail.com wrote: I jar the classes and put it into WEB-INF/lib of course you know,the war will package all jars and jsp files in bundle why the struts2 can't scan classes in WEB-INF/lib? On Fri, Sep 30, 2011 at 10:05 AM, Steven Yang kenshin...@gmail.com wrote: sorry just to be clear did you jar the classes or did you war the classes? if you jar the classes then i dont think struts 2 will scan your classes in jars. On Thu, Sep 29, 2011 at 2:34 PM, dan.zheng cmaj...@gmail.com wrote: hi,everyone I meet an odd problem with struts2 annotation,Let me elaborate it first import java.util.List; import lombok.Getter; import lombok.Setter; import org.apache.commons.lang.StringUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import org.apache.struts2.interceptor.validation.SkipValidation; import org.springframework.beans.factory.annotation.Autowired; import com.dbappsecurity.portal.model.PortalUser; import com.dbappsecurity.portal.service.PortalUserService; import com.opensymphony.xwork2.ActionSupport; @Results({ @Result(name=input,location=main.jsp), @Result(name=list,location=list.jsp) }) public class MainAction extends ActionSupport { @Getter @Setter private PortalUser user; @Autowired private PortalUserService portalUserService; public String execute() throws Exception { return INPUT; } @Action(addUser) public String addUser() throws Exception { portalUserService.addUser(user); return listUser(); } @Action(listUser) @SkipValidation public String listUser() throws Exception { List theUserList = portalUserService.getPortalUserList(null); ServletActionContext.getRequest().setAttribute(userList,theUserList); return list; } @Action(modifyUser) public String modifyUser() throws Exception { List theUserList = portalUserService.getPortalUserList(null); ServletActionContext.getRequest().setAttribute(userList,theUserList); return list; } this is the struts2 action class, I configure it correctly and type the url http://domain/listUser it will list all users http://domain/modifyUser it can modify the users all things go well in tomcat with exploded class files but when I build with the war file and deploy it into tomcat webapp folder, the page report there is no action name listUser the difference between the two scenario is exploded class files and archived class files that I compile and jar the action and other class files into it. I was puzzled about this phenomenon so any suggestions and advices will be very appreciated!
Re: Problem with checkbox's tooltip when overriding the css_xhtml template
I am not completely sure here but if I am not wrong the default struts theme is xhtml. so try to remove struts.ui.theme=css_xhtml because some how I remember the theme name is xhtml instead of css_xhtml even though the folder name is constructed otherwise. On Tue, Sep 20, 2011 at 3:59 AM, Arnaud Thimel thi...@codelutin.com wrote: up ! Does any one know what I'm doing wrong ? Regards, Arnaud. On 14/09/2011 22:18, Arnaud Thimel wrote: Hi all, When I copy the checkbox.ftl file from [1] to my webapp's classpath, the tooltip does not display. According to [2], I have nothing more to do, but it does not work. In the struts.properties I have: struts.ui.theme=css_xhtml Once my war is built, my checkbox.ftl file (exact copy of [1]) is located at : WEB-INF/classes/template/css_xhtml/checkbox.ftl I submitted a bug-report [3] thinking that I was doing right, but it seems that I have to ask here first if this is a normal behaviour or if it's a real bug. So here is my question : what am I doing wrong ? Is it a real bug ? Thanks in advance. Best regards, Arnaud. [1] struts2-core-2.2.3.1.jar!/template/css_xhtml/checkbox.ftl [2] http://struts.apache.org/2.0.14/docs/template-loading.html [3] https://issues.apache.org/jira/browse/WW-3679 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: URL is stripped of its parameters on redirectAction
I think the document is only talking about how to include dynamic parameters for redirectAction you should do something like result type=redirectAction param name=actionNameNavigateTo/param param name=myParametermyValue/param /result see http://struts.apache.org/2.0.6/docs/redirect-action-result.html On Sat, Sep 17, 2011 at 11:27 PM, JOSE L MARTINEZ-AVIAL jlm...@gmail.comwrote: Hi, According to the documentation( http://struts.apache.org/2.2.3/docs/parameters-in-configuration-results.html ) it is possible to use parameters in a URL on a RedirectAction, as follows: result type=redirectActionNavigateTo?myParameter=myValue/result But when I use that, the redirect instruction does not have the parameter, only the first part of the URL. Is there anything I'm missing? Thanks JL
Re: OGNL context lookup
so what you want is dynamically finding values on top of the OGNL stack? I am pretty sure its not possible directly through existing tags. But if write your own method which is like public Object getValueFromStack(String key) { return stack.findValue(key) } (havent gone to check how exactly to get the stack in Java, but I am sure you know how) then just do s:property value=getValueFromStack(#param)/ or just put all your possible values in a map then you can do s:property value=someMap[#param]/ On Tue, Aug 9, 2011 at 12:24 AM, CRANFORD, CHRIS chris.cranf...@setech.comwrote: I have a JSP page where I need to iterate over a list of strings and for each string, I need to query the OGNL stack and get the value that string name represents followed by adding the name/value pair to a URL. I thought something like the following would work but it doesn't. Can anyone help? s:url id=url action=actionCallback s:iterator value=params var=param status=paramStatus s:param name=top/s:property value=#top//s:param /s:iterator /s:url - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Doubt on Struts 2 Architechture
and by the way, interceptors dont get called again after action is completed they just havent ended when the action is and result is done. On Tue, Jul 19, 2011 at 10:17 PM, mmcken...@wernervas.com wrote: The struts2 architecture allows for preprocessing and post processing of requests. What if you wanted to record how long it takes for a request to be processed? You could have an interceptor on the top of your request that records the start time and the same interceptor will record the end time when the request is on its way out. The struts2 in action book has an excellent chapter on interceptors which I highly recommend reading. Hope this helps. Mitch From: mohan rao mohanara...@gmail.com To: user@struts.apache.org Date: 07/18/2011 09:06 PM Subject:Doubt on Struts 2 Architechture Interceptors stack will be triggered before action class is executed and after the result. Why it's need to execute interceptors stack once again after result. I used all the interceptors before triggering an action and what's the purpose of calling these interceptors once again after action without doing anything. Moreover it will take time to execute all the interceptors once again. why the sturts2 architecture is designed like this. Please through some light on this. Thank you very much. -- View this message in context: http://struts.1045723.n5.nabble.com/Doubt-on-Struts-2-Architechture-tp4601232p4601232.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to display data from database to JSP Page in Struts2
some hints about Java naming convention 1. package names are all lower cases 2. field/properties/variables begin with lower case letter, only class/interface...etc. begin with upper case letter yes you should make a separate class for retrieving data. Action is for preparing data for your view(jsp) to use. On Sat, Jul 9, 2011 at 8:32 PM, log2akshat akshat-...@iiitmk.ac.in wrote: Thanks a lot Dave for your really helpful suggestions, I was doing something rubbish by retrieving the OnlineID more than once, now I have rectified my code as ... public int getOnlineID() { return OnlineID; } public void setOnlineID(int OnlineID) { this.OnlineID = OnlineID; } and declared OnlineID in the starting as : private int OnlineID; and removed the extra Variable from the Code and the Code is working. and yes, I am making Email as Unique ID at DB level as well as before user enters the form he will be validated that he has not already applied before. package net.Candidate.application.action; Again, I would strongly urge you to follow normal Java naming conventions This is the directory structure where where my Action class is sitting, is that something wrong here and shall I make another class file where DB transactions should be executed? -- View this message in context: http://struts.1045723.n5.nabble.com/How-to-display-data-from-database-to-JSP-Page-in-Struts2-tp4566721p4568007.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.2.3 i18n properties not reloaded after redeployed
i am not sure if there was any bug fix regarding i18n reload. but can you describe how you redeploy your app? do shutoff your server then deploy then start? or do you just deploy without turning off anything? On Mon, Jun 20, 2011 at 1:55 PM, Vincent Lin vincent.lin...@gmail.comwrote: Hi, We migrated to Struts 2.2.3 recently. But we found that i18n properties are not reloaded after the web application redeployed. After setting struts.i18n.reload=true, it will be reloaded after redeployed. But page rendering speed is slow. Before 2.2.3, we were using Struts 2.0.11, the i18n properties will be reloaded after the web app is redeployed with struts.i18n.reload=false. Can we set any configuration to let i18n properties reloaded in 2.2.3 without setting struts.i18n.reload=true? It seems to hurt performance a lot. Thanks! Vincent Lin - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: chain or redirectAction ResultType
I am not sure whats good for you because I usually put the logic for same page in the same Action. So for your case I would just write one Action. However I do understand the need of separating modification logic from pure display data logic. In your case you could at one param in redirectAction for each parameter you have so your Institution will get populated, but of course these parameters will be transferred via Get parameters and shown on the browser URL. or you could put them in session and take the values out when you get to Institution. These are the 2 ways i can think of write now. dont know if anyone else can suggest better way of doing these On Wed, Jun 1, 2011 at 12:34 AM, Sachin Lale lalesach...@gmail.com wrote: So in the given below scenario what is the best approach so that the form values on UI get populated with hidden values/parameters? On 31-05-2011 08:07, Steven Yang wrote: chaining is not recommended. basically as you have observed, chaining is a server-side redirect. you go to another page without changing client's browser url. i have not seen a formal argument of the bad of it (or i forgot) but what i have observed is that the user may hit Reload on browser and get unexpected behavior for both the user and developer On Tue, May 31, 2011 at 5:13 AM, Sachin Lalelalesach...@gmail.com wrote: Hi, I am migrating an application from struts1.1 to struts 2.2.3. I have two action 1. InstitutuionAction : The purpose is to prepare the data required to display and then forward to a Institution.JSP (using tiles) 2. InstitutionAddEditAction: This action exposed two methods insert, update and validate. The insert and validate method of InstitutionAddEditAction class looks like below public String insert() throws Exception { log.info(In InstitutionStrutsAddEditAction+institution.getName()); return Action.SUCCESS; } public void validate() { if(institution.getName().equals(abc)) addActionError(font color=\red\ Invalid Name ./font); } struts.xml action name=Institution method=execute class=edu.wustl.clinportal.action.struts2.InstitutionStruts2Action result name=success type=tiles.clinportal.institutionDef/result result name=failure type=tiles.clinportal.institutionDef/result result name=access_denied/ManageAdministrativeData.do/result /action action name=InstitutionAddEdit_* method={1} class=edu.wustl.clinportal.action.struts2.InstitutionStrutsAddEditAction result name=input type=redirectAction param name=actionNameInstitution/param param name=operationadd/param param name=pageOfpageOfInstitution/param param name=menuSelected2/param /result result name=success type=redirectAction param name=actionNameInstitution/param /result /action After a validation error it is getting redirect to Institution.action but not re-populating the data entered by the users obvious reason as the request is redirected and not forward. Everything works fine if i replace the result type to chain and could populate the Institution name (this object is in InstitutionAddEditAction class). I added a Institution object in InstitutuionAction class. I tried the same scenarion using chain this time. Its worked as well. Is ChainInterceptor populating this object? But is using chain a recommended approach. What is harm in using chain.? Best regards, Sachin - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: chain or redirectAction ResultType
chaining is not recommended. basically as you have observed, chaining is a server-side redirect. you go to another page without changing client's browser url. i have not seen a formal argument of the bad of it (or i forgot) but what i have observed is that the user may hit Reload on browser and get unexpected behavior for both the user and developer On Tue, May 31, 2011 at 5:13 AM, Sachin Lale lalesach...@gmail.com wrote: Hi, I am migrating an application from struts1.1 to struts 2.2.3. I have two action 1. InstitutuionAction : The purpose is to prepare the data required to display and then forward to a Institution.JSP (using tiles) 2. InstitutionAddEditAction: This action exposed two methods insert, update and validate. The insert and validate method of InstitutionAddEditAction class looks like below public String insert() throws Exception { log.info(In InstitutionStrutsAddEditAction+institution.getName()); return Action.SUCCESS; } public void validate() { if(institution.getName().equals(abc)) addActionError(font color=\red\ Invalid Name ./font); } struts.xml action name=Institution method=execute class=edu.wustl.clinportal.action.struts2.InstitutionStruts2Action result name=success type=tiles.clinportal.institutionDef/result result name=failure type=tiles.clinportal.institutionDef/result result name=access_denied /ManageAdministrativeData.do/result /action action name=InstitutionAddEdit_* method={1} class=edu.wustl.clinportal.action.struts2.InstitutionStrutsAddEditAction result name=input type=redirectAction param name=actionNameInstitution/param param name=operationadd/param param name=pageOfpageOfInstitution/param param name=menuSelected2/param /result result name=success type=redirectAction param name=actionNameInstitution/param /result /action After a validation error it is getting redirect to Institution.action but not re-populating the data entered by the users obvious reason as the request is redirected and not forward. Everything works fine if i replace the result type to chain and could populate the Institution name (this object is in InstitutionAddEditAction class). I added a Institution object in InstitutuionAction class. I tried the same scenarion using chain this time. Its worked as well. Is ChainInterceptor populating this object? But is using chain a recommended approach. What is harm in using chain.? Best regards, Sachin
Re: Access to ActionContext.getContext().getName() using OGNL
like Jason said they way i do it is writing a getter method in my action say getActionName() then in it i do ActionContext.getContext().getName() dunno if there is a better way because i have been doing this since the beginning of Struts2 or even Webwork time On Sun, May 29, 2011 at 10:48 AM, jlm...@gmail.com wrote: The reason is that I have JSP which contains a form that it's used for the creation and modificatio of records. Depending on the name of the action, it is a creation (in which certains field should be modifiable) or a modification (in which those certains fields should be radonly). I was hoping to be able to do that using Struts2 tags, that's why I need to get the name of the action. Sent via BlackBerry from T-Mobile -Original Message- From: Jason Pyeron jpye...@pdinc.us Date: Sat, 28 May 2011 22:39:08 To: 'Struts Users Mailing List'user@struts.apache.org Reply-To: Struts Users Mailing List user@struts.apache.org Subject: RE: Access to ActionContext.getContext().getName() using OGNL -Original Message- From: JOSE L MARTINEZ-AVIAL [mailto:jlm...@gmail.com] Sent: Saturday, May 28, 2011 16:53 To: Struts Users Mailing List Subject: Access to ActionContext.getContext().getName() using OGNL Hi, I've been looking for a while, but haven't found anything, so I'm asking here. How can I get the name of the action from a Struts2 Tag? IOW, I would like to do something like ActionContext.getContext().getName(), but using s:property Why (so I can help better)? value=name/. While this is not an answer to your question, this may help your (assumed) end goal. In the latest revision or release = 2.1.6 The s:url / will create a link to the current action. I haven't found any information on how to do that. If all else fails, kake a getter in your action. Thanks Jose -Jason -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Iterator tag and enumeration
try s:select list=@{full package name}.Localization@values()/ On Thu, May 12, 2011 at 3:33 PM, matthieu.m...@ensam.eu wrote: Hi, I have an enumeration 'Localization' : public enum Localization { AIX(Aix-en-provence), ANGERS(Angers) ; } And I want to put a form select in a jsp using s:select tag with all Localization items, like : s:select list=Localization enum/ But I don't know what to put in the list parameter. In my Localization enum, I wrote a function to retrieve Localization item through a sorted map : public MapString, String getListLocalization() { [...] } So that my select will be like : option value=aixAix-en-provence/option My question is finally : how to put an enumeration in a s:select tag ? Thanks, Matthieu MARC --- Matthieu MARC Responsable du Service Informatique du Centre d'Angers Arts et Métiers ParisTech Tél : 02 41 20 73 61 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Iterator tag and enumeration
I dont quite get what exactly you want if your getListLocalization has all the information of you Enum then you probably just do list=listLocalization.entrySet but then you still need to provide the listValue and listKey attribute On Thu, May 12, 2011 at 6:56 PM, matthieu.m...@ensam.eu wrote: This code is working : s:select list=@org.ensam.annuaire.enumeration.Localization@values() / This one is not working : s:select list=@org.ensam.annuaire.enumeration.Localization@getListLocalization () / Neither this one : s:select list=@org.ensam.annuaire.enumeration.Localization@listLocalization () / And neither this one : s:select list=@org.ensam.annuaire.enumeration.Localization@listLocalization / I would be great to make the getListLocalization() work because I will be able to have a nice display of select element. Thank Matthieu MARC -Message d'origine- De : Steven Yang [mailto:kenshin...@gmail.com] Envoyé : jeudi 12 mai 2011 12:34 À : Struts Users Mailing List Objet : Re: Iterator tag and enumeration try s:select list=@{full package name}.Localization@values()/ On Thu, May 12, 2011 at 3:33 PM, matthieu.m...@ensam.eu wrote: Hi, I have an enumeration 'Localization' : public enum Localization { AIX(Aix-en-provence), ANGERS(Angers) ; } And I want to put a form select in a jsp using s:select tag with all Localization items, like : s:select list=Localization enum/ But I don't know what to put in the list parameter. In my Localization enum, I wrote a function to retrieve Localization item through a sorted map : public MapString, String getListLocalization() { [...] } So that my select will be like : option value=aixAix-en-provence/option My question is finally : how to put an enumeration in a s:select tag ? Thanks, Matthieu MARC --- Matthieu MARC Responsable du Service Informatique du Centre d'Angers Arts et Métiers ParisTech Tél : 02 41 20 73 61 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Tag iterator and my object container
you need to implement the Iterator interface On Tue, May 10, 2011 at 4:14 PM, matthieu.m...@ensam.eu wrote: Hi everybody, I have a container object SearchResults which contains a treeMap of simple object SearchResult. I want to iterate over SearchResults in order to display properties of all SearchResult object Class SearchResult { //getter and setter getDescription(); } Class SearchResults { treeMapString, SearchResult resultats; public SetString keyset(); public IteratorString iterator(); public SearchResult get(String key); } My Action class have this getter : getResultats(){ return (SearchResults)object; }; And my JSP look like : s:iterator value=resultats s:property value=description / /s:iterator But it is not working, s:iterator tag is not iterating over my SearchResults object using the iterator() method (not called). How must I construct my SearchResults object in order to make the s:iterator tag iterate over it ? Thanks. Matthieu MARC --- Matthieu MARC Responsable du Service Informatique du Centre d'Angers Arts et Métiers ParisTech Tél : 02 41 20 73 61 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Debug problem, one http request is send twice.
I used to have problem with FF submitting multiple times. You have to check your event handlers on your submit buttons. Check to see if you accidentally more than one event handlers on one submit button that does form.submit, or make sure the event handler you want to do the submit stops the bubbling for any parent handlers to submit. On Mon, Apr 11, 2011 at 10:25 AM, DanY Liu danyun@gmail.com wrote: I tried several times later, it seems not a issue in struts, only firefox4 will do that. On Sat, Apr 9, 2011 at 11:36 PM, Dave Newton davelnew...@gmail.com wrote: Without more info it'll be difficult to help. Dave On Saturday, April 9, 2011, DanY Liu danyun@gmail.com wrote: Hi all, I want to try the model driven and prepare interceptors in struts 2, so I wrote a example. Then I was going to debug the program, every time , one http request make two request in the struts, in other words, when the return SUCCESS called(the html is populated in the browser successfully), the program turn to the constructor of the action and every process been run again.. . I set the breakpoints at the constructor , void prepare() and getModel(). Could someone can help on this odd problem? The IDE is Intellij 10.03 and the struts version is 2.2.2.1, browser : firefox 4 or chrome 10.0 thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Unable to pass a date as a parameter a action
try setting devMode=true and set logging to DEBUG and see what message you get On Sat, Mar 12, 2011 at 2:59 AM, Jainitya jainitya.jaiys...@gmail.comwrote: Hi I have to pass a parmeter to action s:url action=DailyShopStockChart id=url s:param name=date value=date/ /s:url Now the Problem is : this code is unable to call the actionDailyShopStockChart //Output URL on web:/LSMS/DailyShopStockChart.action?date=2011-01-01 if i remoove the {s:param name=date value=date/} I am able to call the action. //Output URLon web:/LSMS/DailyShopStockChart.action If I change this Param shopLog.dateSubmit with shopmaster.idShopMaster then it also call the action with idShopMaster //Output URLon web:/LSMS/DailyShopStockChart.action?shopmaster.idShopMaster=1 Could you please help me to pass this date as an parameter to this action -- View this message in context: http://old.nabble.com/Unable-to-pass-a-date-as-a--parameter-a-action-tp31127824p31127824.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Re : Re : Re : url question
On Fri, Mar 11, 2011 at 11:10 AM, François Rouxel rouxe...@yahoo.comwrote: well thx, but I need struts2 to do a little job, parse the url...and go to another action... without changing the url... because, actually, there is no www.mysite.com/abusiness.html try chain? redirectAction is client-side redirect, chain is server-side redirect it's just a fake, but I want to 'redirect', 'forward' I don't know the right word, to the a detail business page that don't exist ...and I need struts2 to give me the params.. what are the others way to tell struts, hey parse the url (abusiness.html) and give me the right page...? a mvc can do that, no? am I the only one generating permaLink? Francois Rouxel - Message d'origine De : Dave Newton davelnew...@gmail.com À : Struts Users Mailing List user@struts.apache.org Cc : François Rouxel rouxe...@yahoo.com Envoyé le : Jeu 10 mars 2011, 21h 55min 34s Objet : Re: Re : Re : url question On Thu, Mar 10, 2011 at 9:52 PM, François Rouxel rouxe...@yahoo.com wrote: does struts2 have a type='forward' ? because I use type='redirectAction' Like I said--a redirect... redirects. http://struts.apache.org/2.x/docs/result-types.html http://struts.apache.org/2.x/docs/dispatcher-result.html The documentation is your friend. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: AJAX Sessions
Like Dave said The way I did it is in the LoginInterceptor I check the header to see if its an XHR (i have special header for all my XHR calls, I dunno any other way to distinguish between normal http call and xhr, if anyone has better way please do share), and if it is return a special header, then in my javascript will just see if that special header exists. and if its normal http call then just do redirect On Fri, Jan 28, 2011 at 11:09 AM, Dave Newton davelnew...@gmail.com wrote: Your Ajax call checks for an error status and redirects. I used to handle this with a filter that checks for XHR and send back something more appropriate. Dave On Thursday, January 27, 2011, CRANFORD, CHRIS chris.cranf...@setech.com wrote: Depends on the page; but yes many are user initiated. All the AJAX tutorial examples I have seen always seem to return SUCCESS in the call; however I have yet to see how I would return an error to my AJAX call. Lets take an example, I have a LoginInterceptor which checks the HttpSession to see if its invalid or if the HttpSession is missing the our session user data object. If either condition is met; the interceptor returns LOGIN. This LOGIN maps to a global result - /login.jsp. In an AJAX situation; lets say that upon clicking a button, a call is made to the server, it forwards to SUCCESS and the JSP tidbit served back is placed in a DIV. How would you handle clearing the screen and sending the user to the LOGIN page without putting the LOGIN page in that DIV? I really want to implement AJAX/JSON stuff properly in this application properly. -Original Message- From: Scott [mailto:stanl...@gmail.com] Sent: Thursday, January 27, 2011 8:37 PM To: 'Struts Users Mailing List' Subject: RE: AJAX Sessions Are these Ajax requests *not* human initiated? IOW, are they timers? From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] Sent: Thursday, January 27, 2011 8:29 PM To: Struts Users Mailing List Subject: AJAX Sessions In our application upon a successful authentication, the HttpSession property setMaxInactiveInterval is set to whatever our application's idle time out is so that if this value is reached, the session is destroyed and upon the next request to the server, the user will be redirected to a login page. This concept worked just fine until I wanted to introduce dynamic content via AJAX. Now I need to be able to control when the session truly expires by user interaction versus dynamic interaction by an AJAX enabled web page. I am considering using an interceptor concept where I group by actions into two groups; ones considered AJAX calls and those which are not meant to return JSON data. When the user selects a non-AJAX action; an interceptor runs and performs the following checks: 1. Is HttpSession valid? No - LOGIN Yes - Step #2 2. Does HttpSession contain value holding time of last User request? No - Create one, store it in session, proceed Yes - Compare current time to this value. If difference timeout - LOGIN If difference timeout - Step #3 3. Update HttpSession value of last request to current time and Proceed to handle request This way, I validate whether the HttpSession has truly expired due to lack of USER input versus automated INPUT from an AJAX call. For an AJAX based call; this interceptor would not fire. While the idle time on the HttpSession would be reset; the time of last request isn't updated; thus allowing user interaction to continue to track idle timeout. What have others done in your applications so that you can handle proper timeout of a sessions despite the fact your application may be getting AJAX requests refreshing the idle time on the session object? Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1204 / Virus Database: 1435/3406 - Release Date: 01/27/11 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Localice text through hierarchy.
IIRC, LocalizedTextUtil looks for package according to the Class hierarchy. What I mean is if your MyAction extends Struts' ActionSupport then after looking a MyAction.properties and the package.properties in the same package it will be looking for ActionSupport.properties and package.properties in the same package as ActionSupport, then so on. So I am not sure if LocalizedTextUtil actually looked for the package.properties in com.acme, unless MyAction extends some action or implements some interface in that package. Also I dont think it will ever look in the to package.properties in your root unless your action extends some class in there which i doubt. if you want to make the package.properties in root global you should use struts.custom.i18n.resources in struts.properties or struts.xml please correct me if i am wrong On Thu, Jan 20, 2011 at 10:47 PM, JOSE L MARTINEZ-AVIAL jlm...@gmail.comwrote: Anyone has any idea how to avoid this?. Thanks JL 2011/1/17 JOSE L MARTINEZ-AVIAL jlm...@gmail.com Hi, I'm using Struts 2.1.8.1, and I've found an odd behaviour in the way LocalizedTextUtil looks for a text. The situation is a follows: package.properties com/ acme/ package.properties actions/ MyAction. So I have two package.properties, one at the root directory, and the other one in com.acme. MyAction is trying to use a text defined in the first one, but it seems that once LocalizedTextUtil has located com.acme.package.properties, and not found the text, it doesn't try to go up in the hierarchy, and therefore it does not return the text. Is that behaviour correct? Thanks Jose Luis
Re: JSON Property
I think its bundled with S2 but as a separate jar, so dont get mistaken. i am a bit reluctant to share my code, which is old and bad, not that because i am cheap or anything, its because there are better and well-thought code out there (as in JSON plug in) and my code has lots of things tied to my project (bad design..). and you know what i just checked back on my tag code. I dont think i am doing anything much different from what your doing. I siimply copied the s:property tag code and replaced the output part of the code. here is the part i replaced.(my tag mimics the property tag) try { if (actualValue != null) { if (!(actualValue instanceof String)) { //if String then treated its as if in JSON format actualValue = JSONUtil.toJSON(actualValue); } writer.write(actualValue.toString()); } else if (defaultValue != null) { writer.write(defaultValue); } } catch (IOException e) { LoggerUtil.BASE_LOGGER.info(error ocurred while writing json: + actualValue, e); } On Wed, Jan 5, 2011 at 4:59 PM, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: The json plugin is bundled with S2, because previously was on google code, and one had to download separately 2011/1/5 Jim Talbut jim.tal...@groupgti.com: You are both right. The tag that I'm using at the moment (which isn't fully tested at all, got some data issues to sort out first) is just the property tag with the following modification: Object objectValue = getStack().findValue(value, throwExceptionOnELFailure); try { actualValue = JSONUtil.serialize( objectValue ); } catch( JSONException ex ) { LOG.error(Could not convert {} to a JSON serialized value: {}, objectValue, ex); } Given that I'm using a utility function from the JSON plugin it does seem to make sense to have that plugin provide this tag. I've filed a feature request against it ( https://issues.apache.org/jira/browse/WW-3553), but it doesn't seem to be a very active project. I'm also confused by the fact that this page https://cwiki.apache.org/S2PLUGINS/json-plugin.html says that the plugin is bundled with Struts, although the JSONUtil class is not in struts-core. Steven, if you have a more complete and tested tag could you be persuaded to add it to the plugin, or just add what you've got to the bug? Jim -Original Message- From: Chris Pratt [mailto:thechrispr...@gmail.com] Sent: 05 January 2011 02:32 To: Struts Users Mailing List Subject: Re: JSON Property The plugin has several things it can do, from parsing JSON to generating JSON results. And yes, the default is to JSON up the whole Action, but you can have it objectify any object you want. And it is the collection point for JSON support in Struts 2. (*Chris*) On Tue, Jan 4, 2011 at 6:12 PM, Steven Yang kenshin...@gmail.com wrote: I might be wrong here. As I remember JSON Plugin turns the whole action into one single JSON object. I dont believe its what Jim wants, but most definitely there must be something Jim can use in the Plugin to transform his Java Objects to JSON. On Wed, Jan 5, 2011 at 2:47 AM, Chris Pratt thechrispr...@gmail.com wrote: The obvious place to me would seem to be the Struts 2 JSON Plug-in, since it handles all the other JSON duties for Struts 2. (*Chris*) On Tue, Jan 4, 2011 at 10:32 AM, Jim Talbut jim.tal...@groupgti.com wrote: I could do that (as Aaron Brown suggested on Monday) but I don't already have actions that spit out the right JSON. Creating more actions would be more work than creating JSON getters. Creating either actions or special getters also seems wrong to me - it's the JSP that needs JSON and it should only be the JSP that knows that it needs JSON. Obviously if one is dealing with AJAX one has no choice but to have JSON actions, but I'm not. I've now written a JSON tag, but given that Steven Yang and I have now written something to do the same job it seems to me that there ought to be some common entity for providing it (i.e. I think it should be in struts-json-tags). Jim -Original Message- From: Chris Pratt [mailto:thechrispr...@gmail.com] Sent: 04 January 2011 15:54 To: Struts Users Mailing List Subject: Re: JSON Property You might also need the executeResult=true attribute on the s:action tag. (*Chris*) On Tue, Jan 4, 2011 at 7:06 AM, Biesbrock, Kevin biesbrock.ke...@aoins.comwrote: I don't want to use a separate roundtrip for loading the jqGrid for two reasons: 1. I want to handle the contents of the grid, and additional fields, in a single transaction. 2. It's
Re: JSON Property
I might be wrong here. As I remember JSON Plugin turns the whole action into one single JSON object. I dont believe its what Jim wants, but most definitely there must be something Jim can use in the Plugin to transform his Java Objects to JSON. On Wed, Jan 5, 2011 at 2:47 AM, Chris Pratt thechrispr...@gmail.com wrote: The obvious place to me would seem to be the Struts 2 JSON Plug-in, since it handles all the other JSON duties for Struts 2. (*Chris*) On Tue, Jan 4, 2011 at 10:32 AM, Jim Talbut jim.tal...@groupgti.com wrote: I could do that (as Aaron Brown suggested on Monday) but I don't already have actions that spit out the right JSON. Creating more actions would be more work than creating JSON getters. Creating either actions or special getters also seems wrong to me - it's the JSP that needs JSON and it should only be the JSP that knows that it needs JSON. Obviously if one is dealing with AJAX one has no choice but to have JSON actions, but I'm not. I've now written a JSON tag, but given that Steven Yang and I have now written something to do the same job it seems to me that there ought to be some common entity for providing it (i.e. I think it should be in struts-json-tags). Jim -Original Message- From: Chris Pratt [mailto:thechrispr...@gmail.com] Sent: 04 January 2011 15:54 To: Struts Users Mailing List Subject: Re: JSON Property You might also need the executeResult=true attribute on the s:action tag. (*Chris*) On Tue, Jan 4, 2011 at 7:06 AM, Biesbrock, Kevin biesbrock.ke...@aoins.comwrote: I don't want to use a separate roundtrip for loading the jqGrid for two reasons: 1. I want to handle the contents of the grid, and additional fields, in a single transaction. 2. It's inefficient and unnecessary. Obviously the first is the more important :) I think you could do something like this in your jsp: input type=hidden name=jgrid-json-data value=s:action name=myJsonAction namespace=/json// This would allow you to use the already-in-place json result type and save you a lot of extra work. -Beez - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JSON Property
well for me I do have an custom tag the tag converts any entity into JSON, so for example i have ListMyEntity myEntities; in my JSP i can do s:iterator or output as Javascript array sx:json value=myEntities/ without action knowing what the output will be formated. and in the tag i have my own formatting rule for JSON. of course i am sure there are tones JAVA - JSON converter out there you can use. this way i have more control over the output (possibly more bug lol) thats the way i do it.. On Mon, Jan 3, 2011 at 9:23 PM, Jim Talbut jim.tal...@groupgti.com wrote: Yes, I thought about that, but it's even more work than creating a custom get method and equally unreusable. I've done this often enough that I think a custom tag is justified. The reason I keep wanting to do it is to set up jqGrid data so that I can have a parent record with children (the children being in the jqGrid and set via JSON) submitted as a single entity (I typically put the JSON data into a hidden field and then update it in the submit, but there are also other uses for the JSON data, such as selection lists, that don't get updated). Jim From: Aaron Brown [aa...@thebrownproject.com] Sent: 03 January 2011 13:11 To: Struts Users Mailing List Subject: Re: JSON Property Have you considered using an include? You can call a json-result-type action with it or switch to some other fragment result if needed. Perhaps it's quick and dirty compared with creating a custom tag but it seems to me it would be a lot easier to implement. - Aaron On Jan 3, 2011 6:50 AM, Jim Talbut jim.tal...@groupgti.com wrote: Hi, I keep needing to put the JSON equivalent of an expression into a JSP page to be used by client side javascript. This is done during the evaluation of the JSP, it's not AJAX. At the moment I'm doing it by creating a special get method on the action, but that's not nice - the action shouldn't need to know that I want the representation in JSON. I've started looking at creating an alternative tag to do the job, but it would be pretty much a complete copy of the property tag, but with an additional escape-type property to specify that the result should be JSON. It's slightly more complicated than that because the normal escapes should be applied afterwards too. Question: Is this something that should be implemented in the base property tag as an enhancement to struts itself, or should I just copy the property tag and get on with my life? Thanks Jim - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Parameter manipulation
is your user object initialized when the param interceptor is run? here i might be wrong, but what i know is if your object is initialized then Struts or OGNL will call getUser().setEmail(...) otherwise create a new User then setEmail then setUser then the second case should fail for you again, i might be wrong on the behavior On Thu, Dec 16, 2010 at 12:39 AM, Altenhof, David Aron dalte...@iupui.eduwrote: I've been getting more and more concerned about the possibility of parameter manipulation attacks with Struts2. I've started doing strict whitelists using the ParameterNameAware interface on all of my forms pages. However, today I tried to code a display-only page that shows information about a particular user. I thought that by simply creating a getter and no setter, it would be impossible to inject parameters. For example, my action only contains the following getter for a JPA model object: public User getUser() { return user; } However, by sending a simple query parameter, it is *still* possible to change values in user. For example, you can send: http://localhost:8080/MySite/userdisplay.action?user.email=newem...@address.com ... and it works. The email will become newem...@address.com Is there any way to shut this down other than whitelisting every single action in your site using ParameterNameAware? (Or simply never put model objects on your stack?) This is getting frustrating! -David - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Iterate through a List of Maps
yes try adding # before record - #record and since record is a map you can iterate through it directly without calling entrySet() On Tue, Dec 14, 2010 at 10:36 AM, Dave Newton davelnew...@gmail.com wrote: What version? Early versions sometimes required a # before the variable name when referencing vars defined by things like an iterator tag. Dave On Monday, December 13, 2010, JOSE L MARTINEZ-AVIAL jlm...@gmail.com wrote: Hello all, I'm trying to iterate through a List of Maps(I have a method public ListMap getRecords() in the action) using s:iterator. I can iterate through the List without problems, but I can not get it to iterate through the entries of the map. So far I've got this: [..] s:iterator value=records status=recordsStatus var=record s:if test=#recordsStatus.index ==0 tr td colspan=*/td /tr /s:if tr s:iterator value=record.entrySet() status=fieldStatus td s:property value=key//s:property value=value/ /td /s:iterator /tr /s:iterator [..] The tag generates the tr/tr for each entry, but it is not going through the second iterator, so I suppose I'm doing something wrong with the value attribute. Can you help me with it? Thanks Jose - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: OGNL map key reading
so currentPageHotelList[#stat.index] gives a Map? if ur using an iterator u can just do s:iterator value=list var=map -- of course u can use top as well but l like giving it a name s:property value=map[#roomindex]/ /s:iterator On Wed, Nov 17, 2010 at 4:13 PM, Emil Dombagolla dombago...@gmail.comwrote: Dear all, - s:property value=currentPageHotelList[#stat.index].room0/ //this works , i want room0 make dynamic ( like room0 to room4) s:iterator begin=0 end=5 s:set var=roomindex value='room'+top/s:set //this gives room0 ,room1 ,room2 etc... s:property value=currentPageHotelList[#stat.index].%{#roomindex}/ // this %{#roomindex} doesnt work - please help me to get the roomindex variable executed there to read my map If possible thank you so much, Emil
Re: Struts2 - implementing SSL
yes using SSL provided by web container or http server is the way to go i think the struts ssl plugin only provide convenient way to redirect certain page to https/http. for example, you might want to force your login page to be always accessed using https then it can help you easily redirect all http access to https On Wed, Nov 10, 2010 at 6:56 AM, Miguel miguel...@gmail.com wrote: Hello, I haven't used that plugin, but I recomend you to use the SSL provided by tomcat or your web container, it's easier. But if you want the best speed, i really suggest yo to use apache httpd with mod_ssl for the ssl work and mod_jk, to forward the traffic to tomcat or jetty. You can find documentation about this in the tomcat connectors page and the httpd documentation. Regards, Si quieres ser más positivo, pierde un electrón Miguel Ruiz Velasco Sobrino On Tue, Nov 9, 2010 at 15:12, Ken McWilliams ken.mcwilli...@gmail.com wrote: I'm just looking into this and have never implemented ssl before. I found this: http://code.google.com/p/struts2-ssl-plugin/ and was wondering if anyone here has used it? I looked on this list https://cwiki.apache.org/S2PLUGINS/home.html and didn't see any explicit mention of SSL, nor did I find reference in Struts2 in Action or Apache Struts 2 Web Application Development. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Missing message for key welcome.title in bundle (default bundle) for locale es
try message-resources parameter=com/myapp/struts/MessageResources/ and make sure your locale is es_ES and not just es (not sure if it matters, but just to be on the save side) On Wed, Nov 10, 2010 at 6:00 AM, bladu ego...@hotmail.com wrote: Hi, I have created a project basic project in Struts (Welcome Struts). In the package com.myapp.struts (which is ubicated in the Source files) y create a properties file called MessageResources_es_ES, which has the following content: welcome.title=Holamundo Struts welcome.heading=Bienvenida! welcome.message=Holamundo Struts In the struts-config.xml y put the following file: message-resources parameter=com/myapp/struts/MessageResources_es_ES/ When I try to run the aplication Apache tomcat gices me the following error: Missing message for key welcome.title in bundle (default bundle) for locale es I would be very grateful if somebody could help me to solve this question. Regards and thanks with anticipation. -- View this message in context: http://old.nabble.com/Missing-message-for-key-%22welcome.title%22-in-bundle-%22%28default-bundle%29%22-for-locale-es-tp30175630p30175630.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 - Generate XML in an Action, then direct user to download .xml
Hi Overby Result is indeed your choice to go. in general you should avoid any direct use of the Servlet stuff in your Actions. you should prepare your data in your action or execute then determine what data type you want to return then return the proper result string then let your Result format the data to what you ie. XML or JSON or even plain text this way your Action wont be view-dependent you can dig into struts' source to find many usable examples on how to do things in Result On Wed, Oct 13, 2010 at 2:05 PM, Grant Overby gove...@students.kennesaw.edu wrote: After some googling; I'm looking at the Result interface. Would it be proper for the action to set a property, and use this custom Result to read that property from ValueStack and write it to (with XStream for isntance) ServletActionContext.getResponse().getOutputStream() ? So Results exist for doing this for XML and/or JSON? It seems like it would be re-occurring situation, espectially with ajax? I'm just getting into Struts2; I'm looking to see if I'm doing things as they ought to be done. Best practices, etc. gove...@students.kennesaw.edu On Wed, Oct 13, 2010 at 1:02 AM, Li Ying liying.cn.2...@gmail.com wrote: You can generate your XML dynamically, and then write it to the response stream. If you set the response headers correctly, the browser should treat this response as a file downloading. Code in your action looks like this: public String execute() { String xmlStr = generateXML(); HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType(text/xml); response.setHeader(Content-Disposition, attachment; filename= + yourXmlFileName); OutputStream out = response.getOutputStream(); out.write(xmlStr.getBytes(UTF-8)); out.close(); return null; // this make sure the page not to jump } - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2+json question
this is the matter with how you handle your result in your javascript and how you communicate with your javascript in you case, you should always return a json because your doing your validation by AJAX right? its in your javascript that you need to tell whether the login was successful or not, if it is then redirect. I havent used Extjs for a while, so i dont remember whether ur syntax actually submits the page or Ext will submit by AJAX for you On Thu, Aug 5, 2010 at 11:49 PM, red phoenix rodphoe...@gmail.com wrote: I use struts2.1.8 and extjs3.2, I make a login page, if login failed,it will alert a message and it will still stay this login page; if it login success,it will go to another new page,such as main.jsp page My login page is follows: var win=new Ext.Window({ el:'hello-win', items: loginForm, buttons:[{ text:'OK', handler:function(){ if(win.getComponent('loginForm').form.isValid()){ win.getComponent('loginForm').form.submit({ url:'/Test/test.do', success:function(form,action){ Ext.Msg.alert(Login success!,action.result.message); }, failure:function(form,action){ Ext.Msg.alert('Login fail,action.result.message); } }); } } } }); Action class is follows: public String login() throws Exception{ boolean success;. if(success){ return SUCCESS; } else{ setMessage(Your ID or password is wrong); return null; } } configure file is follows: struts package name=Test namespace= extends=json-default action name=login class=Test.Login method=test result type=json/ /action /package /struts If I set resultmain.jsp/result, when I click OK button,it will raise javascript error,because extjs don't get json message. If I set result type=json/,whether I login success or fail,the login page will don't redirect,If login success,I want to redirect this page to main.jsp,but it don't redirect.What can I do about configure file? I don't know how to do it.I have no idea about it. Any idea will be appreciated! Thanks in advance - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Iterate over an ArrayList of arrays
try s:iterator value=breadcrumbs lia href=${top[1]}${top[0]}/a/li /s:iterator On Tue, May 11, 2010 at 5:52 PM, Thomas Lulé tho...@lule.fr wrote: I just found an ugly solution : ul s:iterator value=breadcrumbs s:iterator status=stat s:if test=#stat.index==0 s:set name=texts:property //s:set /s:if s:else s:set name=urls:property //s:set /s:else /s:iterator lia href=${url}${text}/a/li /s:iterator /ul 2010/5/11 Thomas Lulé tho...@lule.fr: Hi, I've got an ArrayListString[] named breadcrumbs in my action that I would like to display in my JSP. Something like : ul s:iterator value=breadcrumbs lia href=${value[1]}${value[0]}/a/li /s:iterator /ul I want to iterate over the ArrayList, then get the two values of the array, but this code obviously doesn't work. Do you have any better idea ? Thank you, Thomas - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to convert request parameters into Collection type - Set
simply loose the [n] just have all fields with name middleNames On Wed, Jan 20, 2010 at 8:34 PM, Mittal, Nitin (US - Mumbai) nimit...@deloitte.com wrote: Hi, I need help in mapping JSP text fields to a setter in action class which have parameter as SetString I know Struts 2 supports automatically converting sets of request parameters into properties of various Collection type Lists This can be done by having a setter in the action class as - setMiddleNames(ArrayListString middleNames) JSP code should contain text fields as follows:- s:textfield name=middleNames[0] label=middleNames/ s:textfield name=middleNames[1] label=middleNames/ s:textfield name=middleNames[2] label=middleNames/ Question :- How to map JSP text Fields or Hidden fields to setters in Action class which have parameter as SetString For example, how should I define text fields in JSP so that they can be mapped to the following setter in Action Class:- setMiddleNames(SetString) Thanks, Nitin Mittal Deloitte Consulting India Private Limited cell:+91 9819213942 | office:+91 22 66445762 | VOIP:+1 615-718-8170 | Fax:+91 22 66445999 nimit...@deloitte.com • Please consider the environment before printing. This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. [v.E.1]
Re: [S2] s:select can't use ENUM type
what does getComboBox accepting? an Enum value or Enum array? if an Enum value then you have to do @{include full package path}comboboxt...@sex On Wed, Dec 23, 2009 at 12:15 AM, mailtolouis2020-str...@yahoo.com wrote: Hi, I got problem to using ENUM type in s:select, here is my code: s:select label=Sex name=user.sex list=getComboBox(ComboBoxType.SEX) listKey=key listValue=value value=user.sex/ but if I change to use String (e.g: list=getComboBox('SEX')), and do the conversion in the action then it working fine. Is it a bug? Regards LV
Re: Getting result of JSP before sending to client
i will take a look at embeddedjsp plugin actually what we are doing is we have a form/survey and after user completes it, we, originally, want to save it as PDF which would have no problem for me, but due the time constraint we decided to simply save the file/report as HTML, thats why i want to know whats the simplest way to do it. The saved HTML may or may not look exactly the same as the page we return to the user, i am not sure yet. thanks On Thu, Oct 29, 2009 at 2:28 PM, Musachy Barroso musa...@gmail.com wrote: you can use the embeddedjsp plugin to process a jsp as a template library without using the container. another alternative is to create your own filter and create a response object which will have a writer to capture what is written to it, so you can modify it and then write it to the real output stream. Can you tell us what you are trying to do? maybe you don't need a jsp and could use freemarker or velocity. musachy On Wed, Oct 28, 2009 at 6:28 PM, Steven Yang kenshin...@gmail.com wrote: Hi I am wondering is there a way in Struts2 to get the result of JSP before returning the composed HTML back to client? for example public String execute() { ...do my logic and prepare my data ...then using the data, compose a HTML file from existing jsp ... then i need to save the HTML file somewhere ...then return SUCCESS; -- maybe to same HTML or other JSP } Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Getting result of JSP before sending to client
hi i just looked at embeddedjsp plugin it requires JAVA 1.6 which i am not using, only using 1.5. i also need to make sure saving the HTML is in the same Transaction(database transaction) as saving the record. Therefore, intercepting the result in filter may not be a solution for me. is there other way? Thanks On Thu, Oct 29, 2009 at 3:24 PM, Steven Yang kenshin...@gmail.com wrote: i will take a look at embeddedjsp plugin actually what we are doing is we have a form/survey and after user completes it, we, originally, want to save it as PDF which would have no problem for me, but due the time constraint we decided to simply save the file/report as HTML, thats why i want to know whats the simplest way to do it. The saved HTML may or may not look exactly the same as the page we return to the user, i am not sure yet. thanks On Thu, Oct 29, 2009 at 2:28 PM, Musachy Barroso musa...@gmail.comwrote: you can use the embeddedjsp plugin to process a jsp as a template library without using the container. another alternative is to create your own filter and create a response object which will have a writer to capture what is written to it, so you can modify it and then write it to the real output stream. Can you tell us what you are trying to do? maybe you don't need a jsp and could use freemarker or velocity. musachy On Wed, Oct 28, 2009 at 6:28 PM, Steven Yang kenshin...@gmail.com wrote: Hi I am wondering is there a way in Struts2 to get the result of JSP before returning the composed HTML back to client? for example public String execute() { ...do my logic and prepare my data ...then using the data, compose a HTML file from existing jsp ... then i need to save the HTML file somewhere ...then return SUCCESS; -- maybe to same HTML or other JSP } Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Getting result of JSP before sending to client
Hi I am wondering is there a way in Struts2 to get the result of JSP before returning the composed HTML back to client? for example public String execute() { ...do my logic and prepare my data ...then using the data, compose a HTML file from existing jsp ... then i need to save the HTML file somewhere ...then return SUCCESS; -- maybe to same HTML or other JSP } Thanks
Re: Exception using ParametersInterceptor to fill a SetString
actually you dont need to do that i only do action: private SetString email; public void setEmail(SetString email) { this.email = email; } jsp: input name=email value=val1/ input name=email value=val2/ input name=email value=val3/ ... then struts will populate it for me On Thu, Oct 22, 2009 at 1:12 PM, Marcelo Salhab Brogliato msbro...@vialink.com.br wrote: Hi Steven, I know that Set usually don't have orders. But how do I fill my set? I tried email[0] because I implemented this setter: void setEmail(int index, String email), and it just ignored index. It was a test. thanks, msbrogli On Oct 22, 2009, at 2:56 AM, Steven Yang wrote: Set usually dont have orders unless specifically implemented forif you need to preserver order then use List then email[0] will work On Thu, Oct 22, 2009 at 12:38 PM, Marcelo Salhab Brogliato msbro...@vialink.com.br wrote: I made some tests in a very simple application now and I got this results: input type=text name=cliente.email / input type=text name=cliente.email / input type=text name=cliente.email / Will add these emails to my set. But how can I access the first one? I'm trying this: s:textfield label=Email name=mystringset value=toArray()[0] / But this is not evaluating attribute value. Why? I tried: mystringset.toArray()[0] but it also didn't work. thanks! msbrogli On Oct 22, 2009, at 12:46 AM, Marcelo Salhab Brogliato wrote: Hi, in my action I have a client object that has a SetString email. In my http request, I have these data: client.email[0] = 'a...@def.com' client.email[1] = 'a...@b2.com' client.email[2] = 'a...@b2.com' But I'm getting an error in ParametersInteceptor. I created these setters: public void setEmail(int index, String email) public void setEmail(String[] email) public void setEmail(SetString email) But I'm already getting an exception. What is the right way to do this? Or this interceptor never fills a Set? thanks in advice, msbrogli - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Exception using ParametersInterceptor to fill a SetString
Set usually dont have orders unless specifically implemented forif you need to preserver order then use List then email[0] will work On Thu, Oct 22, 2009 at 12:38 PM, Marcelo Salhab Brogliato msbro...@vialink.com.br wrote: I made some tests in a very simple application now and I got this results: input type=text name=cliente.email / input type=text name=cliente.email / input type=text name=cliente.email / Will add these emails to my set. But how can I access the first one? I'm trying this: s:textfield label=Email name=mystringset value=toArray()[0] / But this is not evaluating attribute value. Why? I tried: mystringset.toArray()[0] but it also didn't work. thanks! msbrogli On Oct 22, 2009, at 12:46 AM, Marcelo Salhab Brogliato wrote: Hi, in my action I have a client object that has a SetString email. In my http request, I have these data: client.email[0] = 'a...@def.com' client.email[1] = 'a...@b2.com' client.email[2] = 'a...@b2.com' But I'm getting an error in ParametersInteceptor. I created these setters: public void setEmail(int index, String email) public void setEmail(String[] email) public void setEmail(SetString email) But I'm already getting an exception. What is the right way to do this? Or this interceptor never fills a Set? thanks in advice, msbrogli - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with available Strus2 Releases
So is 2.1.8 out but just not yet officially announced? and does http://people.apache.org/builds/struts/2.1.8/ provide the final version of 2.1.8? Thanks On Mon, Sep 28, 2009 at 9:16 PM, Wes Wannemacher w...@wantii.com wrote: Keep an eye out ;) -Wes On Mon, Sep 28, 2009 at 9:08 AM, Greg Lindholm greg.lindh...@gmail.com wrote: On Mon, Sep 28, 2009 at 12:59 AM, Lukasz Lenart lukasz.len...@googlemail.com wrote: At least, 2.1.8 was released and it's the latest GA version. I've never seen an announcement that 2.1.8 has been released and GA. Did I miss this? -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[S2] accessing enum inside a Class
Hi I know if I want to access an enum in JSP i can do s:property value=@com.my.package.mye...@my_value/ However if MyEnum is public in a class, say MyClass, how do it get the value? I tried @com.my.package.myclass.mye...@my_value @com.my.package.mycl...@myenum@MY_VALUE @com.my.package.mycl...@myenum.my_value @com.my.package.MyClass.MyEnum.MY_VALUE none worked. is there a way to do it? or its simply not permitted? I am using Struts 2.1.8 Thanks
Re: [S2] accessing enum inside a Class
yeahi just went back to check it is set to true On Tue, Sep 15, 2009 at 3:20 PM, Lukasz Lenart lukasz.len...@googlemail.com wrote: Did you set struts.ognl.allowStaticMethodAccess to true? Regards -- Lukasz http://www.lenart.org.pl/ http://dailylog.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Warning message when setting BigDecimal to list of bean
Hi I just added my custom BigDecimal converter and it worked. I guess because I took care of it. But isn't it suppose to be taken care of by OGNL or Xwork? because if I don't do it in a List, but as an direct Action property instead, there wont be any warning message. Thanks On Mon, Sep 14, 2009 at 1:15 PM, dusty dustin_pea...@yahoo.com wrote: I saw similar errors when a Type Converter did not return a null when an empty value was given. This could be an issue with the built-in conversion for Big Decimal. Can you try and override the Big Decimal converter with your own type converter and include code to return a null if the input value is blank? Steven Yang wrote: so...this is an OGNL error? is there a way to fix it? or should i file a bug? On Fri, Sep 11, 2009 at 12:32 AM, j alex strutstwou...@gmail.com wrote: hmm..i remember getting the warning even for doubles..as the error message says, OGNL fails when trying to set a String array (all request parameters are Strings ) into the BigDecimal field since it cannot find an appropriate setter. In connection to this, can anyone let me know how to suppress this message with lo4j.properties (not log4j.xml) configuration. On Thu, Sep 10, 2009 at 11:59 AM, Steven Yang kenshin...@gmail.com wrote: Sorry I forgot to mention I am using Struts 2.1.8 SNAP SHOT with XWork 2.1.6 samething happens with XWork 2.1.5 On Wed, Sep 9, 2009 at 2:03 PM, Steven Yang kenshin...@gmail.com wrote: Hi I have a bean like public class Account { private String type; private String name; private BigDecimal value1; private BigDecimal value2; private BigDecimal value3; //getter, setters } in my action i have public class TestAction extends ActionSupport { private ListAccount accounts = new ArrayListAccount(); //getter, setters, execute } in my JSP: tr tdinput type=text name=accounts[0].name//td tdinput type=text name=accounts[0].value1//td tdinput type=text name=accounts[0].value2//td tdinput type=text name=accounts[0].value3//td td%/td /tr tr tdinput type=text name=accounts[1].name//td tdinput type=text name=accounts[1].value1//td tdinput type=text name=accounts[1].value2//td tdinput type=text name=accounts[1].value3//td td%/td /tr When i submit the form, i get warning message like the following when the BigDecimal value fields are empty : 2009-09-09 13:52:44,156 [http-80-Processor125] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'accounts[0].value2' with value '[Ljava.lang.String;@165de14' ognl.MethodFailedException: Method setValue2 failed for object junit.adm.authority.acco...@7a8ba4[java.lang.nosuchmethodexception: junit.adm.authority.Account.setValue2([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)... If the fields have value, then there is no message for that particular field and value gets set properly. Only occur if the field is empty. If i change the property in Account to Double or double, there wont be any warning. I am not running under devMode = true. Is this a bug? or something else? Thanks -- View this message in context: http://www.nabble.com/Warning-message-when-setting-BigDecimal-to-list-of-bean-tp25359072p25430438.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Warning message when setting BigDecimal to list of bean
yeah i understand just thought it would be something that would be supported natively thats all just that you know when things go into production, some ppl are just afraid to see anything on the log file and whine a lot about it. i guess i will fix it myself or can you point me to the right direction of the place of the native type converter? is it in Xwork or OGNL? dont think its in Struts right? Thanks On Mon, Sep 14, 2009 at 10:43 PM, dusty dustin_pea...@yahoo.com wrote: Its not a huge deal, since the issue is What do I convert a blank to? You don't want it to be zero, and it ends up being null, but the type converter throws that error as it tries to figure out what to do. I would say a patch to just return null on blanks for the native type converters would be a good patch to submit. But it shouldn't cause problems other than spam your log if you don't have a customer converter or crank down your logging. Steven Yang wrote: Hi I just added my custom BigDecimal converter and it worked. I guess because I took care of it. But isn't it suppose to be taken care of by OGNL or Xwork? because if I don't do it in a List, but as an direct Action property instead, there wont be any warning message. Thanks On Mon, Sep 14, 2009 at 1:15 PM, dusty dustin_pea...@yahoo.com wrote: I saw similar errors when a Type Converter did not return a null when an empty value was given. This could be an issue with the built-in conversion for Big Decimal. Can you try and override the Big Decimal converter with your own type converter and include code to return a null if the input value is blank? Steven Yang wrote: so...this is an OGNL error? is there a way to fix it? or should i file a bug? On Fri, Sep 11, 2009 at 12:32 AM, j alex strutstwou...@gmail.com wrote: hmm..i remember getting the warning even for doubles..as the error message says, OGNL fails when trying to set a String array (all request parameters are Strings ) into the BigDecimal field since it cannot find an appropriate setter. In connection to this, can anyone let me know how to suppress this message with lo4j.properties (not log4j.xml) configuration. On Thu, Sep 10, 2009 at 11:59 AM, Steven Yang kenshin...@gmail.com wrote: Sorry I forgot to mention I am using Struts 2.1.8 SNAP SHOT with XWork 2.1.6 samething happens with XWork 2.1.5 On Wed, Sep 9, 2009 at 2:03 PM, Steven Yang kenshin...@gmail.com wrote: Hi I have a bean like public class Account { private String type; private String name; private BigDecimal value1; private BigDecimal value2; private BigDecimal value3; //getter, setters } in my action i have public class TestAction extends ActionSupport { private ListAccount accounts = new ArrayListAccount(); //getter, setters, execute } in my JSP: tr tdinput type=text name=accounts[0].name//td tdinput type=text name=accounts[0].value1//td tdinput type=text name=accounts[0].value2//td tdinput type=text name=accounts[0].value3//td td%/td /tr tr tdinput type=text name=accounts[1].name//td tdinput type=text name=accounts[1].value1//td tdinput type=text name=accounts[1].value2//td tdinput type=text name=accounts[1].value3//td td%/td /tr When i submit the form, i get warning message like the following when the BigDecimal value fields are empty : 2009-09-09 13:52:44,156 [http-80-Processor125] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'accounts[0].value2' with value '[Ljava.lang.String;@165de14' ognl.MethodFailedException: Method setValue2 failed for object junit.adm.authority.acco...@7a8ba4[java.lang.nosuchmethodexception: junit.adm.authority.Account.setValue2([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)... If the fields have value, then there is no message for that particular field and value gets set properly. Only occur if the field is empty. If i change the property in Account to Double or double, there wont be any warning. I am not running under devMode = true. Is this a bug? or something else? Thanks -- View
Re: Warning message when setting BigDecimal to list of bean
so...this is an OGNL error? is there a way to fix it? or should i file a bug? On Fri, Sep 11, 2009 at 12:32 AM, j alex strutstwou...@gmail.com wrote: hmm..i remember getting the warning even for doubles..as the error message says, OGNL fails when trying to set a String array (all request parameters are Strings ) into the BigDecimal field since it cannot find an appropriate setter. In connection to this, can anyone let me know how to suppress this message with lo4j.properties (not log4j.xml) configuration. On Thu, Sep 10, 2009 at 11:59 AM, Steven Yang kenshin...@gmail.com wrote: Sorry I forgot to mention I am using Struts 2.1.8 SNAP SHOT with XWork 2.1.6 samething happens with XWork 2.1.5 On Wed, Sep 9, 2009 at 2:03 PM, Steven Yang kenshin...@gmail.com wrote: Hi I have a bean like public class Account { private String type; private String name; private BigDecimal value1; private BigDecimal value2; private BigDecimal value3; //getter, setters } in my action i have public class TestAction extends ActionSupport { private ListAccount accounts = new ArrayListAccount(); //getter, setters, execute } in my JSP: tr tdinput type=text name=accounts[0].name//td tdinput type=text name=accounts[0].value1//td tdinput type=text name=accounts[0].value2//td tdinput type=text name=accounts[0].value3//td td%/td /tr tr tdinput type=text name=accounts[1].name//td tdinput type=text name=accounts[1].value1//td tdinput type=text name=accounts[1].value2//td tdinput type=text name=accounts[1].value3//td td%/td /tr When i submit the form, i get warning message like the following when the BigDecimal value fields are empty : 2009-09-09 13:52:44,156 [http-80-Processor125] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'accounts[0].value2' with value '[Ljava.lang.String;@165de14' ognl.MethodFailedException: Method setValue2 failed for object junit.adm.authority.acco...@7a8ba4 [java.lang.NoSuchMethodException: junit.adm.authority.Account.setValue2([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)... If the fields have value, then there is no message for that particular field and value gets set properly. Only occur if the field is empty. If i change the property in Account to Double or double, there wont be any warning. I am not running under devMode = true. Is this a bug? or something else? Thanks
Re: Warning message when setting BigDecimal to list of bean
Sorry I forgot to mention I am using Struts 2.1.8 SNAP SHOT with XWork 2.1.6 samething happens with XWork 2.1.5 On Wed, Sep 9, 2009 at 2:03 PM, Steven Yang kenshin...@gmail.com wrote: Hi I have a bean like public class Account { private String type; private String name; private BigDecimal value1; private BigDecimal value2; private BigDecimal value3; //getter, setters } in my action i have public class TestAction extends ActionSupport { private ListAccount accounts = new ArrayListAccount(); //getter, setters, execute } in my JSP: tr tdinput type=text name=accounts[0].name//td tdinput type=text name=accounts[0].value1//td tdinput type=text name=accounts[0].value2//td tdinput type=text name=accounts[0].value3//td td%/td /tr tr tdinput type=text name=accounts[1].name//td tdinput type=text name=accounts[1].value1//td tdinput type=text name=accounts[1].value2//td tdinput type=text name=accounts[1].value3//td td%/td /tr When i submit the form, i get warning message like the following when the BigDecimal value fields are empty : 2009-09-09 13:52:44,156 [http-80-Processor125] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'accounts[0].value2' with value '[Ljava.lang.String;@165de14' ognl.MethodFailedException: Method setValue2 failed for object junit.adm.authority.acco...@7a8ba4 [java.lang.NoSuchMethodException: junit.adm.authority.Account.setValue2([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)... If the fields have value, then there is no message for that particular field and value gets set properly. Only occur if the field is empty. If i change the property in Account to Double or double, there wont be any warning. I am not running under devMode = true. Is this a bug? or something else? Thanks
Warning message when setting BigDecimal to list of bean
Hi I have a bean like public class Account { private String type; private String name; private BigDecimal value1; private BigDecimal value2; private BigDecimal value3; //getter, setters } in my action i have public class TestAction extends ActionSupport { private ListAccount accounts = new ArrayListAccount(); //getter, setters, execute } in my JSP: tr tdinput type=text name=accounts[0].name//td tdinput type=text name=accounts[0].value1//td tdinput type=text name=accounts[0].value2//td tdinput type=text name=accounts[0].value3//td td%/td /tr tr tdinput type=text name=accounts[1].name//td tdinput type=text name=accounts[1].value1//td tdinput type=text name=accounts[1].value2//td tdinput type=text name=accounts[1].value3//td td%/td /tr When i submit the form, i get warning message like the following when the BigDecimal value fields are empty : 2009-09-09 13:52:44,156 [http-80-Processor125] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'accounts[0].value2' with value '[Ljava.lang.String;@165de14' ognl.MethodFailedException: Method setValue2 failed for object junit.adm.authority.acco...@7a8ba4 [java.lang.NoSuchMethodException: junit.adm.authority.Account.setValue2([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)... If the fields have value, then there is no message for that particular field and value gets set properly. Only occur if the field is empty. If i change the property in Account to Double or double, there wont be any warning. I am not running under devMode = true. Is this a bug? or something else? Thanks
Re: uploading a .xls file
are u getting anything from the uploadContent? because i think i should be File file String fileContentType String fileFileName On Thu, Sep 10, 2009 at 12:50 PM, KIRTI CHOPRA kirtichopra2...@gmail.comwrote: hi all i am new to struts and trying to upload a file in struts 2.0 i am using s:file tag and have given simple getter setters in action class i am getting null value in file name pls help and let me know how i can do it. code is given below: Action class package com.neevtech.newsletter.action; import java.io.File; /** * Created by IntelliJ IDEA. * User: Owner * Date: Sep 9, 2009 * Time: 10:22:18 AM * To change this template use File | Settings | File Templates. */ public class UploadXlsAction extends BaseAction { private File file; private String uploadContent; private String fileName; public String execute() throws Exception { this.file=getFile(); this.fileName=getFileName(); /*String filepath=file.getAbsolutePath(); System.out.println(filepath);*/ System.out.println(fileName); return success; } public File getFile() { return file; } public void setFile(File file) { this.file = file; } public String getUploadContent() { return uploadContent; } public void setUploadContent(String uploadContent) { this.uploadContent = uploadContent; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; System.out.println(fileName); } public String uploaded(){ this.file=getFile(); this.fileName=getFileName(); System.out.println(fileName); return success; } } Jsp page %@ taglib prefix=s uri=/struts-tags% %@ taglib uri=http://java.sun.com/jstl/core; prefix=c% div class=centertb div class=subTitleText style=padding-left: 50px; s:form method=POST enctype=multipart/form-data theme=simple table width=80% style=font-weight: normal; tr td s:file name=file label=File/s:file /td /tr tr tds:submit action=uploadXlscssClass=submitButton label=upload xls align=left cssStyle=margin-left:100px;//td /tr /table /s:form /div /div -- View this message in context: http://www.nabble.com/uploading-a-.xls-file-tp25377242p25377242.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Mapping of form object to a java bean
you can try modelDriven or simply create a javabean with fields matching your form and put it as an attribute of or action but you still need a getter setter for this bean for example in Action: private FormBean myBean; in JSP: s:textfield name=myBean.myProperty/
param for action in struts.xml
Hi I want to set initial value for an action I believe the way is action name=myAction class=.xxx.xxxAction param name=myParammyParamValue/param /action then myParamValue will be set to my Action's myParam property. but i am not getting anything in my action class. Am i missing something? or its not how it works? I am using Struts 2.1.8 SNAPSHOT. Thanks
Re: param for action in struts.xml
Thanks a lot ChrisI guess I took out one too many interceptor from the basic stack. StaticParam is what i am looking for
Re: [s2] Struts 2.1.8 - jsonplugin 0.34
have you tried to upgrade the json plugin jar to version 2.1.8 as well?
[S2] Getting property value from Enum
Hi First of all if this question has been ask, I apologize for the double post. and please refer me to the reference. thanks I am using 2.1.6. I have a Enum class Gender and it has a method getTextKey() which simply returns a key for me to use in getText() in Action If in my Action I have private Gender gender getter... setter.. then in my jsp if i use s:property value=gender.textKey/ I get nothing (toString is not called) if i use s:property value=gender.getTextKey()/ I found that it calls toString() first then calls getTextKey() on it and result in nothing because there is no method called getTextKey on String. Is this a bug? or am i missing something? Thanks
Re: [S2] Getting property value from Enum
Just want to add some more information if I do s:property value=gender.toString()/ s:property value=gender.name()/ s:property value=gender.cardinal()/ I get what is expected. I guess all native Enum methods are fine.
Re: [S2] Getting property value from Enum
OMG I can't believe myself. how can i make such a stupid mistake Sorry guys for wasting your time. Its all my fault my method name was getTextkey() but I kept on using getTextKey() or textKey (capital K) thats why it never worked its solved.
Re: Javascript CSS obfuscator and packing
So what you mean is you want the process to be automated?just as if you press Ctrl+b in Eclipse, its compiles your .java to .class? but instead turns your .js to .min.js? or are you simply looking for something to obfuscate your scripts?
Re: how to use struts 2 to redirect jQuery Ajax request
Actually you went off Struts' scope by using AJAX.because javascript is on the client side. by using XHR you have put the control of determining the result to javascript and not Struts. one other way you can do it is you can let server send the url along with other information to client and client decide based on the result to redirect or stay on the same page. but still the job of determining the result is on your javascript
Re: how to format a percentage
have you trieds:text name=format.percents:param value=%{( (50.0 / 200.0) *100.0)}//s:text without the decimal OGNL might treat your numbers as integers and there for you get 0. I havent test it out but thats what I used to do for JSTL
Re: struts 2, implements Action / extend ActionSupport
basically ActionSupport gives you some default implemented methods to make your life easier. if you dont need them you can simply implement Action But for Struts2 you dont even HAVE to implement the Action interface, as long as you have a method called execute or any named method that your calling
Re: Issue with the Browser Cache
Hii think you did everything that i did. not sure where is wrong but when you get from the first page to the second, did you use GET or POST? if you use GET please see if your server gets hit again when you press back. if you use POST i believe you should see the page expired thing
Re: Struts performance metrics
We plan to profe right from the beginning but I am not sure how JSTL can replace Struts tags to increase performance. I understand that in order to display data we can use JSTL. Struts tags are required to use the framework fully. Isn't it ? - I guess for some cases you do have to use Struts tags for example I dont know how to do i18n using JSTL tags. I can use s:text for that. But I suppose using Struts tags some where wouldnt hurt too much if you really run into performance issues with Struts tags
Re: Struts performance metrics
Hijust to share some of my experience and see what you decide to do I have worked on a project which the end result is packed into a jar (actions and stuff)and will be throw into and coexist with other project. To run the project, I simply put the jar and related jsp and struts setting xml's into another project and everything will run. I have deployed my project into 2-3 different projects(all using plain servlets) in my company and . And all worked fine, meaning no major compatibility issues. Except for one, I have the performance issues described on most places you have seen. And I basically did the same thing as what they all did, I changed Struts tags to JSTL tags, and everything just worked fine. All I can say is that from my observation its probably the different jars files included that my cause some conflicts. I have not have the time fully test it out. so just something to share with you.
Re: getText did not return value in s:submit
(2) Put package.properties under /WEB-INF/classes/ have you tried to put package.properties under the same package as your action class?AFAIK package.properties only works with classes in the same package or classes sub-classing the classes in the package.
Re: TypeConverter needs Spring Bean
Hi I also need my Converter to be handled by Spring however I could not get it to work as well. From my observation is that the Converter is set to X-Work but not to Struts, there for the Spring plugin may not work there. Please correct me if I am wrong. Or is there a correct way to set it up? Thanks
Re: [S2] apply i18n on java entity from DB
Dimitar thanks for the idea.And Roger thanks for your description that made me understand better what Dimitar is talking about, as I am not familiar about database message resources. With your reference I am able to present solution to my boss better now. Thanks a lot guys learn something new today
Re: Step by Step Struts 2 tutorial
Great Thanks a lot My company is just gonna start to use S2. I can sure use your demos to teach my colleges good job
Re: How to convert output of s:property into int?
just print the property on your jsp or page actually for example var i = s:property value=int/; will become var i = 9; then your javascript will interpret it as an int
Re: [S2] apply i18n on java entity from DB
Thanks a lot No problem about the code I get your point clearly. I will definitely take this in to consideration. I guess I need to look back into my design patterns as well ha If anyone else have any thoughts or suggestion please fill free to hit me Thanks
[S2] apply i18n on java entity from DB
HI If this question has been asked, please refer me. Thanks in advance I am currently using Struts2 with Spring. Basically I have struts action backed by Service and DAO injected by Spring. I may be getting a java entity from the Service, for example a Product. And the product object has attributes of english_name and french_name. I want to show one of the name depending on the language version user chose to view my pages. For example: I have Product.java String english_name String french_name ...setter getter Action.java Product product ...setter getter The problem is what is the best practice to show the attribute of product name depending on the language(locale) chosen? I know that for texts I can use getText or s:text/ but how do I do it for java entities? I cant do something like s:property value=product.%{text('productName')} and in my properties productName=english_name right? and this doesnt look right Any suggestions? Thanks
Re: Performance issue
I had encountered similar problem a while back in Webwork.I believe its OGNL's problem as well. However, in most of my other projects using WebWork, I had no performance problem. I believe it has something to do with some jar files included in the project. I have not got a chance to find out which jar is having conflict with OGNL. I do not believe OGNL is anything bad to be included with Struts2, it's great, but maybe there is just some conflicts with other programs. To solve it, I simply used JSTL tags just like kilroy.
Re: form to array
I believe what you want is checkbox right? radio only has one value simply declare an instance property in your action private String[] names; and public getter setters for it and in your html just do input name=names type=checkbox value=1 input name=names type=checkbox value=2 and so on I have only tried with String[] not sure about other data types
Re: need to create servlet
I am guessing its suggesting you have one context root for static content and another root for your actions and stuff. for example you might have something like for actions http://localhost/actions/login.action and for static contents http://localhost/static/login.png and in your login.action jsp you will have to refer to login.png as img src='/static/login.png'/ and in the HTTP server you set it to only intercept /static I am just guessing see if this helps
Re: Form submitted twice (no AJAX!)
can you post the html generated from your action and jsp?
Re: SPAM WARNING!: RE: Struts2 : Calling AJAX function on button click(ONLY)
Hi on thing i noticed is that you have a notifyTopics attribute on you submit tag which i dont think is necessary and used wrong. i havent used dojo for a long time, so i am not sure if they changed any api or settings. but just a reminder you might need to take a look. you dont have to specify href on your div. you can change it or assign a href in your onclick function like dojo.byId(resultDiv).href = /example/result.action; see if this help