Apache rewrite/reverse proxy
Hello Listers, I have back end website running on Tomcat using struts with the following url http://local.domain.com/app. External user access the website through apache proxy with the following url http://www.domain.com/user1 (user1, user2, etc... It’s uri specific to each user). I want to use apache rewrite or/ and reverse proxy directive to translate the url like http://www.domain.com/user1 into http://local.domain.com/app?user=user1 Can some apache guru help me please? Thanks, Abdel In your setup, is http://local.domain.com/app accessible to the users? There may not be any need for reverse proxying, it may simply be a matter for mod_rewrite... -Wes -- 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
Re: Advice needed: Offline Struts App
-Original Message- From: Christian Grobmeier [mailto:grobme...@gmail.com] Sent: 15 March 2012 15:26 To: Struts Users Mailing List Subject: Advice needed: Offline Struts App Hi, yes I know Struts 2 is a web framework. But recently somebody told me he would love to see a desktop version of my app instead of a cloud based version. I think this would be great for me too. Now I am considering different ways... not sure, probably somebody here already did the same in the past. I mean, many of the interceptors are probably not necessary in a desktop app. My Action are there - I could use them straightaway without interceptors (or some other great features of Struts). Basically I would just need to replace my HTML/JS frontend with something else, probably JavaFX. Anybody around who had a similar job with S2 in the past? Cheers Christian Christian, have you considered using XWork? Struts2 is basically a web implementation of the command pattern framework implemented by XWork. I worked on a project where I embedded XWork in a non-web-app and was very happy with it. -W -- 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
Re: 'Best' Struts Development Envirnoment?
I have nothing but good things to say about IntelliJ IDEA's Struts 2 support... I have not used Struts 1 in a while, but I can tell you that I really appreciate the following features: 1. It is aware that class files are Actions and/or spring beans. Therefore, you can jump straight to the class's action configuration or spring configuration. 2. Tag autocompletion. It is aware of the parameters for all of the tags. 3. OGNL awareness (I think this is new in IDEA 11), I believe it matches variables back to properties on the action class, etc. Some of the other features that make it a pleasure to use: - proper support for maven (this is my primary problem with Eclipse) - very intuitive debugger - JPQL console -Wes On Tue, Jan 24, 2012 at 12:10 PM, Burton Rhodes burtonrho...@gmail.com wrote: I think this has been addressed before on this list, but I am wondering what you guys have found is the best environment to develop Struts. Currently I use Eclipse Indigo and don't really see any 'good' plugins. Since I use the XML method rather than annotations to map my actions, I find myself scrolling my incredibly long XML file to find the related action mappings. Surely there is a better way to do this? Also, a better auto complete feature for Struts tags in jsps would be nice. Am I willing to pay for software so I am not limited to eclipse for net beans. But the switch would need to offer a compelling reason to switch. Any advice would be welcome. Thanks, Burton -- 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
Re: admins, can you add something like [struts] before every subject
On Fri, Jan 13, 2012 at 11:54 AM, Bogomil Shopov shopov.bogo...@gmail.com wrote: On 13 January 2012 17:48, Maurizio Cucchiara mcucchi...@apache.org wrote: Can you explain why? -1. Because now mails look like personal emails. 0.because it's normal for a discussion list 1. Because if you are subscribed for more than 10 of them, you may need some kind of way to recognize what is this about Can you filter on headers? Each message posted uses the following header - List-Id: Struts Users Mailing List user.struts.apache.org Depending on your mail client, there may be an easy way to filter based on a header (saving some bytes [as if that is still important]) Also, JRebel rocks! -Wes -- 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
Re: struts2 string to map conversion
Have you read through this - http://struts.apache.org/2.x/docs/ognl-basics.html The type conversion is generally called automagically. -W On Tue, Dec 6, 2011 at 8:46 AM, cwalet cwal110...@gmail.com wrote: any body knows how to use Struts2 TypeConversion(in xwork libs) to convert a parameter string to a hashmap object? I tried this: @TypeConversion(key = phone, rule = ConversionRule.MAP, converter = java.lang.String) public void setHmss(HashMapString, Object hmso) { this.hmso = hmso; } but no convert had it done.how?any suggestion? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: [OT] Searching for data access framework.
I am not sure if I understand your question correctly, but the first thing that comes to mind - http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html I would say to combine a disciplined approach of separation with a domain model layer, a business logic (transactional) layer and then IoC with Spring... If you were looking for more detail than that, we'll need some more details on your problem. -Wes On Mon, Dec 5, 2011 at 12:02 PM, Balwinder balwinder@gmail.com wrote: Hi All, Can anyone suggest me a framework that can abstract the data call and its source, if there exists any? Example if I want to authenticate a user then my query shall not depend upon the data source, it could be any LDAP server, database or any file in a file system or anything else. Thanks in advance. Regards, Balwinder Kumar - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: [OT] Searching for data access framework.
On Mon, Dec 5, 2011 at 12:12 PM, Balwinder balwinder@gmail.com wrote: Hi Wes, What I need is something like, if I want to access data from a database, i can use SQL, but if i change the source to LDAP then the access mechanism will change from SQL to LDAP specifics, now if the same data goes to flat file than again my mechanism will change, so all I need is some framework that if when source is changed its access mechanism should remain same. Hope this explains what I am looking for. Based on that, I am going to reiterate my original pointer to the DAO pattern. What you are looking for (IMO) is too high-level to be be implemented by a framework. There are ambitious attempts, such as spring-data (http://www.springsource.org/spring-data). However, you will see that they don't mention LDAP support. Conversely, if you read the original link about the DAO *pattern* and implement that pattern using a good IoC (spring), you will achieve your goal with very little effort. Then, you will find that spring / struts play nicely together and you will be very happy. As a reassurance, I use the DAO approach with IoC and have a library, developed internally, that we use to manage security. This allows us to retrieve users from a database, if the database modules are wired in, or use LDAP if the LDAP / Active Directory modules are wired in. -Wes -- 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
Re: Two Docs from One Link/Action
I think if you find a solution it will be heavily convoluted... Why not just zip the two documents up together and send the zip through the stream? -Wes On Fri, Sep 16, 2011 at 12:19 PM, Nick Broadhurst hou1...@gmail.com wrote: Hi folks, Trying to generate an additional document from a link/action that already generates one. Here is my config: code action name=MedRequest class=action.WordAction method=MedicalRecordsRequest result name=success type=stream param name=contentTypeapplication/msword/param param name=inputNameinputStream/param param name=contentDispositionfilename=Med-Rec-Request.rtf/param param name=bufferSize1024/param /result /action /code Grasped at a couple of straws with multiple param sets and results but nothing worked. I need to use result type redirect (for second doc) and stream at same time it seems. Thanks, Nick -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote!
Re: Asynchronous Display of Action Results
You can achieve the outcome you desire by using AJAX instead of the s:action tag. Here is an (untested) jquery example - div id=remoteAction1/div div id=remoteAction2/div script type=text/javascript $(document).ready(function() { $(remoteAction1).load(s:url action=action1 /); $(remoteAction2).load(s:url action=action2 /); }); /script I'm too lazy at the moment to make sure that the javascript is correct, so if someone notices any glaring errors, please chime in. -Wes On Mon, Jul 11, 2011 at 10:43 AM, Baubak Gandomi b.gand...@castsoftware.com wrote: Hello, I am not able to find any mention of this topic, or even if it is really Struts 2-related. I have a view which calls two actions using s:action. The methods that are called in the domain of the actions take different times to execute. I would like my actions to be run parallel. I.e. Once they are finished executing, that their results are show the moment they finish. ---Struts.xml package name=ActionTests_Application extends=struts-default action name=start result/WEB-INF/pages/main.jsp/result /action action name=action1 class=action_tld.Main_Class method=method1 result name=success/WEB-INF/pages/page1.jsp/result /action action name=action2 class=action_tld.Main_Class method=method2 result name=success/WEB-INF/pages/page2.jsp/result /action /package ---action_tld.Main_Class public class Main_Class { private int delay = 0; public String method1() { setDelay(5000); sleeper(); return ActionSupport.SUCCESS; } public String method2() { setDelay(500); sleeper(); return ActionSupport.SUCCESS; } ---main.jsp body waiting.. table tr td s:action name=action1 executeResult=true/s:action /td tds:action name=action2 executeResult=true/s:action /td /tr /table ---Page1 2 Just show a simple text In the example above method2 takes longer to execute than method1. Today when I execute start The result of action1 is displayed before action2. However what I want is that action1 action2 to be executed simultaneously, and that the result of action2 is presented first. This may not be a Struts2 question perse, but if anyone has any leads I am much obliged. Best regards, Baubak -- 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
Re: Scope Interceptor and Struts2 Validation query...
On Tue, Jul 5, 2011 at 4:10 PM, log2akshat akshat-...@iiitmk.ac.in wrote: i have implemented the Struts2 validation framework, it is working fine. But I want these error-messages in a small popup screen with a ok button, when this popup is closed the focus should go to the field that has an error. Or is there any way by which we can use additional javascript onsubmit other than by the dynamically generating default javascript. Have a look at this and see if it helps - http://struts.apache.org/2.2.3/docs/ajax-validation.html -Wes -- 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
Re: Spring Plugin and Interceptor instantiation
Spring will instantiate the interceptors (and actions and results) if spring is able to resolve the name given as a bean. Think of it like this, if you specify an interceptor like so - interceptor name=execAndWait class=executeAndWaitInterceptorBean/ and executeAndWaitInterceptorBean resolves as a bean name in your spring context, then it will use the resolved bean. If the name is not resolved as a bean in spring, struts will revert back to its normal mechanisms for instantiation. The other thing to be aware of is autowiring. If you set the spring plugin autowiring to byname or bytype, then the plugin will attempt to wire in dependencies that match (by name or match by type) for any of the objects that the factory is instantiating. -Wes On Tue, Jun 28, 2011 at 8:37 AM, roger roger.var...@googlemail.com wrote: Hi If I use the struts 2 spring plugin, will the struts framework use spring to instantiate the standard filters (i.e. ExecuteAndWaitInterceptor) or does the struts framework continue to instantiate them? Regards -- View this message in context: http://struts.1045723.n5.nabble.com/Spring-Plugin-and-Interceptor-instantiation-tp4531621p4531621.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 -- 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
Re: override Struts BaseFieldTag.renderInputElement
Are you receiving a compiler error or runtime error? Please provide the output/errors/etc. that lead you to believe you don't have access. -Wes On Tue, Jun 28, 2011 at 5:34 AM, prithivirajan prithiviraja...@gmail.com wrote: I was thinking for writing customize Struts TextTag by extending it. And override the protected renderInputElement() available in BaseFieldTag. Unfortunately this method is not accessible/visible in my class which extends BaseFieldTag. I understand there is some kind for restriction for protected access - where the protected access level gives access to any class inside the same package or any subclass where it is declared. So according to the above said rule my class should have access to protected methods but it doesn't have it. Help me to understand why i can't access the protected method in the sub-class belonging to different package. -- View this message in context: http://struts.1045723.n5.nabble.com/override-Struts-BaseFieldTag-renderInputElement-tp4531233p4531233.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 -- 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
Re: [OT] Re: Job postings
I'm not in the Atlanta, GA area, I am in Ohio, but I am willing to come down from time to time. I work as an independent contractor, hopefully that isn't a problem. If you are interested, let me know and I'll send my resume and rates. I will highlight this offer by mentioning that I am a PMC member of the Struts team. You can check that here - http://struts.apache.org/dev/volunteers.html http://struts.apache.org/dev/volunteers.html-Wes On Thu, May 26, 2011 at 10:01 AM, Robert Taylor rtay...@dtgresults.comwrote: Hello, Currently we are only considering candidates in the Atlanta, GA area. Telecommuting is an option; however, you will be required to be onsite at various times. Thanks, /robert - Original Message - From: Mohamed SIDI mhm.s...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:41 AM Subject: Re: [OT] Re: Job postings Hello there, This may be one of the most important opportunity what about one witch is located in France ? there are some conditions to candidate :) 2011/5/26 Robert Taylor rtay...@dtgresults.com Hi Dale, We have a posting on the AJUG site. I've also been to the latest AJUG meetings. When I was there, 6 companies stood up and declared many openings for Java developers. Thanks for the advice. /robert - Original Message - From: Dale Newfield d...@newfield.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:06 AM Subject: [OT] Re: Job postings On 5/26/11 7:51 AM, Martin Gainty wrote: does'nt dale live down there? Thanks for thinking of me. The reason I've been scarce around these parts lately is that I finally had to get a real job at the end of last year, so I no longer have as much time to respond to questions here, and I'm no longer in the market for a job. I'm now working at Turner Entertainment, and we're also looking for senior level folks, but we've been having quite a difficult time finding well qualified candidates ourselves. In Atlanta my first suggestion would be to post to the Atlanta Java Users' Group job mailing list, but seeing as we're still looking I'm not sure how much that advice is worth. -Dale On Thu, May 26, 2011 at 4:50 PM, Robert Taylorrtay...@dtgresults.com wrote: Greetings, I'm a Java team lead for a company in Atlanta Ga. My team has 2 positions open for senior level Java/Struts developers. I was wondering if its okay to post on this list regarding these open positions. /robert - 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 -- Cordialement Mohamed - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote!
Re: [OT] Re: Job postings
damnit, sorry, I hit reply, but didn't pay attention to where it was going :( Sorry about that. -Wes On Thu, May 26, 2011 at 10:10 AM, Patrick Cosmo pco...@incognito.comwrote: Wes, why do I want to know this? Can't you email Robert directly: rtay...@dtgresults.com -Original Message- From: Wes Wannemacher [mailto:w...@wantii.com] Sent: Thursday, May 26, 2011 10:09 AM To: Struts Users Mailing List Subject: Re: [OT] Re: Job postings I'm not in the Atlanta, GA area, I am in Ohio, but I am willing to come down from time to time. I work as an independent contractor, hopefully that isn't a problem. If you are interested, let me know and I'll send my resume and rates. I will highlight this offer by mentioning that I am a PMC member of the Struts team. You can check that here - http://struts.apache.org/dev/volunteers.html http://struts.apache.org/dev/volunteers.html-Wes On Thu, May 26, 2011 at 10:01 AM, Robert Taylor rtay...@dtgresults.comwrote: Hello, Currently we are only considering candidates in the Atlanta, GA area. Telecommuting is an option; however, you will be required to be onsite at various times. Thanks, /robert - Original Message - From: Mohamed SIDI mhm.s...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:41 AM Subject: Re: [OT] Re: Job postings Hello there, This may be one of the most important opportunity what about one witch is located in France ? there are some conditions to candidate :) 2011/5/26 Robert Taylor rtay...@dtgresults.com Hi Dale, We have a posting on the AJUG site. I've also been to the latest AJUG meetings. When I was there, 6 companies stood up and declared many openings for Java developers. Thanks for the advice. /robert - Original Message - From: Dale Newfield d...@newfield.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:06 AM Subject: [OT] Re: Job postings On 5/26/11 7:51 AM, Martin Gainty wrote: does'nt dale live down there? Thanks for thinking of me. The reason I've been scarce around these parts lately is that I finally had to get a real job at the end of last year, so I no longer have as much time to respond to questions here, and I'm no longer in the market for a job. I'm now working at Turner Entertainment, and we're also looking for senior level folks, but we've been having quite a difficult time finding well qualified candidates ourselves. In Atlanta my first suggestion would be to post to the Atlanta Java Users' Group job mailing list, but seeing as we're still looking I'm not sure how much that advice is worth. -Dale On Thu, May 26, 2011 at 4:50 PM, Robert Taylorrtay...@dtgresults.com wrote: Greetings, I'm a Java team lead for a company in Atlanta Ga. My team has 2 positions open for senior level Java/Struts developers. I was wondering if its okay to post on this list regarding these open positions. /robert - 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 -- Cordialement Mohamed - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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 -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote!
[maybe OT] Detecting if a new window or tab was opened (server-side)
Does anyone know of a good trick to detect whether a new window or tab was opened by the user... Here is the scenario, a user is looking at a view and he/she right-clicks one of the links and chooses to open the link in a new tab or window. The original view and the new tab or window will share the session, but I'd like to know that there are two windows (or tabs) interacting with the site. I thought about trying to track the referrers as requests come in, but I get stumped when I realize that a user can re-visit a page. There are some javascript mechanisms, but by the time I can detect from javascript that a window is new, the response is already being rendered (committed). Here is one link I found, but the code is poorly formatted making the example difficult to follow - https://sites.google.com/site/sarittechworld/track-client-windows -Wes -- 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
Re: Struts2 Internals
Action class instances (and views and interceptors) are instantiated via reflections. JDK proxies would require that all actions need to implement a specific interface, which, although suggested, is not a requirement. Execution is done with reflections as well, if I remember correctly. -Wes On 2/6/11, Nuwan Arambage nuwan.aramb...@gmail.com wrote: Hi all, When I see the architecture of the Struts2 , there is a ActionProxy class. So my question is this, which method struts framework used to implement ActionProxy class. It is a Java Dynamic proxy API or another code generation library. Thanks Regards, Nuwan Arambage -- Fail again. Fail better With Regards , Nuwan Arambage - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Is Action class a singleton class
In struts one they are singleton. In struts two they are a new instance per request. -Wes On 1/8/11, Yaragalla, Muralidhar muralidhar.yaraga...@patni.com wrote: Hi I have a question on Action classes. Are action classes maintained as singleton classes? Or will they be maintained as one object per every thread? Thanks in advance. Thanks and Regards, Muralidhar Yaragalla, Senior Software Specialist, Patni Computer Systems Ltd, B-45/B-46, SIPCOT IT Park, Rajiv Gandhi Salai (IT Highway), Siruseri,Chennai - 603 103. Tel: 91 44 4744 x 2224 Link Line: 9 613 4516 Mobile : 9791174806 Information contained and transmitted by this e-mail is confidential and proprietary to Patni Computer Systems Ltd and its affiliates (hitherto referred as Patni Computers) and is intended for use only by the recipient. If you are not the intended recipient , you are hereby notified that any dissemination, distribution, copying or use of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator or netad...@patni.com. Patni Computers does not enter into any agreement with any party by e-mail. Any views expressed by an individual do not necessarily reflect the view of Patni Computers. Patni Computers is not responsible for the consequences of any actions taken on the basis of information provided, through this email. The contents of an attachment to this e-mail may contain software viruses, which could damage your own computer system. While Patni Computers has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening an attachment. To know more about Patni Computers please visit www.patni.com. -- 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
Re: Struts2 threading in a Java EE application server environment
On Tue, Oct 19, 2010 at 8:07 AM, Phil Adams padam...@gmail.com wrote: Hi Lukasz, Thanks for the information... I read about ExecuteAndWaitInterceptor but it seems as though that must create a new thread as well, since it also uses the BackgroundProcess class to execute the action, right? In this particular situation, I need to find a way for the action's execute() method to be called on the servlet container's original thread, rather than on some new thread created by Struts. Thanks Is there a reason why the customer's action is using the ExecuteAndWaitInterceptor? I guess what I am saying is that I am hearing conflicting information. You want the action to execute in the container's request handling thread, but you are using execwait. You can't have both... Remove the execwait interceptor from the action's interceptor stack and see if you get the results you are looking for... However, (warning), if the original developer configured the action to use execwait, he/she may have had a reason and removing the interceptor may have unintended side effects. -Wes -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote!
Re: Can I access URL parameters within struts.xml using ognl ?
I think, depending on which version of struts you're using, in struts.xml files, you use $, not % for OGNL expressions... So, try this - action name=mainContent class=com.integrationpath.mengine.webapp.action.ArticleAction method=list result name=success/themes/${application_theme}/pages/production/mainContent.jsp/result /action -Wes On Mon, Aug 2, 2010 at 10:10 AM, Dale Newfield d...@newfield.org wrote: On 8/2/10 3:31 AM, colaru wrote: For me is not working. I want something like this: action name=mainContent class=com.integrationpath.mengine.webapp.action.ArticleAction method=list result name=success/themes/%{application_theme}/pages/production/mainContent.jsp/result /action That should work if s:property value=%{application_theme}/ would print the value you want in the resulting .jsp. where application_theme is an attribute on Application Context. I want to redirect to a dynamic URL created in runtime based on this variable - and still keep the struts.xml structure. I'm not sure what you mean by attribute. Is it a bean? Is it a message? Something else? Whatever it is, you should be able to get it by doing the following and filling in the appropriate FOO below based the answer to this question. This tells me that you don't have a getApplication_theme() on your action. If you make your action implement ApplicationContextAware And add not only public void setApplicationContext(ApplicationContext newApplicationContext) throws BeansException; but also public ApplicationContext getApplicationContext(); Then you should be able to say %{applicationContext.bean('application_theme')} or %{applicationContext.message('application_theme')} or %{applicationContext.FOO} D:\projects\mengine\src\main\webapp\themes\\pages\production\mainContent.jsp not found Is like this string is not parsed and variables not replaced with their values. This must be being parsed, since the %{application_theme} portion is no longer present. It evaluated to an empty string. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Regular expression action mapper
Make sure you register it as a plugin here - https://cwiki.apache.org/confluence/display/S2PLUGINS -Wes On Sun, Jul 18, 2010 at 7:48 AM, koolbunnyrabbit linut...@gmail.com wrote: Hi all, Just trying to give back (or a shameless plug - you decide) Months ago (last year really) I implemented a regular expression action mapper similar to Django's URL dispatcher. Given this regex.mapping file listProduct::^/products$ showProduct:entityId:^/product/([0-9]+)$ showProduct:productName:^/product/([a-zA-Z0-9_]+)$ deleteAttributeProductAdmin:entityId,entityType,attributeId:^/admin/product/([0-9]+)/delete/(type|colour|size)/([0-9]+)$ Given a URL the regex action mapper will search through its list (in order) for a match (the patterns are compiled so it's fast). Therefore /pepperviolet/products will invoke the listProduct action /pepperviolet/product/89 will assign 89 to the variable entityId and call showProduct /pepperviolet/product/Sony_Bravia will assign Sony_Bravia to productName and call showProduct /pepperviolet/admin/product/999/delete/type/77 will do entityId = 999, entityType = type and attributeId = 77 and call deleteAttributeProductAdmin It is hosted at http://code.google.com/p/pepperviolet/ I'm not sure what's the state of RESTful style mapping in Struts2 now, but if just 1 person finds this useful I'm happy already. Feedback is greatly appreciated. Thanks. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Migrating from struts 1.1 to 1.3
swap the jars and test? If you get errors that you don't understand, post here and we'll try to help. -Wes On Sun, Jul 18, 2010 at 3:48 AM, amine123456 eh.m.am...@gmail.com wrote: thanks but is there any way I can jump directly from 1.1 TO 1.3?? -- View this message in context: http://old.nabble.com/Migrating-from-struts-1.1-to-1.3-tp29191020p29195699.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 -- 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
Re: Struts 2 field validator thread safety
I would say that you probably should write the validator to be thread-safe (just to be sure). But, that being said, from a quick look at the validation framework (check classes like DefaultValidationFactory, ValidationInterceptor, etc. inside of xwork), it looks like xwork caches the validator config and asks the validator factory for instances when they are needed. The validator factory retrieves the instance from the Object Factory, which is creating and injecting a new instance for each validation. I say that you should still make them thread-safe because I would imagine at some point, the framework might create instances and cache / reuse them since reflections-based instantiation can be slow. -Wes On Sat, Jul 17, 2010 at 6:25 PM, Marshall Gunter marsh...@mate1inc.com wrote: Writing my own. On 10-07-15 08:33 PM, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Marshall, On 7/15/2010 9:27 AM, Marshall Gunter wrote: Do Struts 2 field validators need to be thread safe? That depends on what you want to do with them. Are you writing your own, or are you critiquing the existing validator implementations? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkw/qMgACgkQ9CaO5/Lv0PCUrACgstaFyPiVsxZJ8iswTE4zmn0k qKUAn2J769JmFnQuL6VDVS01dX1SIW8c =FM2d -END PGP SIGNATURE- - 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 -- 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
Re: Struts 2 constant not working...
I'd have to see more of the package configuration to be certain... Generally, when I've seen SlashesInActionNames it isn't mapping to the top of the package. For instance, I'd expect this to work - package name=top namespace=/ extends=struts-default action name=some/name/with/* class=actionBean resultsuccess-result.jsp/result /action /package -Wes On Sat, Jul 17, 2010 at 12:16 PM, JP Cafaro jcafar...@gmail.com wrote: I can't get this struts2 constant to work: constant name=struts.enable.SlashesInActionNames value=true/ I have this wildcard mapping: [ action name=/secure/** class=actions.secure.SecurePassThrough interceptor-ref name=secureStack/ result{1}/result /action When I try and go to http://localhost:8080/Struts2NewChapter8/secure/blah I get an error: There is no Action mapped for namespace /secure and action name blah. Why does this happen? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Problem accessing a field from an object which is placed in session using the key from property file
try something like this - #sessi...@fully.qualified.salesconstants@SALES_MKT_CAT].salesPrice -Wes On Tue, Jun 22, 2010 at 9:56 PM, prathima prathima_b...@yahoo.co.in wrote: Hi, We are migrating Struts 1.2 application to Struts2 and I am facing some issues. I have all the constants defined in a file called SalesConstants.java. It has a constant which is SALES_MKT_CAT =marketing. In the Action class, an object(marketingProduct) of type Product is placed in session with key as marketing. For example: session.put(SalesConstants.SALES_MKT_CAT,marketingProduct). I have to check if marketingProduct is in session and if so if it has salesPrice = 100 where salesPrice is a field in marketingProduct object which is of type Product. How can I check this in if tag? I tried #session.%{SalesConstant.SALES_MKT_CAT}.salesPrice but it didnt work I do not want to specify marketing directly which is the value of SalesConstant.SALES_MKT_CAT. Also, how can I check if marketingProduct is in session or not? We are currently upgrading from Struts 1.2 to Struts2 and we are in tight schedule. I understand we do not have logic:present , logic:equal tags in Struts2 :( I am new to Struts2, Please help. Thanks, Prathima -- 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
Re: Transparently handling a missing image
There is a set of handlers called the Unknown Handlers that are used in the Conventions plugin. You might check that out... http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/UnknownHandler.java?view=markup You can implement this interface and plugin your class. I'm not sure if this is what you're looking for... -Wes On Thu, Jul 29, 2010 at 3:28 PM, java@spamgourmet.com wrote: It's possible that this is not a Struts question, but it's succinct: I'd like to be able to code pages that ask for a resource that may or may not be present in one directory. If the resource is NOT present in the requested location, I'd like to automatically look for it in a different location. FreeMarker with Struts makes this easy with template acquisition -- where FM loads a template from any of the parent directories if it's not found in the requested directory (docs here: http://freemarker.sourceforge.net/docs/ref_directive_include.html#ref_directive_include_acquisition). How can I achieve similar fall-back behavior for things like images (and ultimately .css and .js too)? Are Interceptors useful here? What about a custom 404 handler? (can this map to an action that returns an image result?) Perhaps a regular normal J2EE Filter or Servlet mapped to .png? I look forward to hearing any ideas you might have. -rgm - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Struts2 - Html to PDF
I'd assume it's possible, but probably not the best choice... I would take a look at doing either a Jasper report or using Apache FOP. The choice will have to do with the nature of the PDF you are trying to generate. Jasper is a reporting platform... Think of Crystal Reports, there is a report designer, you then back the report with data and render. Jasper uses iText to generate PDFs, and it will let you create more of a document than a bunch of code. If your output will be hard to model in a traditional reporting platform, then take a look at Apache FOP. It's very complicated, but think of it this way - You start with XML modelling your data, then pass it through a transform that kicks out XSL-FO, then you have Apache FOP turn it into a PDF. I don't have any real experience with it, so I might be giving you bad information (and hope someone will correct me). But, in this scenario, you are generating XML which represents the data you are passing to the output. The transform is done using XSLT? Which is another standard. What you generate is an XSL-FO document. This document can be rendered as a PDF by FOP. Although it's a more complicated process than the first choice, it does add some flexibility since you can drop-in replace different components (the transformer, the FO-to-PDF converter, probably), plus, you can create other XSLTs that generate other output. With Jasper, you'll probably be locked into PDF, HTML and Excel (CSV). -Wes On Fri, Jul 23, 2010 at 4:43 PM, CRANFORD, CHRIS chris.cranf...@setech.com wrote: Is it possible to extend the default ServletDispatcherResult to parse the HTML output and pass the result content to the browser as a PDF document? Or is there a better approach to doing this? What I want to be able to do is to allow easy creation of PDF documents from HTML content. Presently I am looking to use iText but this isn't a firm choice and another option that may work better is possible. Chris - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: How to set a variable in session in the JSP
http://struts.apache.org/2.x/docs/set.html Notice particularly the scope attribute. -Wes On Fri, Jun 18, 2010 at 1:01 AM, Kushan Jayathilake kusha...@gmail.com wrote: Hi Guys, Can anyone suggest me a way to set a variable in the session in the JSP and access that variable in the action class.. (variable must be set from the JSP file to the session) iam using struts 2.. is there anyway to do this..? -- Regards Kushan Jayathilake -- 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
Re: How to set a variable in session in the JSP
What you want is this - s:set name=sessionValue value=%{accountList} scope=session / However, what i'm wondering right now is this - you have to expose accountList most likely by having a getter/setter combination on the action that is rendering the JSP that contains this tag. Assuming you are placing the variable in the session so that you can retrieve it from another action, why have the object pushed into the session from a view? I mean, if you have it in an action, why not push it into the session in that action? To me, setting session variables from a view smells a bit like business logic creeping into your view layer. I probably don't know enough about the task to say for sure, and the tag above should get the job done, but consider what I'm saying... One of the advantages of adopting an MVC framework is to abstract business logic away from the views in your application. If the view performs more than just displaying the appropriate data, it is potentially less reusable by different actions (although it doesn't happen a lot that a view is reused by different actions, it does happen more often if you're properly disciplined in separating the business logic). -Wes On Fri, Jun 18, 2010 at 1:24 AM, Kushan Jayathilake kusha...@gmail.com wrote: Hi, Thanks for replying... In my JSP i put the s:set as you said, i want to get the value from the Action class and set that value in the session in the JSP, so i wrote, s:set name=sessionValue value=s:property value=accountList/ scope=session/ note that accountList is a java.util.List in the Action class, i want to get that list to the JSP and assign its value to the session, but it gives equal symbol expected error... Can you please suggest me a way to do this..? -- Regards Kushan Jayathilake On Fri, Jun 18, 2010 at 10:41 AM, Wes Wannemacher w...@wantii.com wrote: http://struts.apache.org/2.x/docs/set.html Notice particularly the scope attribute. -Wes On Fri, Jun 18, 2010 at 1:01 AM, Kushan Jayathilake kusha...@gmail.com wrote: Hi Guys, Can anyone suggest me a way to set a variable in the session in the JSP and access that variable in the action class.. (variable must be set from the JSP file to the session) iam using struts 2.. is there anyway to do this..? -- Regards Kushan Jayathilake -- 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 -- 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
Re: Need Help For Struts2 Debugging
Sorry to jump in so late, but depending on what I'm looking for, I generally do one of two things. If I am looking at reproducing a bug (which I haven't been doing much lately) and it would be easier to reproduce in a web-app, then I will try to update one of the reference apps (struts2-blank, struts2-showcase) and then run the updated web-app in my IDE in the debugger. The other option is to create a test-case using JUnit or something similar to validate the bug and debug it there. As far as learning the internals... just like any other significantly complex system, you just have to spend time grokking through it and it will eventually make sense. It's much harder to try to learn it all at once, so pick some piece that you can conceptualize (one of the interceptors or results for instance) and work through it. -Wes On Wed, May 26, 2010 at 7:22 AM, aum strut aum.str...@gmail.com wrote: DO any one have other way to do this job done??? Please share their ideas On Tue, May 25, 2010 at 5:46 PM, aum strut aum.str...@gmail.com wrote: Alex i am some what agree.. but i am wondering how the Struts2 Development team is doing this..i am sure they are not following the things as you have mentioned. I am sure that must be some easy way to some one who wants to get knowledge about that internal working structure of struts2 id any one have better idea please do share here On Tue, May 25, 2010 at 5:13 PM, Alex Rodriguez Lopez alo...@flordeutopia.pt wrote: I use to find it impossible to do this... Then I started to use Maven, which can be used to download source code and attach it easily. If you use Eclipse I suggest using M2Eclipse plugin. After you get a Struts2 based project with Maven2 up and running it should be easy to do what you want, download sources and javadocs, and start debugging! Hi All, I am in process to explore internals of Struts2.Can any one suggest me how can i move ahead. All i need to know how framework internally called its different component and for this i guess i need to download the source code but how and what to do next i am confused.. can any one point me to a direction so that i can move ahead. Thanks in advance -Aum - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Struts2+Spring2+Interceptor+Invalid action class configuration that references an unknown class named
On Tue, May 25, 2010 at 8:47 AM, rocks devendra_tiwari12...@yahoo.com wrote: Martin, I haven't get any response from Wes [:(]. Sorry I didn't notice that I was being called out directly :)... I was out of town, in a magical place that my children really enjoyed, but unfortunately charged $9.99 / day for internet access[1] I am still trying to catch up on a lot of email (it's amazing how far behind you can get on email when you're cut off for only a few days). I haven't read your message thoroughly, and I can't promise that I will right away. But, I do have an example that might help[2]. If it doesn't help, post back here, there are tons of users on this list combining struts2, spring and hibernate. If you didn't get many responses before, you probably haven't posted enough details or the description of your problem was too vague. [1] http://disneyworld.disney.go.com/resorts/contemporary-resort/services-amenities/ [2] http://code.google.com/p/struts2inpractice/source/browse/#svn/trunk/ch04ex01 (check the ch04ex01 project) -Wes -- 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
Re: Some Spring/Struts questions
I've seen a few responses, but I think the best way would be to write an interceptor that places the bean into the session. Give it a known name in the session, then you can use OGNL to access it... Here is a quick example of the interceptor - public class CustomInterceptor extends AbstractInterceptor { private SomeBeanGeneratingService someBeanGeneratingService; public String intercept(ActionInvocation invocation) throws Exception { invocation.getSession().put(knownBeanName, someBeanGeneratingService.getBean()); return invocation.invoke(); } public void setSomeBeanGeneratingService(SomeBeanGeneratingService someBeanGeneratingService) { this.someBeanGeneratingService = someBeanGeneratingService; } } The benefit is using an interceptor is two-fold... One is that it's pretty easy to unit test (compared to a Servlet Filter). Two is that it can be spring-configured and spring-injected. With this interceptor putting the bean into the session, you can access the bean's values through OGNL. Here is an example s:property tag retrieving some property - s:property value=%{#session.knownBeanName.someProperty} / Then, configure the interceptor and dependencies and put this interceptor in your stack. -Wes On Wed, May 12, 2010 at 4:57 AM, Andy Law andy@roslin.ed.ac.uk wrote: All, Apologies if this would be better asked in a Spring forum. If so, I would appreciate guidance as to which one/where. I have a Struts2 application with around 30 actions. Most inherit from a common base class. We have configured the system to start to use Spring to inject certain things into certain places. This seems to work well and we are all currently happy bunnies. A new requirement means that we need to have available across pretty much every action a separate, independent bean that carries information that may (or may not) need to be displayed on the resulting web-pages. I am wondering what the best way is to make this bean available to each JSP. I'm happy with injecting certain beans into certain actions, but I'm not clear what I should be injecting *this* bean into. Ideally it should just pop into existence and be available to the JSPs without the Actions even being aware that it is there. It's not part of the business logic and is purely informational. If I have to make it available through the Actions then I would *like* to be able to inject it into the common base class with a single configuration and have that work automatically for all sub-classes (and this would be a useful trick for some other places in the application) but that does not seem to be possible unless I'm missing a trick? How should I configure this, please? Later, Andy -- View this message in context: http://old.nabble.com/Some-Spring-Struts-questions-tp28533505p28533505.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 -- 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
Re: Some Spring/Struts questions
James, What I normally do is create a package and set the defaults that I want stuff to use (interceptors / interceptor stack / etc.). Then, I just tell the convention plugin to use the package I configured The list of properties that the plugin uses is here - http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-Configurationreference I think the setting is - struts.convention.default.parent.package -Wes On Wed, May 12, 2010 at 9:39 AM, James Cook james.c...@wecomm.com wrote: That would be my favoured route. Wes, side question. Using the convention plugin can you modify the stack in the xml file so you don't have to annotate the action itself? Or do you still have to add the annotation with the interceptor put in? James -Original Message- From: Wes Wannemacher [mailto:w...@wantii.com] Sent: 12 May 2010 14:33 To: Struts Users Mailing List Subject: Re: Some Spring/Struts questions I've seen a few responses, but I think the best way would be to write an interceptor that places the bean into the session. Give it a known name in the session, then you can use OGNL to access it... Here is a quick example of the interceptor - public class CustomInterceptor extends AbstractInterceptor { private SomeBeanGeneratingService someBeanGeneratingService; public String intercept(ActionInvocation invocation) throws Exception { invocation.getSession().put(knownBeanName, someBeanGeneratingService.getBean()); return invocation.invoke(); } public void setSomeBeanGeneratingService(SomeBeanGeneratingService someBeanGeneratingService) { this.someBeanGeneratingService = someBeanGeneratingService; } } The benefit is using an interceptor is two-fold... One is that it's pretty easy to unit test (compared to a Servlet Filter). Two is that it can be spring-configured and spring-injected. With this interceptor putting the bean into the session, you can access the bean's values through OGNL. Here is an example s:property tag retrieving some property - s:property value=%{#session.knownBeanName.someProperty} / Then, configure the interceptor and dependencies and put this interceptor in your stack. -Wes - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Some Spring/Struts questions
Yep... Here's a quick example struts.xml - !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN http://struts.apache.org/dtds/struts-2.1.7.dtd; struts constant name=struts.convention.default.parent.package value=/view/ package name=/view namespace=/view extends=app-base result-types result-type name=json class=org.apache.struts2.json.JSONResult/ /result-types interceptors interceptor name=json class=org.apache.struts2.json.JSONInterceptor/ interceptor name=securityInterceptor class=securityInterceptor/ !-- what follows is a mod of the stock paramsPrepareParams, but jsonValidation is added -- interceptor-stack name=paramsPrepareParamsJsonStack interceptor-ref name=exception/ interceptor-ref name=servletConfig/ interceptor-ref name=checkbox/ interceptor-ref name=params param name=excludeParamsdojo\..*,^struts\..*/param /interceptor-ref interceptor-ref name=prepare/ interceptor-ref name=actionMappingParams/ interceptor-ref name=params param name=excludeParamsdojo\..*,^struts\..*/param /interceptor-ref interceptor-ref name=conversionError/ interceptor-ref name=validation param name=excludeMethodsinput,back,cancel/param /interceptor-ref interceptor-ref name=jsonValidation/ interceptor-ref name=workflow param name=excludeMethodsinput,back,cancel/param /interceptor-ref /interceptor-stack interceptor-stack name=appStack interceptor-ref name=securityInterceptor/ interceptor-ref name=defaultStack/ /interceptor-stack /interceptors default-interceptor-ref name=appStack/ global-results result name=loginRequired type=redirect param name=location/login.jsp/param param name=parsefalse/param /result /global-results /package /struts On Wed, May 12, 2010 at 10:03 AM, James Cook james.c...@wecomm.com wrote: Ah, awesome. Thank you for clearing that one up and your package is defined in the struts.xml in the root of the source? -Original Message- From: Wes Wannemacher [mailto:w...@wantii.com] Sent: 12 May 2010 14:51 To: Struts Users Mailing List Subject: Re: Some Spring/Struts questions James, What I normally do is create a package and set the defaults that I want stuff to use (interceptors / interceptor stack / etc.). Then, I just tell the convention plugin to use the package I configured The list of properties that the plugin uses is here - http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-Configurationreference I think the setting is - struts.convention.default.parent.package -Wes On Wed, May 12, 2010 at 9:39 AM, James Cook james.c...@wecomm.com wrote: That would be my favoured route. Wes, side question. Using the convention plugin can you modify the stack in the xml file so you don't have to annotate the action itself? Or do you still have to add the annotation with the interceptor put in? James -Original Message- From: Wes Wannemacher [mailto:w...@wantii.com] Sent: 12 May 2010 14:33 To: Struts Users Mailing List Subject: Re: Some Spring/Struts questions I've seen a few responses, but I think the best way would be to write an interceptor that places the bean into the session. Give it a known name in the session, then you can use OGNL to access it... Here is a quick example of the interceptor - public class CustomInterceptor extends AbstractInterceptor { private SomeBeanGeneratingService someBeanGeneratingService; public String intercept(ActionInvocation invocation) throws Exception { invocation.getSession().put(knownBeanName, someBeanGeneratingService.getBean()); return invocation.invoke(); } public void setSomeBeanGeneratingService(SomeBeanGeneratingService someBeanGeneratingService) { this.someBeanGeneratingService = someBeanGeneratingService; } } The benefit is using an interceptor is two-fold... One is that it's pretty easy to unit test (compared to a Servlet Filter). Two is that it can be spring-configured and spring-injected. With this interceptor putting the bean into the session, you can access the bean's values through OGNL. Here is an example s:property tag retrieving some property - s:property value=%{#session.knownBeanName.someProperty} / Then, configure the interceptor and dependencies and put this interceptor in your stack. -Wes - To unsubscribe, e-mail: user
Re: Some Spring/Struts questions
On Wed, May 12, 2010 at 10:42 AM, Dale Newfield d...@newfield.org wrote: That all sounds reasonable, except the part about putting it in the session instead of the request. If there's no compelling reason to store something in the session, I think that it should be avoided. If you're using an interceptor that's going to be doing this injection for each request anyway, you might as well store it in request scope. If you're storing it in the session, and the bean doesn't change much (and can't get stale), the interceptor might as well at least check to see if it's already present and act as a no-op in that case. Good point, Dale... I didn't read the OP close enough and was being lazy. -Wes -- 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
Re: Error in running juit test case for struts2 action class
-- but already i have the listener configuration in my web.xml. Thanks in advance.. -- View this message in context: http://old.nabble.com/Error-in-running-juit-test-case-for-struts2-action-class-tp28410616p28410616.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 -- 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
Re: Question on WW-2272 fixed by musachy
This might be hard to nail down because, in looking at the resolution date, that looks like he fixed it back before xwork was brought over into the Apache source repository. You can start over here - http://www.opensymphony.com/xwork/cvs.action But, the fisheye instance over at opensymphony has been hosed up for a while. So, you'll have to actually checkout the code (using the instructions on that page) and then diff from something like r1779 and r1780 -Wes On Thu, Apr 29, 2010 at 12:08 PM, Bhaarat Sharma bhaara...@gmail.com wrote: I am referring to this JIRA ticket: https://issues.apache.org/jira/browse/WW-2272 This code was fixed by musachy and the comment says: Fixed on xwork. rv1780 I am just trying to figure out what rv1780 means and how can I traslate that to which xwork jar would have this issue fixed? Currently I have the following xwork jar: xwork-2.0.1.jar Can someone please help me find which xwork jar version corresponds to rv1780? Thanks -bhaarat -- 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
Re: Partial Validation
I'm sure that other people would be interested... The best way to share your enhancement would be to set it up as a standalone project that operates as a struts2-plugin. Make the project available through googlecode, sourceforge or java.net. Then, register it as a struts2-plugin over here - https://cwiki.apache.org/confluence/display/S2PLUGINS/Home -Wes On Wed, Apr 28, 2010 at 1:58 AM, Rahul Mohan rahul.mo...@tcs.com wrote: Thanks for your comments Wes. I do have different action methods which I am invoking through wild-card mappings. But I do not want to repeat the same validations in page level submits and partial submits. I have implemented another solution with a little bit of S2 customization. - Introduced a new annotation to group fields on the action class. For example: @Group(CustomerAddress) private int cityCode; - Introduced a group validation annotation to validate fields of only one group from the class. Example: �...@validate(CustomerAddres) public String saveAddress() { } - Implemented a GroupValidatorManager extends AnnotationActionValidatorManager (S2 internal) and introduced that instead of the AnnotationValidationManager in struts xml as the default bean: bean name=default type= com.opensymphony.xwork2.validator.ActionValidatorManager class=com.tcs.gui.arch.validation.GroupValidatorManager / - GroupValidatorManager overrides the getValidator to return only the applicable validators for the current method by processing the annotations. I can share this code if anyone is interested. - Rahul From: Wes Wannemacher w...@wantii.com To: Struts Users Mailing List user@struts.apache.org Date: 27-04-2010 21:12 Subject: Re: Partial Validation When you submit the fieldset through ajax, are you submitting to a different action mapping? If the ajax submit and the full form submit, you could setup a validation for the action mapping that corresponds to the ajax submit. Handling ajax validation is a bit tricky, but somewhere in the wiki, there is a document that describes it. -Wes On Wed, Apr 21, 2010 at 3:35 AM, Rahul Mohan rahul.mo...@tcs.com wrote: Hi, Is there any way I can do a partial validation in Struts 2? I have a page with two fieldsets, where I can either submit the entire page or submit only the fieldset (through Ajax). In the latter case, I wish to validate only the fieldset's properties, but in the former case I want the entire page to be validated. I am using annotation for validation. Regards, Rahul =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -- 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 =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -- 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
Re: struts if tag related help
s:if test=%{#session.UserList.size() 0} (assuming that #session.UserList evaluates to some form of java.util.Set) -Wes On Wed, Apr 28, 2010 at 9:54 AM, Upasana Sharma sharma...@gmail.com wrote: Hi is something like this possible in struts2 s:if test=%{not empty #session.UserList} I am aware of logic:notempty tag but is it possibel to achive the same result using s:if tag.. -- Thanks and Regards Upasana Sharma -- 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
Re: Odd Interceptor Behaviour with Spring Plugin (possibly)
Without looking at the blog entry you posted, I would suggest looking at your interceptor stack configuration for the action. The most likely case is that some other interceptor is interrupting execution (likely for a legitimate reason). For instance, the workflow (or is it validation) interceptor might have detected that validation failed and returned input before executing your action. If your interceptor is configured further down the stack, then it won't be reached. As for why it is behaving differently in an app that has the spring plugin vs. non-spring app... I would first assume that's a red herring and you should check first what I mentioned above. -Wes On Wed, Apr 28, 2010 at 10:29 AM, RogerV roger.var...@googlemail.com wrote: I'm using the RedirectMessageInterceptor from http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2. In the first application I used it in, which is a standard out of the box struts 2 application it works as expected. I'm now using it in a project that uses the Spring plugin for some of my class instantiation and the interceptor never fires. I've added logging to the code in the Constructor and in the doIntercept method. In the first instance I see the constructor message and for every action called I see the doIntercept() messages. In the second case, I see the Constructor messages logged, so Struts/Spring is seeing it, but the doIntercept() method never fires. Has anyone seen anything like this before who could suggest what to check next? Regards -- View this message in context: http://old.nabble.com/Odd-Interceptor-Behaviour-with-Spring-Plugin-%28possibly%29-tp28387977p28387977.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 -- 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
Re: S2 validation without API ties
Chris, There are a few non-struts/xwork-validation plugins that integrate with general purpose validation mechanisms. Off the top of my head, I remember this - https://cwiki.apache.org/confluence/display/WW/OVal+Plugin But, I think there are two distinctly different things you are considering here. If you want to validate class instances that aren't linked in any way against struts/xwork libraries, then you should simply separate your validateable objects from your struts actions... For instance - public class YourAction extends ActionSupport { private YourValidateableBean propName ; // getters/setters/etc. public String execute() { return propName.execute(); } } I can understand your desire to remove the dependency of struts, making your actions reusable. But at the same time, without the helper methods that ActionSupport provides, implementing a mechanism for displaying validation failure error messages in the struts tags becomes extremely difficult. I will add, ActionSupport is linked only against classes provided by the JDK. And, that extending ActionSupport isn't a requirement, but not extending it means you will lose mostly the integration with the tags on the frontend. Even if you still don't want struts/xwork classes in your validation, i would suggest the OVal plugin, combined with a delegatory setup for executing your beans. -Wes On Wed, Apr 28, 2010 at 11:32 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rahul, On 4/27/2010 1:09 AM, Rahul Mohan wrote: I think the fundamental mechanism of S2 is the configurable interceptor stack where each interceptor applies itself to the current action based on the interfaces the action implements. You can still reuse this mechanism by defining your own interceptor stack with your own interfaces. Lets S2 ( or rather xwork ) take care of the wiring. Essentially, building your framework using the underlying configurable interceptor stack mechanism. Does that answer your question? Not really what I'm trying to do is build an action that does not depend upon the S2/xwork APIs, but can still work with them. Specifically, I'd rather have: public class MyAction extends (nothing) implements (Nothing) { public void addFieldError(String field, String message) { ... }; } rather than this: public class MyAction extends ActionSupport and/or implements ValidationAware { // addError declared in ValidationAware public void addFieldError(String field, String message) { ... }; } I believe the ValidationInterceptor has code that looks something like this: if(action instanceof ValidationAware) { foreach field { validate field if(error) action.addFieldError(fieldName, errorMessage); } } I was wondering if there was any interest in an alternative implementation that did something more like this: if(declaresValidationMethods(action.getClass()) { foreach field { validate field if(error) action.addFieldError(fieldName, errorMessage); } } I could certainly implement this myself, but I'm wondering if there is wider interest in such an interceptor. Thanks, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvYVScACgkQ9CaO5/Lv0PBmaQCfRGHa7iD3rOUkukq9mRbiNW/F d7MAmwfYI3P0iUhD3lnZs0U7jv+qHj5h =Y6iv -END PGP SIGNATURE- - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Partial Validation
When you submit the fieldset through ajax, are you submitting to a different action mapping? If the ajax submit and the full form submit, you could setup a validation for the action mapping that corresponds to the ajax submit. Handling ajax validation is a bit tricky, but somewhere in the wiki, there is a document that describes it. -Wes On Wed, Apr 21, 2010 at 3:35 AM, Rahul Mohan rahul.mo...@tcs.com wrote: Hi, Is there any way I can do a partial validation in Struts 2? I have a page with two fieldsets, where I can either submit the entire page or submit only the fieldset (through Ajax). In the latter case, I wish to validate only the fieldset's properties, but in the former case I want the entire page to be validated. I am using annotation for validation. Regards, Rahul =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -- 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
Re: Struts2 annotations and superclass
At first glance, I would think that what you describe would be the easiest method. For instance, I would do the following - @Override @Action(/url) public String method() { return super.method(); } This would get a bit tedious if you have a significant number of actions. If you have a lot of methods, take a look at creating your own action mapper and implement your own annotation. Implementing your own action mapper is easier than it sounds and there are plenty of example plugins. -Wes On Wed, Apr 21, 2010 at 8:44 AM, Robert Taylor rtay...@dtgresults.com wrote: Greetings, We are converting from using Struts1 and XDoclet to Struts2 and Struts2 annotations. We have a base action class which handles requests which displays grid style information. The super class is a template pattern which does a lot of the common heavy lifting and exposes a method display which is invoked by a name specified in the action configuration for the url. Subclasses simply implement a method to retrieve a collection of objects. What we have been doing is placing the XDoclet annotations in the subclasses which specified the url and the method to invoke. With Struts2, I don't see that this is possible using just the annotations. It appears subclasses will have to override the superclass method just to bind a url. I don't see that the @Action annotation supports a method parameter or it may be possible. The same problem will occur for our CRUD action super classes. The subclasses will have to override the super class methods just to bind the method name to the url. So, am I missing something? Is it possible to use Struts2 annotations such that subclasses don't have to override super class methods simply to bind the method name to the url? /robert -- 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
Re: Issue with localization: Messages not picked up from properties file
Kartik, First off, your first mapping doesn't forward it dispatches to the login.jsp page. If the validation file you have created is picked up when the user hits that url, then you are going to see the validation errors. Second, in your form tag, I would remove the '.action' from the action attribute. Also, to make your page flow better, i would change the mapping as follows - action name = login_* class=LoginAction method={1} result name=input/login.jsp/result result name=success/login_success.jsp/result result name=error/login.jsp/result /action Then, change your form tag so that it looks like this - s:form action=login_authenticate ... Notice that you no longer need a separate mapping for login_input. In addition, the flow of validation will be easier to follow. The trick is that your entry point will now be - /contextroot/login_input.action -Wes On Wed, Apr 21, 2010 at 1:26 PM, Kartik Kumar krishnan.1...@gmail.com wrote: Hi All, In my package structure, I have package.properties file with the following key value pair: username=User Name password=Password In my simple login page: the form elements are defined with a key look up.. s:form action=login.action method=POST validate=true s:textfield name=username key=username / s:password name=password key=password/s:password s:submit value=Login name=login / /s:form My action xml mappings are given below. The first action is a forward action to the login page. action name = login_input result/login.jsp/result /action action name = login class=LoginAction method=authenticate result name=input/login.jsp/result result name=success/login_success.jsp/result result name=error/login.jsp/result /action When I try to load the login page like this: http://localhost:8080/myApp/login_input.action, I don't see the messages picked up from the package.properties. I see the localized messages if I submit the application and when the validation fails. What can I do to resolve the issue? Thanks, Kartik http -- 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
Re: use servletcontext in typeconvert
Try to make your type converter implement the ApplicationContextAware interface. -Wes On Tue, Apr 27, 2010 at 5:33 PM, yunaki yun...@126.com wrote: in the convertFromString method, I hope to use servletcontext to get a applcation context property. Is it possible?thx -- View this message in context: http://old.nabble.com/use-servletcontext-in-typeconvert-tp28382360p28382360.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 -- 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
Re: org.apache.struts2.dispatcher.FilterDispatcher cannot be cast to javax.servlet.Filter
That error doesn't make a lot of sense... Check a few of the following - Which version of Glassfish are you using (2.x, 3) Restart glassfish Make sure that you don't have servlet.jar or jsp-api.jar in your /WEB-INF/lib Deploy the app to another container (jetty or tomcat) to make sure that your app isn't the problem As you can see, I'm grasping straws... -Wes 2010/3/23 Hallgrímur Th. Björnsson hallgrimur.bjorns...@skyrr.is: Hi, I found where to change the filter settings. I get the exact same errors with the different filters: java.lang.ClassCastException: org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter cannot be cast to javax.servlet.Filter For all 3 filters you suggested. Kveðja / Regards, Hallgrímur -Original Message- From: Hallgrímur Th. Björnsson [mailto:hallgrimur.bjorns...@skyrr.is] Sent: 23. mars 2010 11:54 To: Struts Users Mailing List; lukasz.len...@gmail.com Subject: RE: org.apache.struts2.dispatcher.FilterDispatcher cannot be cast to javax.servlet.Filter Hi, Thanks for the reply. Where is this typically changed? In an XML file or in the code? Kveðja / Regards, Hallgrímur -Original Message- From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] Sent: 23. mars 2010 11:49 To: Struts Users Mailing List Subject: Re: org.apache.struts2.dispatcher.FilterDispatcher cannot be cast to javax.servlet.Filter 2010/3/23 Hallgrímur Th. Björnsson hallgrimur.bjorns...@skyrr.is: I am fairly new to Struts. I'm trying to get an application which uses Struts to work on Glassfish v3. I have made it work on JBoss and Tomcat. Try to use one of these org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter or (when you are using Sutemesh) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter Regards -- Łukasz http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: About bank application using Struts 2
There are quite a few good books about general security practices for software development... There used to be a library that you can use to help secure your web-app ...looking... http://www.hdiv.org/ They used to support an s2 plugin, but I'm not sure which version it works with. In general, you want to treat security as something you approach in layers. Obviously, you want to encrypt communications that might expose sensitive information (apply ssl), and you want to utilize an authentication and authorization mechanism (spring-security). After that, you want to treat all user input as unsafe/tainted (escape before displaying to other users, use parameterized sql statements rather than constructing strings of sql) and make sure that you pay close attention that you try not to put sensitive data on the URL string (using form method=GET for form-based authentication). In addition, it may not hurt and would probably be worth the money to involve a security professional to perform audits or to participate in code reviews. There are new attack mechanisms that crop up all the time and a lot of times security pros can point out things that you didn't know where potential problems. Lastly, make sure you secure your application server... There is a guide to hardening Tomcat here - http://cisecurity.org/en-us/?route=downloads.browse.category.benchmarks.servers.web.apache If you are not using tomcat, make sure you know enough about your application server that you don't open up attack vectors at the server. -Wes On Mon, Mar 22, 2010 at 4:28 PM, Oscar oscar.kalde...@gmail.com wrote: Hi to all, right now i'm going to develop something like bank application to enable users to manage their accounts, transfer money, pay services and so on, and really i have no experience developing applications like that (where security is really important) so i don't know if exists some book about critical applications development with struts 2 or you can give me some tips to develop a secure application, also tips about struts and ssl, or if you know internet resources that talk about that. Thanks in advance. -- Oscar -- 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
Re: Struts2 + Sitemesh + Freemarker doesn't work
On Thu, Mar 18, 2010 at 12:02 PM, jonathan doklovic list-rea...@sysbliss.com wrote: I almost have this working, however, it seems that struts-core-2.2.0-SNAPSHOT depends on xwork-2.2.0-SNAPSHOT which doesn't seem to be available anywhere. It's here - http://hudson.zones.apache.org/hudson/view/Struts/job/struts2/193/com.opensymphony$xwork-core/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Parameter in If tag
On Thu, Mar 18, 2010 at 11:07 PM, Kusuma Haranath Atmakuri haranat...@yahoo.com wrote: s:if test=%{#parameters['paramName'][0] =='paramValue'} Thanks a lot! This worked! parameters['paramName'] returns an array? Yeah, it's a bit of a pain sometimes, but there is nothing that stops someone from writing html like this - form ... input name=foo value= type=text / input name=foo value= type=text / /form In this case, you can retrieve all of the values submitted for foo as an array. It's just one of those details people sometimes forget when you get away from dealing directly with request parameters. -Wes -- 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
Re: Getting the authenticated user from Spring Security for use in an Action
What mechanism are you using to handle authentication/authorization? -Wes On Tue, Mar 16, 2010 at 5:14 PM, Lance Hill la...@baldhead.com wrote: I need to access information about the currently logged in user. I don't think putting the user into the session during login is how it is supposed to be done, but I have not found examples of how to get access to the current user from Spring/Spring Security. Can someone please provide a link or brief example of the best practice? Thank you. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Getting the authenticated user from Spring Security for use in an Action
I use - SecurityContextHolder.getContext().getAuthentication() I assume that if the object returned is null, then the user isn't logged in. I am using spring-security 2.0.4. -Wes On Tue, Mar 16, 2010 at 5:42 PM, Lance Hill la...@baldhead.com wrote: I have Spring Security set up to use CasAutheticationProvider to provide a UserDetails object. I did find an example that uses the SecurityContext to obtain an Authentication object and grab the UserDetails from there. I am not sure how to get access to the populated SecurityContext since SecurityContextHolder.getContext() is returning an empty SecurityContext and I am not sure if that is the best way to access the user. -Original Message- From: Wes Wannemacher [mailto:w...@wantii.com] Sent: Tuesday, March 16, 2010 5:16 PM To: Struts Users Mailing List Subject: Re: Getting the authenticated user from Spring Security for use in an Action What mechanism are you using to handle authentication/authorization? -Wes On Tue, Mar 16, 2010 at 5:14 PM, Lance Hill la...@baldhead.com wrote: I need to access information about the currently logged in user. I don't think putting the user into the session during login is how it is supposed to be done, but I have not found examples of how to get access to the current user from Spring/Spring Security. Can someone please provide a link or brief example of the best practice? Thank you. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Struts2 + Sitemesh + Freemarker doesn't work
We'll probably need a little more info. In particular, I'd like to know is which versions of struts, sitemesh and freemarker you are using. Also, how do you have the various filters configured in your struts.xml. Also, are you decorating freemarker results with freemarker decorators? -Wes On Mon, Mar 15, 2010 at 12:05 PM, jonathan doklovic list-rea...@sysbliss.com wrote: I've been working for a week now trying to get Struts2 + Sitemesh + Freemarker to work. I've followed many tutorials and read docs but I still can't get it to work. Basically the decorator runs, but none of the variables get put into scope and so I get literal ${body}, ${title} and ${head} printed out. You can find full details with my source in my stack overflow question: http://stackoverflow.com/questions/2420752/struts2-sitemesh-freemarker-doesnt-work Can anyone help??? Thanks, - Jonathan - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Struts2 + Sitemesh + Freemarker doesn't work
I am not decorating JSP with freemarker decorators, I am decorating JSP with JSP, but I use the following filter - filter filter-namesitemesh/filter-name filter-classcom.opensymphony.sitemesh.webapp.SiteMeshFilter/filter-class /filter The filter you are using might be buggy... I don't know if it has seen any attention in a while. If you get a moment, whip up a simple example web-app that demonstrates the problem and create a JIRA on it. A quick look in JIRA shows that someone was working on a solution for sitemesh issues - http://issues.apache.org/jira/browse/WW-3296 But, I haven't seen a patch yet. Anyhow, I don't know sitemesh well enough to say whether using SiteMeshFilter will fix your problem, but give it a try. If you provide a sample app, I'll try to get it fixed for the next release. -Wes On Mon, Mar 15, 2010 at 1:19 PM, jonathan doklovic list-rea...@sysbliss.com wrote: All of the code is listed in the stackoverflow question. I'm using: Struts 2.1.8.1 Struts-Sitemesh Plugin 2.1.8.1 Sitemesh 2.4.2 Freemarker 2.3.15 Currently, I just have a single index.action that returns index.jsp which is decorated with a single main.ftl file. The jsp just has the simplest html structur with a string in the body. The ftl decorator just adds a string and tries to spit out the body of the jsp. my struts.xml is: struts constant name=struts.devMode value=true/ package name=basicstruts2 extends=struts-default action name=index result/index.jsp/result /action /package /struts my web.xml filters are: filter filter-namestruts-prepare/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class /filter filter filter-namesitemesh/filter-name filter-classorg.apache.struts2.sitemesh.FreeMarkerPageFilter/filter-class /filter filter filter-namestruts2/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class /filter filter-mapping filter-namestruts-prepare/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern dispatcherREQUEST/dispatcher dispatcherFORWARD/dispatcher dispatcherINCLUDE/dispatcher /filter-mapping filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping Wes Wannemacher wrote: We'll probably need a little more info. In particular, I'd like to know is which versions of struts, sitemesh and freemarker you are using. Also, how do you have the various filters configured in your struts.xml. Also, are you decorating freemarker results with freemarker decorators? -Wes On Mon, Mar 15, 2010 at 12:05 PM, jonathan doklovic list-rea...@sysbliss.com wrote: I've been working for a week now trying to get Struts2 + Sitemesh + Freemarker to work. I've followed many tutorials and read docs but I still can't get it to work. Basically the decorator runs, but none of the variables get put into scope and so I get literal ${body}, ${title} and ${head} printed out. You can find full details with my source in my stack overflow question: http://stackoverflow.com/questions/2420752/struts2-sitemesh-freemarker-doesnt-work Can anyone help??? Thanks, - Jonathan - 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 -- 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
Re: Parameter in If tag
Parameters that aren't bound to an action property can be tricky... I would try some of the following to see if you can figure out what's going on - s:if test=%{#parameters.paramName.0 =='paramValue'} s:if test=%{#parameters['paramName'] =='paramValue'} s:if test=%{#parameters['paramName'][0] =='paramValue'} -Wes On Mon, Mar 15, 2010 at 2:45 PM, Kusuma Haranath Atmakuri haranat...@yahoo.com wrote: By the way, I am using Struts 2.1.8.1. Actually it was a WebWork app and converting that into Struts2. Referring a parameter was so easy in ww with just '$paramName'. It's weird that I am stuck at such a simple thing. Any light on this would be of great help. Thank you! To: user@struts.apache.org Sent: Sun, March 14, 2010 8:36:44 PM Subject: Parameter in If tag From the actions config, a parameter is being passed: action ... resultmain.jsp?paramName=paramValue/result When tried to access the paramName, it's fine when used in 'property' tag. s:property value=%{#parameters.paramName} / will print 'paramValue'. But when used in 'If' tag, it does NOT. Is there anything missing here? Tried all the combinations of #, {}, %, double quotes and single quotes. Any help would be greatly appreciated. s:if test=%{#parameters.paramName=='paramValue'} will return FALSE. Thank you! -- 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
Re: XSS vulnerability with s:text
Go ahead and file a jira. Better yet, file one with a patch and unit test. I don't know if we would make escaping the default (it might break backward compatibility). But it is definitely worth putting in the next release. -Wes On 2/19/10, John Orr webskate...@googlemail.com wrote: Thanks for the cleaner code - that is an improvement, and I'll use that idiom. I agree that generally s:text is intended for displaying safe text. However the use case Hello, {0} has to be pretty common, when something like a user name is inserted. Also the ability to access OGNL inside resource bundles (Hello, ${user.firstName}) guarantees that parameters that may well originate with user input can end up inside s:text. (Note, parameter escaping wouldn't help in this case.) The problem becomes most serious if different people have different responsibilities. If the person responsible for writing the JSP's is not involved with the resource bundles or the action layer, then they have no way of knowing whether the text they are inserting is safe or not. And I'd say they really need a clean way to take responsibility to ensure what goes on the page is safe. Perhaps an escape attribute on s:text which defaults to false would help. Thanks, again, John On Fri, Feb 19, 2010 at 8:24 AM, Greg Lindholm greg.lindh...@gmail.com wrote: A slightly cleaner way would be like this: s:text name=resource.key s:params:property value=param1//s:param/s:text I think in most cases s:text is used for displaying safe text that the app either supplies or generates. Obviously if you do use it to echo user supplied data you need to be careful. It would be nice to have a flag like you suggest however it might be difficult to get the behavior exactly right since the text may contain formatting tags and what you really want is to just escape the parameters. On Thu, Feb 18, 2010 at 5:25 PM, John Orr webskate...@googlemail.com wrote: This is my first posting to this list, so excuse me if this is an issue that's already been addressed. My concern is with the XSS vulnerability in the following use case: s:text name=resource.key s:param value=param1/ /s:text It seems (Struts 2.1.8.1) that there is no mechanism in s:text or s:param to do HTML escaping. If param1 contains user input then this opens the door to XSS attacks. The easiest solution I can see is to modify the code to s:text var=v name=resource.key s:param value=param1/ /s:text s:property value=v/ This works, but it is a lot of work. It seems to me it would be better if Struts2 supported s:text name=resource.key escape=true s:param value=param1/ /s:text or, better yet, had escape=true as its default. Is there another way round this problem which I am missing? Thanks, John - 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 -- 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
Re: [Q] Enable Freemarker template caching
If you are using struts 2.0.9 or earlier, then you will have to copy the template directory out of the struts2-core jar file into your web-app. (Off the top of my head, I can't remember if you copy it to context-root, context-root/WEB-INF, context-root/WEB-INF/classes, but I'm sure that's in the docs or online somewhere). If you are using 2.0.10 or higher, then just set the mentioned value to true... You can do that by putting this in your struts.xml file - constant name=struts.freemarker.templatesCache value=true / -Wes On Mon, Feb 15, 2010 at 2:33 PM, Hoying, Ken ken_hoy...@premierinc.com wrote: I am finding the text regarding the enablement of Freemarker template caching in the performance tuning document (http://struts.apache.org/2.1.8.1/docs/performance-tuning.html) to be a bit confusing. The document states: start clip As of Struts 2.0.10, setting the property struts.freemarker.templatesCache to true will enable the Struts internal caching of Freemarker templates. This property is set to false by default. In Struts versions prior to 2.0.10, you had to copy the /template directory from the Struts 2 jar in your WEB_APP root to utilize Freemarker's built in chaching mechanism in order to achieve similar results. The built in Freemarker caching mechanism fails to properly cache templates when they are retrieved from the classpath. Copying them to the WEB_APP root allows Freemarker to cache them correctly. Freemarker looks at the last modified time of the template to determine if it needs to reload the templates. Resources retrieved from the classpath have no last modified time, so Freemarker will reload them on every request. end clip I am confused. Do I or don't I need to copy the Freemarker templates to my WEBAPP to take advantage of the caching? Do I copy them to WEBAPP\template\.. or to WEBAPP\struts\template like with the static content? Thanks, Ken - ***Note:The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the Sender immediately by replying to the message and deleting it from your computer. Thank you. Premier Inc. -- 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
Re: Dynamic values for rows attribute of s:textarea
If you're calculating your value with s:set and setting a variable called, len did you try the following - s:textarea label=Request Definition name=requestDefinition labelSeparator= labelposition=left readonly=true cols=80 rows=%{#len} / On Thu, Feb 4, 2010 at 2:27 PM, Jim Talbut jim.tal...@groupgti.com wrote: Hi, I have: s:textarea label=Request Definition name=requestDefinition labelSeparator= labelposition=left readonly=true cols=80 rows=5 / Sometimes I have a LOT of data to display in the box, other times I have none at all. I'd like the box to resize based on the amount of data. My best effort involved getting the length of requestDefinition (using s:set), calculating a decent row count based on that and then trying to set the rows=%=len% Unfortunately that's against the DTD and struts blows up. Apart from a long series of ugly s:if elements is there any way to get a dynamic rowcount? I may resort to use javascript, but that'd be quite a faff (these textareas are in a series of forms generated by an iterator). Thanks Jim -- 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
Re: Different results with spring
What you are doing should work the way you expect... I use the Spring integration all the time :) A few simple questions, do you have the spring-plugin installed? Do you have the Spring ContextLoaderListener setup in the web.xml? Do you have any non-default configuration settings in any of web.xml, applicationContext.xml or struts.xml? Are you using any plugins other than the Spring plugin? What version of Spring and Struts are you using? -Wes On Fri, Jan 29, 2010 at 1:19 AM, Miguel miguel...@gmail.com wrote: Hello all, I have a problem when using spring and the spring aplication context. If I configure the action class directly from struts.conf, my action does just the correct behavior. (1) But if I configure the action in a spring file and in struts.conf put only the spring bean name everything gets piped to the input result (the prepare method is executed, but not the action method).(2) I would benefit if the second scenario worked, because in the spring configuration is quite complex and have more than one bean of the same type (1) action name=receptor_* method={1} class=com.fcm.sectorPrimario2009.ui.ReceptorAction (struts.conf) (2) action name=receptor_* method={1} class=receptorSPAction (struts.conf) bean id=receptorSPAction class=com.fcm.sectorPrimario2009.ui.ReceptorAction scope=prototype (spring.xml) property name=receptorDAOref local=receptorDAOSectorPrimario//property /bean I hope someone can help me Si quieres ser más positivo, pierde un electrón Miguel Ruiz Velasco Sobrino - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Boolean Type Conversion
I don't know if I'd go too far creating a TypeConverter... Can you just do something like this - s:if test=%{your.boolean.property}Y/s:ifs:elseN/s:else Really, you could probably create a .tag file out of it and reuse it easier than creating a Type Converter. -Wes On Fri, Jan 29, 2010 at 7:48 AM, RogerV roger.var...@googlemail.com wrote: Hi I have a collection of objects, each one contains a boolean flag, and I'm displaying these via a JSP as a list via an interator. Struts is converting the boolean fields into the strings true and false, I'd like to be able to 1) display them as Y and N 2) convert back to true and false when the list is returned 3) and do it via annotation if possible. Having read http://struts.apache.org/2.0.11.1/docs/type-conversion.html it looks that a custom TypeConvertor is the way to proceed. Is it possible to create a TypeConvertor that extends the existing Boolean convertor to return Y,N instead of true, false? Where do I find the convertor or is it a built-in function? Is it possible to do the override via annotation so that I can execute the override where I need it and default to the standard convertor where I don't. Regards -- View this message in context: http://old.nabble.com/Boolean-Type-Conversion-tp27371490p27371490.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 -- 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
Re: Strus2 sitemesh url parameters
Check here - http://struts.apache.org/2.x/docs/why-are-request-parameters-appended-to-our-hyperlinks.html Set the includeParams value to something other than 'get' -Wes On Mon, Jan 25, 2010 at 3:17 AM, emil thushanga thusha...@gmail.com wrote: Dear all, I use Struts2 and *Sitemesh* for my project. I have an issue with the URL parameters. My previous URL parameters are remaining as the same even if I go to new page, Is there any way to clear the parameter from my URL, this is a problem for me to do pagination. WEB.xml (i have configured following filters on my web.xml) = filter filter-nameaction2-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter filter filter-namesitemesh/filter-name filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class /filter filter filter-nameaction2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter Thanks Emil -- 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
Re: Struts2 s:head tag generates wrong paths?
Did you go to the generated URL in the browser? The struts filter recognizes certain URL patterns and will find the resources if they are in your web-app or pull them from the jar files. Requests headed for URLs like /web-app/struts/* are handled by the filter. -Wes On Thu, Jan 14, 2010 at 7:38 PM, Stephan R. Mueller stephanr.muel...@stud.leuphana.de wrote: Hi list. Using 2.1.8 with JSP on JBoss 5.1.0. s:head / generates the links for style.css and utils.js which is not valid, i.e. the files are not found at the specified position (after reviewing the generated HTML). A quick look shows that styles.css is located under /template/xhtml/styles.css and not under the generated struts/xhtml/styles.css . I'm not sure if this is a bug or just something I messed up or just if it's just a lack of knowledge on my side. Please tell me if further information is needed. Regards, Stephan - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Struts2 s:head tag generates wrong paths? [SOLVED]
No, you are right. This topic comes up from time-to-time and it is pretty safe to map the struts filter _only_ to /struts/* and *.action (if you are using .action as your default extension). There are no other magic gr urls. -Wes On Fri, Jan 15, 2010 at 12:06 PM, Stephan R. Mueller stephanr.muel...@stud.leuphana.de wrote: Hi Wes, thank you for the quick answer. I should have known - it's working now. The problem seems to be my web.xml. I wasn't using wildcard filtering (url-pattern/*/url-pattern - this works now) - I've been mixing action and servlet (ControllerServlet) mapping which led to an explicit URL-Pattern mapping for the filter. That's probably why the styles.css URLs could not correctly be mapped. So the paths generated were correct, but the path wasn't mapped correctly as you suggested. Please correct me if I'm wrong. My bad and thanks again. Regards, Stephan Am 15.01.2010 um 16:50 schrieb Wes Wannemacher: Did you go to the generated URL in the browser? The struts filter recognizes certain URL patterns and will find the resources if they are in your web-app or pull them from the jar files. Requests headed for URLs like /web-app/struts/* are handled by the filter. -Wes On Thu, Jan 14, 2010 at 7:38 PM, Stephan R. Mueller stephanr.muel...@stud.leuphana.de wrote: Hi list. Using 2.1.8 with JSP on JBoss 5.1.0. s:head / generates the links for style.css and utils.js which is not valid, i.e. the files are not found at the specified position (after reviewing the generated HTML). A quick look shows that styles.css is located under /template/xhtml/styles.css and not under the generated struts/xhtml/styles.css . I'm not sure if this is a bug or just something I messed up or just if it's just a lack of knowledge on my side. Please tell me if further information is needed. Regards, Stephan - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: How to do programatic validation?
Before you tie yourself to commons-validator, take a look at Oval. I could be wrong, but I think there is a bean validation JSR and Oval is the reference implementation (or at least it is JSR compatible). -Wes On Fri, Jan 15, 2010 at 11:21 AM, doahh ga...@prodia.co.uk wrote: Don't worry about this. It looks like the commons-validator will be fine and I think thats what the struts2 framework uses underneath anyway. doahh wrote: I have a Flex app that is sending data to the server and I would like to validate the Objects being passed on the server side. The Flex app passes the information over an AMF channel and so it does not go through the Struts2 framework. So far, I have found classes such as: com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator but I get lost on what happens when I should call: stringLengthFieldValidator.validate(myObject); as it doesn't return anything and needs a non-null ValidatorContext - which I don't know how to setup correctly. Can anyone provide a link or advice on how to do this please? -- View this message in context: http://old.nabble.com/How-to-do-programatic-validation--tp27179164p27179568.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 -- 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
Re: Upgrade 2.1.6 to 2.1.8.1 - Action Results in 404
You mention that you get a 404, a few questions... First, does this 404 come from the struts filter or the application server? When I am working, I can usually tell the difference because 404s coming from the struts filter generally indicate Action or Action Mapping not found. In the even that the Application Server throws up the 404, it will indicate that the Resource is not found. Also, you said that the form is trying to hit login.do, do you have .do mapped as an extension in your struts.xml? I don't think it's one of the defaults, the struts filter defaults to processing .action,, which is .action extension and no extension. -Wes On Fri, Jan 15, 2010 at 12:51 PM, CRANFORD, CHRIS chris.cranf...@setech.com wrote: I was using Struts 2.1.6 along with XWork2 2.1.2. After finding a bug with XWork2, it was recommended that this package be upgraded. As a result, XWork2's later release depends on 2.1.8.1 of Struts2 and thus I had to upgrade all my jars. Now web application no longer works. When I navigate to my http://localhost:8080/myapp/ URL it sends me to the welcome page like it always has. But when I submit the login form that was presented, it goes to http://localhost:8080/myapp/login.do and I get a 404 error saying the resource is not available. I have double checked both STRUTS.XML and WEB.XML against the blank and show case web apps from 2.1.8.1 and nothing out of the ordinary jumps out that explains why all of a sudden I have problems. Can anyone shed any light? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: How to do programatic validation?
D'oh! I should have checked first :) -Wes On Fri, Jan 15, 2010 at 1:46 PM, Greg Lindholm greg.lindh...@gmail.com wrote: Hibernate Validator 4.0 [1] is the RI for JSR 303 but Oval [2] does look very cool. [1] https://www.hibernate.org/459.html [2] http://oval.sourceforge.net/ On Fri, Jan 15, 2010 at 12:37 PM, Wes Wannemacher w...@wantii.com wrote: Before you tie yourself to commons-validator, take a look at Oval. I could be wrong, but I think there is a bean validation JSR and Oval is the reference implementation (or at least it is JSR compatible). -Wes On Fri, Jan 15, 2010 at 11:21 AM, doahh ga...@prodia.co.uk wrote: Don't worry about this. It looks like the commons-validator will be fine and I think thats what the struts2 framework uses underneath anyway. doahh wrote: I have a Flex app that is sending data to the server and I would like to validate the Objects being passed on the server side. The Flex app passes the information over an AMF channel and so it does not go through the Struts2 framework. So far, I have found classes such as: com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator but I get lost on what happens when I should call: stringLengthFieldValidator.validate(myObject); as it doesn't return anything and needs a non-null ValidatorContext - which I don't know how to setup correctly. Can anyone provide a link or advice on how to do this please? -- View this message in context: http://old.nabble.com/How-to-do-programatic-validation--tp27179164p27179568.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 -- 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Is there a way to create or get a ValueStack outside of Struts 2?
One thing I've done in the past to figure things out is to just check the unit tests. I'd imagine there are some tests for the ValueStackFactory somewhere and they might give you some clues on how to bootstrap an instance. -Wes 2010/1/15 Néstor Boscán nesto...@gmail.com: Thanks for the Reply I know that ValueStack is part of XWork. I checked the code there is an OgnlValueStack and a OgnlValueStackFactory. But when I try to use OgnlValueStackFactory I get: java.lang.IllegalArgumentException: Wrapped type converter cannot be null So I try to set the XWorkTypeConverter but I don't know how to instante it. Regards, Néstor Boscán 2010/1/15 Rafał Krupiński r.krupin...@gmail.com On 15.01.2010 21:25, Néstor Boscán wrote: Hi I wish to access or create the ValueStack from outside Struts 2 so I can apply the expression language and conversion properties of OGNL to create some reportes. Is this possible? ValueStack is part of XWork, so it's possible. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Struts 2.0 to 2.1 Migration problem
Hello, Can you post your web.xml, particularly the section that defines the Struts filters? Between 2.0 and 2.1, we broke the DispatcherFilter into multiple filters. Also, can you post the configuration of this global error result? -Wes On Wed, Dec 30, 2009 at 7:49 PM, bberken bberken...@mainstreamdata.com wrote: I've attempted to update our application from struts 2.0.6 to 2.1.6 (also using tiles 2.0.6) and am running into problems - I have a global error result defined as a jsp inside my WEB-INF dir: /WEB-INF/jsp/Error.jsp and rendering of this jsp (and any jsp inside my WEB-INF) is failing on any tags inside that jsp. I receive a nullpointerexception: java.lang.NullPointerException at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49) at org.apache.jsp.WEB_002dINF.jsp.Error_jsp._jspx_meth_s_005finclude_005f0(Error_jsp.java:143) And debugging into ComponentTagSupport shows that the line: Container container = Dispatcher.getInstance().getContainer(); is failing due to inability to obtain an instance of the Dispatcher. This all appears to work if I move the jsps out of WEB-INF and into my normal webcontext directory. Does anyone have any thoughts as to what I'm missing? This did all work w/struts 2.0.6, and I've only made small modifications to my web.xml.. following this migration howto: http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html thanks -- View this message in context: http://old.nabble.com/Struts-2.0-to-2.1-Migration-problem-tp26974067p26974067.html Sent from the Struts - User mailing list archive at Nabble.com. -- 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
Re: Struts 2.0 to 2.1 Migration problem
On Thu, Dec 31, 2009 at 10:53 AM, bberken bberken...@mainstreamdata.com wrote: [snip] error-page exception-typejava.lang.Exception/exception-type location/WEB-INF/jsp/Error.jsp/location /error-page [snip] struts.xml global-results: global-results ... result name=error type=dispatcher/WEB-INF/jsp/Error.jsp/result [snip] My guess is that the exception is being caught by the Application Server. If the dispatcher / filter isn't run against the request, the Container will be unavailable. Topics similar to this have come up in the past, but I can't remember the exact solution. There are a few ways to view the solution to your problem. For one, if you want to catch *all* errors and use the error-page in the web.xml, then don't use any struts tags in there. This is my preferred method, simply because the error could come from deep in the darkest trenches of the framework (or another framework - i.e. Hibernate / Spring filters/listeners). It's a bit of a chicken-and-egg problem. If you want absolute certainty, then take the tags out of your error page. Another approach is to create a graph of exception-mappings - http://struts.apache.org/2.x/docs/exception-configuration.html Which it looks like you have attempted to do. However, I don't think using Throwable is enough. When you have the problem, do you see a stack-trace in the application server console? There is bound to be another exception that happens beforehand that is causing the error result to be dispatched to... Basically, the NPE is a result of the error result attempt, so what is the cause of the error result? (hint, it isn't the NPE, it'll most likely be in your application server logs). Once you track that down, you can solve this particular problem, but long-term, I don't think your exception-mapping will work 100% of the time, you will find situations like this that are simply outside of the scope of Struts to handle. -Wes -- 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
Re: focusElement in s:form
You have a few choices, you could write your own theme, but that would be overkill for what you are trying to do... Although, I have found that when people are using the simple theme, there is a good chance that they are hand-rolling a theme outside of struts, which is okay, but creating a theme is pretty easy and think of the work you'll save later! Other than themes, the easiest way to get to where you want would be to simply write the Javascript yourself. Setting focus is a one-liner, and what s:head spits out isn't particularly complex... So, just take a look at the generated HTML and copy paste the pieces that you want. -Wes On Tue, Dec 29, 2009 at 9:34 AM, CRANFORD, CHRIS chris.cranf...@setech.com wrote: It appears if I removed this line and additionally made sure that the s:head/ tag was inside my HTML head.../head block that the appropriate logic works and the StrutsUtil class is available and focuses on my elements. Now is there a way to avoid this extra td class='tdLabel'/td from being decorated on my input fields? I suppose this is part of the standard theme and sometimes the labels for my fields have to be positioned in certain ways, not sure I want to use this particular theme, ugh. -Original Message- From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] Sent: Tuesday, December 29, 2009 8:15 AM To: Struts Users Mailing List Subject: RE: focusElement in s:form I do have in my struts.xml file the following defined: constant name=struts.ui.theme value=simple/ Does this affect this? -Original Message- From: Dale Newfield [mailto:d...@newfield.org] Sent: Monday, December 28, 2009 4:56 PM To: Struts Users Mailing List Subject: Re: focusElement in s:form CRANFORD, CHRIS wrote: I don't see any Javascript code in the Source file in the browser at all. That's what is not making any sense to me for the form tag. It is as if the focusElement doesn't cause the s:form tag to do anything at all. I would expect to see some script /script stuff in the source file that is rendered, correct? Yes. Are you using a specific theme for your s: tags? -Dale - 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 -- 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
Re: Getting unexpected ActionInvocation
Do you have a wildcard configuration in the XML that might be overriding your @Result? I can't remember the exact order of evaluation, but I think Conventions (assuming you're using Conventions, but we'll need version numbers and plugins to know better) is sort of the last-guy-on-the-totem-pole. You might try to take a look at the config-browser plugin so that you can see your effective configuration on the action in question. -Wes On Tue, Dec 29, 2009 at 10:10 AM, Steve Mitchell smitch...@byteworksinc.com wrote: I’m doing a redirect with annotations: @Result(name = “success”, type=”redirect”, location=”home.action”), however, the resulting ActionInvocation is a ServletDispatcherResult instead of ServletRedirectResult. This is an issue because I'm attempting to use the RedirectMessageInterceptor which expects a ServletRedirectResult. Why would @Result type redirect result in a ServletDispatcherResult ? Steve Mitchell http://www.ByteworksInc.com -- 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
Re: Dispatch does not work ( Struts2 + tile)
On Wed, Dec 23, 2009 at 12:27 PM, Emi Lu em...@encs.concordia.ca wrote: (1) jsp s:form namespace=/Edit action=ProcessTest [snip] action name=editProcessTest class=ProcessTest method=edit That form doesn't look like it is calling the action... Your action is named 'editProcessTest', but the form points to 'ProcessTest'. Are there more pieces (spring configuration, etc.) that we need to see? -Wes -- 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
Re: best practices in struts 2.1 - Tiles and Convention - clean URLs with minimum number of actions
Charles, I haven't really found any way to get around the setup you are talking about... If you want validation, you pretty much have to map to different actionable URLs. From the framework's perspective, it really can't know that you want validation or not without different request URLs. The alternative is to try to code around it, but then your UI logic becomes entangled into your application code. -Wes On Tue, Dec 22, 2009 at 11:05 AM, Charles Parker chuck.t.par...@namesforlife.com wrote: I'm using struts 2.1.8.1 here and have a question about best practices in the following situation: I have a form page, 'register'. It takes several fields, username, password, etc. I want the initial form page to be rendered via GET: http://my.server.net/register This shows the blank form (the tile definition below), without attempting to validate the fields. definition name=registrationPage extends=defaultLayout put-attribute name=content value=/WEB-INF/pages/registration.jsp/ /definition On POST to the same URL 'http://my.server.net/register', I want to perform validation on the form, (via register-validation.xml or Annotation). If the form validates then perform the action that triggers the underlying business logic. Otherwise re-display the form with validation errors (again, same URL, 'http://my.server.net/register'). I am using the Convention plugin and the Tiles plugin. The combination of these two seems to throw a wrench in the works. It seems that with the Convention plugin, I can only depend on execute() being called, or I need to define multiple actions. The approach I'm using now works reasonably well but there must be a cleaner way: @ParentPackage(testing) public class Register extends ActionSupport { �...@action(value=register,result...@result(name=input, type=tiles, location=registrationPage)}) �...@skipvalidation public String execute() throws Exception { return this.isBlank() ? INPUT : submit; } �...@action ( value=register-submit, results= { �...@result(name=input, type=tiles, location=registrationPage), �...@result(name=error, type=tiles, location=registrationPage), �...@result(name=success, type=tiles, location=registrationSuccessfulPage) } ) public String executeValidate() throws Exception { // perform business logic return SUCCESS; } private boolean isBlank() { return StringUtils.isBlank(this.username) StringUtils.isBlank(this.password) } } Someone can still link in to /register-submit, which isn't awful, since validation is performed. But I'd like to minimize the number of actionable URLs on my site and avoid writing an isBlank() method for each form. It would seem more straightforward if I could depend on an INPUT result on the first load of the page (with @SkipValidation), and then execute() thereafter, with only a single action defined at the class level instead of multiple actions at the method level. Is this possible, and if so, what is the most appropriate way to do this via struts 2.1? I am addicted to the Convention plugin annotation, and I cannot do without Tiles. For reference, I'm using the following in struts.xml: constant name=struts.convention.action.alwaysMapExecute value=false/ package name=testing extends=struts-default !-- Set the tiles result type as the default for this package. -- result-types result-type name=tiles class=org.apache.struts2.views.tiles.TilesResult default=true/ /result-types /package Many thanks for any alternatives or refinements of this approach. / chuck - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Forwarding to a Java Application
Will the Java App(let) be up and running, or will you need to launch it with the information passed to it? -Wes On Thu, Dec 24, 2009 at 10:52 AM, Rafael Muneton rafael_mune...@hotmail.com wrote: In a Web Application I need to redirect the flow of the information to a Java class nor to a Servlet or a JSP. However in the web i have found a lot of material but none mentions what i am looking for. How is this achieved? Any idea is welcome. Rafael _ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 -- 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
Re: Forwarding to a Java Application
On Thu, Dec 24, 2009 at 12:52 PM, Rafael Muneton rafael_mune...@hotmail.com wrote: Hi Vitor: What I am trying to achieve is that , after a user can log in to the Web Application, this user receives the MainMenu screen of the Application, where there are several options, that he/she can choose from.This MainMenu is a Java application not a Servlet. And after reading your answer, I think that maybe I need to upgrade to Struts 2. I am using Struts 1.1 I don't think an upgrade is necessary. I think you just need to understand a little better how things work in a JSP/Servlet environment... The page that launches the MainMenu application is bound to have either an applet... or object... tag. It has been a while for me, I can't remember which. But, if there is information that needs passed to the MainMenu, then you need to make that information into params. Then, when the page that launches the MainMenu is rendered, pass the information to the MainMenu by rendering the appropriate param... tags. -Wes -- 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
Re: how to access struts2 propery from jsp or vice versa
There is an http header result type and two redirect result types that are much better suited for this. You can use properties in the struts.xml file as params for the result. I am on my phone, but perhaps someone else can post an example. -W On 12/24/09, Parm Lehal ple...@lehal.net wrote: Hello, I am stuck in trying to access some variables from value stack in jsp page. Is there anyway to do it easily? Is there anyway to communicate with a bean defined in jsp with jsp:useBean tag from struts2? I can access values in struts but not from jsp side. ..Basically I am trying to do something similar to % response.sendRedirect(..url based ons:property value=%{GRTGRTGT}/ .); Please, tell me if and how can I accomplish something like this. Regards, Parminder Lehal -Original Message- From: Wes Wannemacher w...@wantii.com Reply-to: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: if tag with #parameters Date: Wed, 23 Dec 2009 09:35:59 -0500 I have used a similar construct quite a bit, but normally, I refer to parameters like this - s:if test=%{#parameters['view'] != null} view /s:if s:else not view /s:else In cases like this, I just want to affect the way a view is rendered. So, leaving the getter/setter off of the action is the way to go. -Wes On Tue, Dec 22, 2009 at 6:05 AM, foo bar linut...@gmail.com wrote: Hi, I would prefer not to use getter/setter. What I really want to know is, why is this not working as expected ? Anyway, I solved it s:if test=#parameters.messageKey[0] == 'yes' #parameters.messageKey is of type String[], which make sense now On Tue, Dec 22, 2009 at 9:46 PM, Saeed Iqbal saee...@gmail.com wrote: If it is a request parameter, then make a setter for it to get set and getter to retrieve it and use % instead of # If you want to have the parameter in the page context use the s:set with id On Tue, Dec 22, 2009 at 3:36 PM, foo bar linut...@gmail.com wrote: Hi all, I'm testing for the existence of a request parameter in a jsp page in Struts 2 %@ taglib prefix=s uri=/struts-tags% !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; s:property value=#parameters.messageKey/br/ s:if test=%{#parameters.messageKey == 'yes'} yes /s:if s:else no /s:else But, whatever I do, result is always no Tested with these cases: test.jsp test.jsp?messageKey= test.jsp?messageKey=yes test.jsp?messageKey=no Changed it to s:if test=#parameters.messageKey == 'yes', same results Changed it to s:if test={#parameters.messageKey == 'yes'}, results are negated as above, ie you got no when previously you got yes What's the solution here ? Cheers - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Saeed Iqbal Independant Consultant J2EE - Application Architect / Developer - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: if tag with #parameters
I have used a similar construct quite a bit, but normally, I refer to parameters like this - s:if test=%{#parameters['view'] != null} view /s:if s:else not view /s:else In cases like this, I just want to affect the way a view is rendered. So, leaving the getter/setter off of the action is the way to go. -Wes On Tue, Dec 22, 2009 at 6:05 AM, foo bar linut...@gmail.com wrote: Hi, I would prefer not to use getter/setter. What I really want to know is, why is this not working as expected ? Anyway, I solved it s:if test=#parameters.messageKey[0] == 'yes' #parameters.messageKey is of type String[], which make sense now On Tue, Dec 22, 2009 at 9:46 PM, Saeed Iqbal saee...@gmail.com wrote: If it is a request parameter, then make a setter for it to get set and getter to retrieve it and use % instead of # If you want to have the parameter in the page context use the s:set with id On Tue, Dec 22, 2009 at 3:36 PM, foo bar linut...@gmail.com wrote: Hi all, I'm testing for the existence of a request parameter in a jsp page in Struts 2 %@ taglib prefix=s uri=/struts-tags% !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; s:property value=#parameters.messageKey/br/ s:if test=%{#parameters.messageKey == 'yes'} yes /s:if s:else no /s:else But, whatever I do, result is always no Tested with these cases: test.jsp test.jsp?messageKey= test.jsp?messageKey=yes test.jsp?messageKey=no Changed it to s:if test=#parameters.messageKey == 'yes', same results Changed it to s:if test={#parameters.messageKey == 'yes'}, results are negated as above, ie you got no when previously you got yes What's the solution here ? Cheers - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Saeed Iqbal Independant Consultant J2EE - Application Architect / Developer - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: UI Component - ${parameters.paramName} not working
On Wed, Dec 23, 2009 at 4:56 AM, Vitor E. Silva Souza vitorso...@gmail.com wrote: Hello all, I'm creating a UI Component with Struts 2.1.8.1. The FreeMarker variable parameters seems to be made available as String and not as Hash as I expected (and according to [1]). [1] = http://www.vitarara.org/cms/struts_2_cookbook/creating_a_ui_component In the web page, I have something like this: s:component template=book-list.ftl s:param name=deletecolumn value=true / /s:component I can't guarantee that it will work, but try changing the s:param to this - s:param name=deletecolumn value=%{true} / Notice the lack of quotes around 'true' and the forcing of OGNL with %{... If that doesn't work, you may be stuck with a string. -Wes And in the file template/xhtml/book-list.ftl (in the source folder) I have a component that shows a table with the list of books in the database: #if books?size == 0 p@s.text name=noBooks //p #else table align=center size=90% tr th@s.text name=name //th th@s.text name=authors //th #if parameters?contains(deletecolumn=true) thnbsp;/th /#if /tr #list books as book tr td${book.name}/td td${book.authors}/td #if parameters?contains(deletecolumn=true) td[... delete button ...]/td /#if /tr /#list /table /#if I expected to have to use it like this, as a hash (or something like it): #if parameters.deletecolumn == true And instead, the only way it works is as above, as a string: #if parameters?contains(deletecolumn=true) If I use it as hash, it gives me ArrayIndexOutOfBoundsException: -1. Any thoughts? Thanks in advance, Vitor Souza - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Essential Dependencies Only
Scott, take a look at the mailreader and blank apps. You can also read through the struts2-core pom (annotated and easier to read here - http://jarvana.com/jarvana/inspect-pom/org/apache/struts/struts2-core/2.1.8/struts2-core-2.1.8.pom, that points to 2.1.8, they haven't indexed 2.1.8.1 yet, but there is no differences in dependencies). If you just want to cut to the chase, the essentials would be - struts2-core 2.1.8.1 xwork-core 2.1.6 freemarker 2.3.15 ognl 2.7.3 -Wes On Mon, Dec 14, 2009 at 10:36 AM, stanlick stanl...@gmail.com wrote: Greetings and Happy Holidays -- I am sitting down to unwind the Essential Dependencies Only jar (struts-2.1.8.1-lib.zip) in preparation for the litany of questions the lawyers are going to ask before accepting the Struts 2.1.8.1 upgrade in house. Now either I have a different understanding of the word essential, or this version of our new Struts has really spread her arms. There are seventy-one jars in the lib folder of the *essential dependencies only jar* and a quick glance suggests they are *not* all essential. So does essential != core or required? Is there a resource where an analysis can be made to determine compile, testing, run-time dependencies? Untangling this ball of yarn by hand is going to burn up hours and lead an analyst down many rabbit holes. Is there a POM that could save the man hours? Peace, Scott -- View this message in context: http://old.nabble.com/Essential-Dependencies-Only-tp26779724p26779724.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 -- 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
Re: specified DSN contains an architecture mismatch
Why use odbc? Mysql has a top notch jdbc driver. On 12/11/09, Todd Grigsby strutsu...@tgrigsby.com wrote: Yes, thank you, I know that. My question has to do with the architecture mismatch. All the documentation I've seen on this indicates that there is a 32-bit/64-bit issue, but I'll be darned if I know which piece is at fault. Given the versions of the various parts, does anyone have any idea what I need to do to be able to talk to MySQL? TG Martin Gainty wrote: you're using InitialContext to lookup a DataSource registered to JNDI registry Martin Gainty Context context = new InitialContext(); DataSource ds = (DataSource)context.lookup(java:/comp/env/jdbc/odbc/tgecorp); Connection conn = datasource.getConnection(); ... The last line throws an exception with the following message: The specified DSN contains an architecture mismatch between the Driver and Application. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Time to process request
Your question is a bit vague, which might be why you are having trouble finding a solution... If I understand the problem properly, perhaps using the Execute and Wait facility will help - http://struts.apache.org/2.1.8.1/docs/execute-and-wait-interceptor.html As far as controlling the amount of time before giving up on the backend services (if that's your goal), you would have to build that mechanism yourself. -Wes 2009/12/9 André Lopes afsalo...@gmail.com: Hi all, I'm working on an application that makes requests to several backend services, and i need to establish a max time in wich the struts application must send the http response. Is it possible to define such timeout? I've been searching for a way to do this, but i haven't found anything. Cheers, -- André Lopes -- 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
Re: Convention plug-in, tiles, and no @Result annotation
I haven't tried it, but from the docs it looks like you can set the 'struts.convention.relative.result.types' variable. It defaults to 'dispatcher,velocity,freemarker' so add 'tiles' to it and see if that works. -Wes On Wed, Dec 9, 2009 at 8:34 AM, Fran Hesser fhes...@gmail.com wrote: Is there a way to use the convention plugin, and not specify the @Result annotation for the action classes with the result being tiles or will it only find .jsps and Freemarker templates? When I run this code I get the dreaded: com.opensymphony.xwork2.config.configurationexcept...@1199919 == No result defined for action com.action.vehicle.ServiceMaintenanceAction and result success Here’s what I have: Struts.xml: package name=default extends=tiles-default !-- Default to tiles result type -- result-types result-type name=tilesclass=org.apache.struts2.views.tiles.TilesResult default=true / /result-types /package package name=service extends=default/ Tiles-def.xml: definition name=service-maintenance-success extends=service.base put-attribute name=pageName value=Service Maintenance/ put-attribute name=templateName value=exampleTemplate.css/ put-attribute name=body value=/WEB-INF/jsp/tiles/vehicle/serviceMaintenance.jsp/ /definition ServiceMaintenanceAction Class: @Action(value=/vehicle/service-maintenance) public String execute() { return SUCCESS; } package-info.java: @ParentPackage(vehicle) Thanks, Franklin package name=service extends=default/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: ActionContext.getContext() is returning null
Have you thought about re-creating the logic in FatalErrorServlet in a Struts 2 Action? That would be the optimal solution. I don't think you are going to get an *Action*Context unless you are in an *Action*. If it has worked in the past, it's probably an unintended side effect. If you can't refactor to an action, then just refactor your servlet to not use Struts objects. -Wes On Wed, Dec 9, 2009 at 10:28 AM, strutsdev43 nagmi...@gmail.com wrote: Hi Can someone please help with the issue that I am seeing with Struts 2.1.8.1. I have a page index.jsp which is protected by role role1. when the user tries to access index.jsp, if the user is not authorized, the user is forwarded to a FatalErrorServlet. I have configured in web.xml to forward it to a FatalErrorServlet, which takes care of displaying a login freemarker template. FatalErrorServlet is trying to access the ActionContext using ActionContext.getContext(), but it is returning null. I have StrutsPrepareFilter, Sitemesh PageFilter, StrutsExecuteFilter configured in my web.xml, but looks like when the request gets forwarded to the FatalErrorServlet, it doesn't go through these filters. I tried setting the dispatcher element for these filters to REQUEST, FORWARD, IINCLUDE but nothing works. I am using Struts 2.1.8.1, app server is weblogic 10.0mp1. my web.xml contents ?xml version=1.0 encoding=ISO-8859-1? web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; filter filter-namestruts-prepare/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class /filter filter filter-namesitemesh/filter-name filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class /filter filter filter-namestruts-execute/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class /filter filter-mapping filter-namestruts-prepare/filter-name url-pattern/*/url-pattern dispatcherREQUEST/dispatcher dispatcherFORWARD/dispatcher dispatcherINCLUDE/dispatcher /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern dispatcherREQUEST/dispatcher dispatcherFORWARD/dispatcher dispatcherINCLUDE/dispatcher /filter-mapping filter-mapping filter-namestruts-execute/filter-name url-pattern/*/url-pattern dispatcherREQUEST/dispatcher dispatcherFORWARD/dispatcher dispatcherINCLUDE/dispatcher /filter-mapping servlet servlet-nameFatalErrorServlet/servlet-name servlet-classcom.sample.FatalErrorServlet/servlet-class /servlet servlet-mapping servlet-nameFatalErrorServlet/servlet-name url-pattern*.fatal/url-pattern /servlet-mapping !-- The Welcome File List -- welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list !-- Error Pages -- error-page error-code500/error-code location/500.fatal/location /error-page error-page error-code400/error-code location/400.fatal/location /error-page error-page error-code401/error-code location/401.fatal/location /error-page error-page error-code403/error-code location/403.fatal/location /error-page error-page error-code404/error-code location/404.fatal/location /error-page !--HOME PAGE-- security-constraint web-resource-collection web-resource-nameCommonPages/web-resource-name url-pattern/index.jsp/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint descriptionThese are the roles who have access/description role-namerole1/role-name /auth-constraint user-data-constraint descriptionThis is how the user data must be transmitted/description transport-guaranteeNONE/transport-guarantee /user-data-constraint /security-constraint !--HOME PAGE-- security-role role-namerole1/role-name /security-role /web-app -- View this message in context: http://old.nabble.com/ActionContext.getContext%28%29-is-returning-null-tp26712068p26712068.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 -- 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
Re: struts2 web app without jsp pages, is it possible?
On Tue, Dec 8, 2009 at 9:21 AM, Shital Patil shitalpati...@yahoo.com wrote: Dear All, Thanks for your valuable suggestions. Actually I am failed to convince my PM for using JSP pages in web app. He said, there are some serious problems with JSP. e.g JSP = presentation + code. A JSP developer can easily read some imp file on disk say, /etc/passwd, and throw it to the client. How to avoid this problem? Fire the PM? Honestly, that is an ignorant stance against JSP. I could make the same argument against just about any programming construct. If you are worried that developers might actually have access to libraries and resources, then take away their computers and tell them to write their software on paper and submit them to someone more trustworthy... -Wes -- 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
Re: [s2] design problem
On Mon, Dec 7, 2009 at 3:03 AM, Tudor Andrei Raneti w0lfsh...@yahoo.com wrote: i load up dataParams.jsp from main.jsp: [code] c:when test=${param.dataParams == 'show' and param.data == null} s:action name=dataParams_input executeResult=true/s:action/c:when [/code] i map it in struts.xml: [code] action name=dataParams_* method={1} class=loto.action.DataParams result type=redirectAction/jsp/main.jsp/result result name=input/jsp/dataParams.jsp/result /action [/code] and set up a DataParams-validator.xml. The problem starts when i submit dataParams.jsp 's form: [code] form action=dataParams method=get [/code] because it's supposed to validate while beeing loaded by main.jsp, but it displays alone not included in main.jsp when it displays errors. This is by design (sort of), your input result dispatches to /jsp/dataParams.jsp directly. It works on the first request because you are using executeResult=true in your s:action tag... But, if you want input to go to main.jsp, then dispatch there on input... The trouble you will then have is that it will create an infinite loop... My suggestion is that you redesign your pages and flow so that it does not depend on the s:action tag. The key to this problem is what should i write in form action= to make this work the way i aim? As I mention above, you are going to run into trouble no matter how you try to work this out... Try to avoid the s:action tag. Further thoughts: If i dataParams action doesn't get called when dataParams submits, the struts 2 xml validation doesn't fire. dataParams.jsp is supposed to be always included in main.jsp though, showing errors or not, but if i call main action, the struts 2 xml validation is always bypassed by the input action. dataParams bypasses validation the first time because it doesn't need to validate when first shown (like in HelloWorld), should i validate from start and live with it? Maybe action chaining would do it? I don't know... I hate to say it, but you might want to spend some more times looking through examples or get a copy of Struts 2 In Practice from Manning Publications or Apache Struts 2 Web Application Development by Dave Newton. -Wes -- 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
Re: EJb 3.1 (dependency injection) and Struts2 actio ns ¿CDI/Weld needed?
On Mon, Dec 7, 2009 at 4:02 PM, Ignacio de Córdoba icord...@skios.es wrote: Hi there, I'd like to know if there is a recommended approach to deal with dependency injection on new EJB 3.1 EJBs. I am using now a modified version of JBoss Struts2 plugin with works great but it really does nothing more than regular JNDI lookups on every action request call. Unfortunately, this is the best mechanism that we have, currently. The thing about the JEE5 spec is that it specified annotations for dependency injection, but did not standardize the mechanism for retrieving the would-be-injected objects (other than JNDI). Struts uses various different mechanisms for instantiating classes, it has it's own internal DI, some reflections, and even delegates to other mechanisms like Spring or Guice. But, the problem is that struts creates its own objects and it is the Application Server that does the EJB injection. I wonder if there is a new approach to getting EJB 3.1 session beans (stateless to be precise) which is what mostly I have to deal with. I've seen in the DEV forum that a plugin for CDI/Weld is coming (hopefully soon). This will most likely be the preferred mechanism in the future. But, in the same thread you probably saw that this feature is a part of JEE6. Should we have to wait for this plugin or there is a simple approach to just inject new EJBs in struts2 actions? (@EJB... ? :-) ) At this point, the only simple approach is JNDI lookups. The plugins that do this currently are as good as you are going to get for now. Since it is looking like we are going to move our internal DI toward the specification, you will probably have better support for JEE/EJB DI in the future. Of course, I have already tested new GlassFish v3, even though I'll probably be using new JBoss 6 (I have already tested it with my previous EJB3 Struts2 projects and works ok, so I'd like to start my new projects directly with EJB 3.1) -- 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
Re: S2 Type conversion error and validation problem
On Wed, Dec 2, 2009 at 9:22 AM, Marsman mars@gmx.de wrote: Hi! after a type conversion error, Struts goes on in the interceptor stack and validates the empty action property with useless results. How can I avoid this? (I'm using the default interceptor stack.) And how can I avoid the NoSuchMethodException thrown every time a user enters invalid alphanumeric values in my numeric or date fields? Does anybody know a best practice validating numeric fields against numeric data? I would start here - http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-TypeConversionErrorHandling -Wes -- 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
Re: FilterDispatcher configuration in web.xml
I think you can safely map to *.action and /struts/* -Wes On Fri, Nov 27, 2009 at 12:41 AM, Kishore Kumar kishorec...@aol.com wrote: Hi, Is there a way to change the FilterDispatcher URL Pattren other than /*? I am using ICEFaces and struts2 togeather but due to struts2 URL Pattren ICEFaces requests are being ignored. Can i use url-pattren /*.action ? As per the struts documentation it says to use following filter filter-namestruts2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping Thanks, Kishore -- 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
Re: excute method
On Fri, Nov 27, 2009 at 4:04 AM, Nguyen Xuan Son yama...@gmail.com wrote: Dear Thompson Here is the web.xml's content welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list filter filter-namestruts2/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping I've try to use void prepare() throws Exception { System.out.println(you're now in C0002_Home page); } but it still doesnt work out please tell me what should i correct thank you very much Are you seeing any errors in your logs? What you have posted so far is technically correct... Can you also post for us the list of jars that you have in /WEB-INF/lib ? Another thing I would try is to take the 'throws Exception' off of your execute method declaration. I can't remember off the top of my head, but I don't normally declare that and it makes me wonder if it's taking your method out of the inheritance hierarchy... Also, can you post your class declaration, are you extending ActionSupport or implementing Action? -Wes -- 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
Re: Is Using Spring With Struts 2 A Good Idea?
-Original Message- From: phillips1021 [mailto:bphill...@ku.edu] Sent: Wednesday, November 25, 2009 11:29 AM To: user@struts.apache.org Subject: Is Using Spring With Struts 2 A Good Idea? At the University of Kansas (#1 college basketball team :) we use Struts 2 for our web application framework. Its worked very well for us. I've been learning the Spring framework and how to use it with Struts 2. I think the two frameworks work very well together. I'm preparing a class for the other Java developers on how to use Struts 2 and Spring together. As part of my research I'd like to hear from other Struts 2 developers on if you use Spring with Struts 2 and if you think its a good or bad practice. Thanks in advance for any feedback you can provide on why or why not it's a good idea to use Struts 2 with Spring. Bruce Phillips http://www.brucephillips.name/blog http://www.brucephillips.name/blog Bruce, I am currently working on a commercial product that combines the two. I could sing songs of praise, but I figure you've already gotten a few of those messages, so I will try to come up with a few drawbacks I've noticed. One thing I noticed early on is that it seriously compounds the amount of XML configuration you will have to manage. I am a fan of the Conventions plugin, but still feel obligated to stick to traditional (explicit) configuration for projects of serious size. I just deployed an app recently at a customer that contains 1678 lines of XML configuration just for struts and spring (this does not include sitemesh, web.xml, maven poms, etc.). Another thing I noticed is that this (these) project(s) now require a significant learning curve. I think most of the people on this list wouldn't be scared to jump into a project using struts 2, spring, jpa, maven, etc. But... In my neck of the woods (just north of Kentucky, but not a whole lot more civilized), it is difficult to find trained Java professionals who are fluent in the technologies named above. What is interesting is that when you look at the code, on a per source file basis, it is all very simple (POJO-based development with simple services/implementations). However, conceptually fitting all the pieces together always tends to fall on my shoulders since my team tends to be less experienced in the different libraries. With that being said, I will add that it really is a pleasure to use all of these things together. After a certain point in every project, development time speeds up drastically. Changes are easy and a nice library of components is created that allows for easy additions. All of these things tend to come together once you get past the first two points above. -Wes -- 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
Re: Struts2 online sources/ ebooks
On Wed, Nov 18, 2009 at 8:06 AM, Martin Gainty mgai...@hotmail.com wrote: Ted Husted Struts In Action is the most intelligent of the offerings with wonderfully comprehensive examples and a thorough explanation of Model View Controller http://www.manning.com/husted/ the best investment you will ever make Martin Gainty Struts in Action is for the Struts 1 series... I think the OP would be better learning Struts 2 from the book Struts 2 In Action available here - http://www.manning.com/dbrown/ More recently, Dave Newton's book has been getting good reviews as well - http://www.packtpub.com/apache-struts-2-web-application-development-beginners-guide/book -Wes -- 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
Re: [ANN] Struts 2.1.8.1 Release
On Tuesday 17 November 2009 10:10:01 am Mark Bargen wrote: Wes Wannemacher wrote: ... The release is also available from the central Maven repository under Group ID org.apache.struts. ... Neither artifact jar (primary or -sources assembly) for struts2-core:2.1.8.1 is present in the repo. The artifacts are present for the two plugins. Eagerly awaiting ... Mark I could be confused or just too tired, but when I go here - http://repo1.maven.org/maven2/org/apache/struts/struts2-core/2.1.8.1/ I see the artifacts... -- 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
[ANN] Struts 2.1.8.1 Release
The Apache Struts Team is pleased to announce that Struts 2.1.8.1 is available as a General Availability release. The GA designation is our highest quality grade. [http://struts.apache.org/download.cgi#struts2181] The release is also available from the central Maven repository under Group ID org.apache.struts. The 2.1.x series of the Apache Struts framework has a minimum requirement of the following specification versions: * Java Servlet 2.4 and JavaServer Pages (JSP) 2.0 * Java 2 Standard Platform Edition (J2SE) 1.5 The release notes are available online at: * [http://struts.apache.org/2.x/docs/version-notes-2181.html] Should any issues arise with your use of any version of the Struts framework, please post your comments to the user list, and, if appropriate, file a ticket with JIRA. - The Apache Struts Team. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: read the source code
As far as I know, there are no books that specifically analyze the source code for Struts 2. I would suggest starting by reading the source code to Xwork. To really get a handle on what is going on, first try to get a solid understanding of the command pattern design pattern. Then, take a look at the xwork source to see how it is implemented there. Once you feel comfortable at that level, take a good look at the Servlet and JSP specifications. Then you can take a look at the source for Struts 2. It also wouldn't hurt to take a look at Google Guice. Although we aren't using Guice, we branched it early on and have been using it for internal dependency injection (both in Xwork and in Struts 2). As you get further along, feel free to post questions on the d...@struts.apache.org list. -Wes On Wed, Oct 28, 2009 at 3:09 AM, mark lu liujuns...@ygsoft.com wrote: I want to read struts2's source code,but i found it's too complicated. so,i want to find a book that analysis the soure code. who can give me some suggestions?recommend some books to me? thanks very much!! -- View this message in context: http://www.nabble.com/read-the-source-code-tp26090230p26090230.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 -- 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
Re: AJAX Validation example
On Saturday 24 October 2009 12:33:49 am shenxiaojing wrote: Hello, all Is anybody using the example from http://struts.apache.org/2.1.8/docs/ajax-validation.html ? It doesn't work at all. Or anybody can send a successful example to me? Thank you -Karen I've used that off and on quite a bit... Which version of struts are you using? -Wes -- 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
Re: Struts 2.1.8: Do we need to escape messages?
I don't remember when it was added, but there is an attribute for s:property called 'escape' that defaults to 'true' http://struts.apache.org/2.x/docs/property.html If you set it to false, then you will probably get what you want. -Wes On Fri, Oct 16, 2009 at 6:05 AM, Alex Siman aleksandr.si...@gmail.com wrote: I just have found that Struts 2.1.8 escapes messages, so instead of message (in browser) like: User with email u...@example.com registered successfully. now I get this one: User with email lt;stronggt;u...@example.comlt;/stronggt; registered successfully. In first example I used to escape only the inserted parameter email. I am not against automatic escaping of messages. It's good for security. But I am wonder, how to use expected HTML markup into messages? Maybe you have any another design solution? P.S. The downside of upgrades. -- View this message in context: http://www.nabble.com/Struts-2.1.8%3A-Do-we-need-to-escape-messages--tp25922882p25922882.html Sent from the Struts - User mailing list archive at Nabble.com. -- 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
Re: Why Struts 2 if we configure Struts 2 and spring
It's mostly a matter of preference. I prefer Struts 2 over Spring Web Flow. There are many people who would choose Spring Web Flow thinking that it will provide better integration with Spring, but Struts 2's Spring support is top-notch, so it's easy to use Spring DI along with Struts 2's feature set. -Wes On Fri, Oct 9, 2009 at 8:00 AM, nani2ratna nani2ra...@gmail.com wrote: Hi, I got one doubt. Why do we need struts 2 as UI, if we want to have spring as business layer. Becuase spring also have gud web framework. Can anybody explain. Thanks and Regards Ratna -- View this message in context: http://www.nabble.com/Why-Struts-2-if-we-configure-Struts-2-and-spring-tp25819856p25819856.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 -- 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
Re: Struts2 2.1.8 MD5 not found
On Monday 05 October 2009 07:37:25 am mailtolouis2020-str...@yahoo.com wrote: Hi Wes, I just notice that I can select mirror from the download page, I tried many different mirrors site, but still the MD5 and PGP link still not work. Could you give me the mirror you use which is working for your? Thanks Louis This thread is a few days old, but I just checked today and it looks like the files are propagated... Is anyone else noticing missing files? -Wes -- 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
Re: Servlet filter as front controller
I was thinking about this issue recently and wondered if simply mapping a do-nothing servlet to * would workaround this... I thought about trying it, but I only have tomcat and jetty handy for testing, and this doesn't seem to be an issue on either one. Although, a do-nothing servlet would probably solve the other problem of mapping welcome-files to index.action. -Wes On Thu, Oct 8, 2009 at 8:36 AM, Struts Two struts...@yahoo.ca wrote: I have mentioned this before in another thread that Struts2 is breaking Servlet specification 2.4 in this regard, but have heard no comment on it which means two things either I have a point or I am way off. In Servlet specification 2.4 filters are not supposed to be accessed directly as a resource. And anything other than a jsp page need to have a Servlet mapping in order to make it accessible (as per specification). Struts 1 had ActionServlet to which *.action or *.do mapping was done. This sort of deviation from sped is causing some folks issues when it comes to using some appservers that follow the spec and you have to resort to all sort of hacks to get around it. --- On Wed, 10/7/09, Arthur Neves arthu...@gmail.com wrote: From: Arthur Neves arthu...@gmail.com Subject: Re: Servlet filter as front controller To: Struts Users Mailing List user@struts.apache.org Received: Wednesday, October 7, 2009, 11:57 PM With the filter struts2 can intercept all request. I think it's more difficult to do thinks like, the namespace struct with a servlet,i dont have sure though. On Wed, Oct 7, 2009 at 2:58 PM, Unmesh joshi unmesh_jo...@hotmail.comwrote: Hi,Struts2 uses servlet filter org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter as front controller, rather than having a servlet act as front controller. Is there any specific advantage of using servlet filter over servlet (as in struts 1.1)? Thanks,Unmesh _ Great events make grand headlines – read them all on MSN India http://in.msn.com __ Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: Custom Property Tag
I did something similar, but I used s:if as an example. Rather than show or not show in a s:property tag-like setup, i felt like s:if did the job much better. If you want an example, check out core/src/main/java/org/apache/struts2/views/jsp/IfTag.java core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java core/src/main/java/org/apache/struts2/components/If.java Then, check out the pom.xml file for a clue how to use the annotations you'll see in there to generate a TLD file for the tag. Also, the views/freemarker thing isn't necessary, but if you plan to use Freemarker, you'll have to create a freemarker template manager (which is pretty simple, check the source of the bean that the struts-default.xml defines for an example). -Wes On Tue, Oct 6, 2009 at 10:36 AM, Mike Baranski list-subscripti...@secmgmt.com wrote: I need to show certain fields to certain users based on permissions (per-user). I was going to create a custom s:property tag, which would access an IUser object on the value stack. In the tag, it will do: If (getUser().canAccess('property_name')) Then Render the tag/value Else Render nothing I cannot figure out how exactly to get the user object on the value stack, and which file contains the property tag implementation. Could someone suggest where to start? Thanks, Mike. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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
Re: ognl problem with double value in form
Which version of struts are you using? We updated the OGNL dependency between 2.1.6 2.1.8, so if this is a bug with the new version we'll have to address it. If it's a problem with an old version, try updating to 2.1.8 jars. -Wes On Fri, Oct 2, 2009 at 7:43 PM, Bill Bohnenberger bill98...@gmail.com wrote: I have a double in an action: private double dval; with mutators public double getDval() { return dval; } public void setDval (double dval) { this.dval = dval; } I have this form in my jsp page: s:form action=TestAction_doCommand s:textfield label=Double Value name=dval size=10/ s:submit/ /s:form Whenever I enter 0 or 0.0 in the text field, OGNL throws ognl.MethodFailedException: Method setDval failed for object com.rp.db.actions.testact...@16cefa8 [java.lang.NoSuchMethodException: setDval([Ljava.lang.String;)] BUT, it properly converts all non-zero values without complaint and even converts the empty string to 0.0! Is there some way I can get OGNL to accept the 0 and 0.0 values? Thanks, Bill B -- 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
Re: [Struts2] Problem using Struts2 with EJB3 over ServiceLocator (Jboss say Caller unauthorized)
ADLoginIdentifier, should only happen in JUnit test!); return ctx.getCallerPrincipal().getName(); } else { return pc.iterator().next().getUserId(); } } catch (PolicyContextException e) { throw new MyApplicationException(Jaas subject could not be retrieved., e); } } �...@override public boolean userHasRole(ApplicationRole role, ApplicationUser user) { user = userDao.fetchFullUser(user); SetApplicationRole roles = user.getRole(); if (roles.contains(role)) { return true; } else { return false; } } �...@override public ApplicationRole getRolesById(String roleid) { ApplicationRole role = roleDao.findById(roleid); return role; } } ... 16:01:50,566 INFO [SpiiderLoginModule] Logged into LDAP server, javax.naming.ld ap.initialldapcont...@6857da 16:01:50,581 INFO [SpiiderLoginModule] getRoleSets using rolesQuery: SELECT u.u serid, r.role FROM security.application_user u, security.application_role r, security.user_role ur WHERE u.userid = ? AND u.userid = ur.user_id AND ur.r ole_id = r.role, gid: 79A44E672EA8C49B 16:01:50,769 ERROR [[default]] Servlet.service() for servlet default threw excep tion javax.ejb.EJBAccessException: Caller unauthorized ... /** * */ package vwg.audi.cancard.ui.interceptor; import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; import org.apache.struts2.ServletActionContext; import vwg.yyy.cancard.business.LoginFacade; import vwg.yyy.cancard.ui.JAASConstants; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.Interceptor; /** * JAASLoginFilter * * @author Michael Obster */ public class JAASLoginInterceptor implements Interceptor { private static final long serialVersionUID = -1983088770872827621L; private Logger log = Logger.getLogger(this.getClass()); String loginDomain = ; String clientLoginDomain = ; LoginFacade loginFacade; �...@override public void init() { } �...@override public String intercept(ActionInvocation actionInvocation) throws Exception { loginDomain = ServletActionContext.getServletContext().getInitParameter(jaasLoginDomain); clientLoginDomain = ServletActionContext.getServletContext().getInitParameter(jaasClientLoginDomain); if (log.isDebugEnabled()) { log.debug(init JAASInterceptor: loginDomain: + loginDomain + clientLoginDomain: + clientLoginDomain); } HttpServletRequest request = ServletActionContext.getRequest(); String servletPath = request.getServletPath(); String pathInfo = request.getPathInfo(); String path = (servletPath == null ? : servletPath) + (pathInfo == null ? : pathInfo); if (log.isDebugEnabled()) { log.debug(Login INTERCEPT); } loginFacade = new LoginFacade(loginDomain, clientLoginDomain); if (!JAASConstants.USER_IS_VALID.equals(request .getSession().getAttribute( JAASConstants.USER_VALIDITY))) { log.info(requested path: + path); return Action.LOGIN; } //Perform client-login String username = (String)request.getSession().getAttribute(JAASConstants.USERNAME); String strPassword = (String)request.getSession().getAttribute(JAASConstants.PASSWORD); // Classic login by username and password loginFacade.clientLogin(username, strPassword); if (log.isDebugEnabled()) { log.debug(*CLIENTLOGIN COMPLETE); } return actionInvocation.invoke(); } �...@override public void destroy() { loginFacade.logout(); } } - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- 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