Re: Running Struts1 and Struts2 together?
On Mon, 23 Aug 2010 14:22:54 -0400, Greg Lindholm greg.lindh...@gmail.com wrote: Is there any issues with running Struts1 and Struts2 together in the same application? I have a couple old Struts1 applications which I plan on converting to Struts2 over time, but would like to start doing new development in Struts2 immediately while converting the Struts1 screens and action over bit-by-bit as needed. How is this going Greg? I'm interested because I have a project that could use this solution, but I've no idea how big a job it is, what the pitfalls are etc. Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Interceptor - Dynamically Add Result Config to Action Config
I have a Struts 2.0 interceptor that dynamically creates a result config and adds it to the action config. It does it like this: String newResult = shRes; ResultConfig cfg = new ResultConfig(newResult, ServletRedirectResult.class.getName()); cfg.addParam(location, SearchHelp.action?+request.getQueryString()); actionInvocation.getProxy().getConfig().addResultConfig(cfg); return newResult; Now I'm upgrading to Struts 2.2 and I'm finding that this no longer compiles due to Struts/Xwork refactoring. I've been able to create a ResultConfig object using ResultConfig.Builder but I can't find how to add this to the interceptor's action config / context. Can anyone give me a pointer? Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Interceptor - Dynamically Add Result Config to Action Config
On Tue, 24 Aug 2010 10:59:29 -0400, Martin Gainty mgai...@hotmail.com wrote: //reiterate 2.1.8 functionality: com.opensymphony.xwork2.ActionInvocation action_invocation; ActionProxy proxy=action_invocation.getProxy() ActionConfig config =proxy.getConfig(); //where ActionConfig contains the addResultConfig method public Builder addResultConfig(ResultConfig resultConfig) { target.results.put(resultConfig.getName(), resultConfig); return this; } There's my problem - ActionConfig no longer exposes addResultConfig. This method is now in the Builder inner class and only operates on a new ActionConfig object (as far as I can see), whereas I want to add a result to an existing ActionConfig. Steve //Struts 2.2 is in Alpha Stage if the functionality is absent can you file a JIRA? Struts 2.2. is now a GA release. Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Interceptor - Dynamically Add Result Config to Action Config
On Tue, 24 Aug 2010 12:44:36 -0400, Dale Newfield d...@newfield.org wrote: The execAndWait interceptor used to do something like this for the wait result--I'd look there for how it works around the change requiring these be immutable. -Dale Thanks Dale - that helped me figure it out. We can no longer alter the config inside an interceptor; this is a feature (see WW-3068). What I now do in my case (I was inserting a redirect result into the config) is inject the redirect result into the container: ServletRedirectResult srd = new ServletRedirectResult(); container.inject(srd); srd.setLocation(SearchHelp.action?+request.getQueryString()); srd.setPrependServletContext(true); srd.execute(actionInvocation); return Action.NONE; This is similar to the injection of the FreeMarkerResult in execAndWait. Thanks, Steve -- Stephen Turner Senior Programmer/Analyst - MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Running Struts1 and Struts2 together?
On Mon, 23 Aug 2010 14:22:54 -0400, Greg Lindholm greg.lindh...@gmail.com wrote: Is there any issues with running Struts1 and Struts2 together in the same application? I have a couple old Struts1 applications which I plan on converting to Struts2 over time, but would like to start doing new development in Struts2 immediately while converting the Struts1 screens and action over bit-by-bit as needed. I haven't worked with Struts1 for many years. A quick look at the components makes me think I can run both 1 2 together. Greg, There's a pretty good section on this exact subject in Struts 2 in Action and although I haven't done it myself, the book indicates that you can have both versions 1 2 coexisting, and gives a fairly comprehensive description of how to do it. Good luck, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts 2.2.1 - Unit Testing Interceptors
Unit tests for interceptors in Struts 2.2.1 In TokenInterceptorTest I see a reference to org.apache.struts2.TestConfigurationProvider, but I can't find this class in a jar file. I do see the source code though. Which jar should I be using for TestConfigurationProvider? Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.2.1 - Unit Testing Interceptors
On Wed, 18 Aug 2010 16:22:37 -0400, Lukasz Lenart lukasz.len...@googlemail.com wrote: 2010/8/18 Stephen Turner stur...@mit.edu: Unit tests for interceptors in Struts 2.2.1 In TokenInterceptorTest I see a reference to org.apache.struts2.TestConfigurationProvider, but I can't find this class in a jar file. I do see the source code though. Which jar should I be using for TestConfigurationProvider? You must include JUnit Plugin http://struts.apache.org/2.x/docs/junit-plugin.html Regards I'm looking in struts2-junit-plugin-2.2.1.jar that came as part of struts2-2.2.1-all.zip and I see only these classes in the org/apache/struts2 folder: StrutsTestCase.class StrutsTestCase$1.class StrutsSpringTestCase.class What am I missing? Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Re : s:url tag - multiple params with same name
On Fri, 06 Aug 2010 17:12:10 -0400, François Rouxel rouxe...@yahoo.com wrote: should be working, did you put in s:url tag includeParameters='get' ? Yes, although I don't think that's what includeParams is used for - here's my actual code: s:url id=xurl value=a.b includeParams=get escapeAmp=false s:param name=pn value='firstval' / s:param name=pn value='secondval' / s:param name=pn value='thirdval' / /s:url URL 1: s:property value=xurl/ and here's the result: URL 1: a.b?pn=thirdval I'm using Struts 2.0.11 Steve -- Stephen Turner Senior Programmer/Analyst - MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
s:url tag - multiple params with same name
Hello all, I'd like to format a URL with multiple parameters having the same name, eg: ?pn=firstvalpn=secondvalpn=thirdval Is this possible using s:url ? I've tried this: s:url... param name=pn value=firstval / param name=pn value=secondval / param name=pn value=thirdval / /s:url This doesn't work - I get: ?pn=thirdval Doing something similar with the JSTL c:url tag does work, but I'd like to stick with the struts tag if possible. Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [FRIDAY] Mime Type Validation
On Fri, 16 Jul 2010 10:26:11 -0400, Christopher Schultz ch...@christopherschultz.net wrote: If filename extensions are sufficient, you can get this information directly from the servlet container using ServletContext.getMimeType. There's also the activation framework's MimetypesFileMap.getContentType. Another option might be to use the UNIX 'file' command, which will actually scan part(s) of the content of the file to determine what it is. It does not emit MIME types, though. Here's some good information, too: http://fredeaker.blogspot.com/2006/12/file-type-mime-detection.html Good luck, and let us know what you find. Thanks for all the suggestions ideas. We are leaning towards using a simple filename/extension check, as we feel that will catch 99%+ of the problems. One additional option we'll look at is: java.net.URLConnection.guessContentTypeFromName(fileName) In case anyone's interested, Firefox seems to maintain a cache of mime type mappings in the user profile (mimeTypes.rdf). This can (for reasons unclear) get messed up, and can result in Firefox reporting the wrong mime type on a file upload. We had one instance of a user uploading a PDF and Firefox was reporting it as video/x-flv. Deleting the mimeTypes.rdf file causes FF to create an fresh default copy and removes the problem. Thanks again- Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[FRIDAY] Mime Type Validation
We're using Struts 2 for file uploading, and we're filtering the types of files people can upload by checking the file's content type against a list of allowed mime types. This turns out not to be reliable enough. Firefox in particular seems to sometimes provide the wrong mime type, so some valid files are being rejected. My question is: has anyone come across a reliable way to detect a file's mime type? Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: i need more documentation on applicationContext.xml
On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang vangj...@googlemail.com wrote: hi, i've been reading and studying http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. i want to know what is actually going on in applicationContext.xml. for example, what do these two lines do? please explain or refer me to better documentation. bean id=transactionManager class=org.springframework.orm.jpa.JpaTransactionManager property name=entityManagerFactory ref=entityManagerFactory / /bean tx:annotation-driven transaction-manager=transactionManager / Hi Jake, This file holds the Spring configuration. You'll need to read up on Spring - they have excellent documentation at: http://www.springsource.org/ Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Redirect in an interceptor
To answer my own question, just in case anyone comes across this: It's no longer possible to dynamically alter the configuration, so a redirect to an action that's not in the config must be done differently. I copied the idea from ExecuteAndWaitInterceptor.java: ServletRedirectResult shRes = new ServletRedirectResult(); container.inject(shRes); shRes.setLocation(MyAction.action?+request.getQueryString()); shRes.setPrependServletContext(true); shRes.execute(actionInvocation); return Action.NONE; and up above: private Container container; @Inject public void setContainer(Container container) { this.container = container; } Steve On Wed, 16 Jun 2010 17:23:51 -0400, Stephen Turner stur...@mit.edu wrote: We are investigating moving from Struts 2.0.x to 2.1.8. We have an interceptor that does a redirect like this: ResultConfig cfg = new ResultConfig(shRes, ServletRedirectResult.class.getName()); cfg.addParam(location, MyAction.action?+request.getQueryString()); actionInvocation.getProxy().getConfig().addResultConfig(cfg); return shRes; In upgrading (which involves going from xwork 2.0.4 - 2.1.6) I found that the ResultConfig constructors are now protected and that there's a ResultConfig.Builder class that is used to create a ResultConfig object. That gets me to: ResultConfig.Builder configBldr = new ResultConfig.Builder(shRes, ServletRedirectResult.class.getName()); configBldr.addParam(location, MyAction.action?+request.getQueryString()); ResultConfig cfg = configBldr.build(); actionInvocation.getProxy().getConfig().addResultConfig(cfg); return shRes; However, this won't compile because ActionConfig no longer provides a addResultConfig() method. I can't find any info on the Open Symphony site or through Google that tells me how to do what I want in the new world. Can anyone point me in the right direction? Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Stephen Turner Senior Programmer/Analyst - MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Redirect in an interceptor
We are investigating moving from Struts 2.0.x to 2.1.8. We have an interceptor that does a redirect like this: ResultConfig cfg = new ResultConfig(shRes, ServletRedirectResult.class.getName()); cfg.addParam(location, MyAction.action?+request.getQueryString()); actionInvocation.getProxy().getConfig().addResultConfig(cfg); return shRes; In upgrading (which involves going from xwork 2.0.4 - 2.1.6) I found that the ResultConfig constructors are now protected and that there's a ResultConfig.Builder class that is used to create a ResultConfig object. That gets me to: ResultConfig.Builder configBldr = new ResultConfig.Builder(shRes, ServletRedirectResult.class.getName()); configBldr.addParam(location, MyAction.action?+request.getQueryString()); ResultConfig cfg = configBldr.build(); actionInvocation.getProxy().getConfig().addResultConfig(cfg); return shRes; However, this won't compile because ActionConfig no longer provides a addResultConfig() method. I can't find any info on the Open Symphony site or through Google that tells me how to do what I want in the new world. Can anyone point me in the right direction? Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Linking page
On Fri, 21 May 2010 11:01:43 -0400, Denis Cabasson denis.cabas...@gmail.com wrote: I personnaly prefer to use the same Action for things that are logically grouped. So in your case, I would use the execute method to return SUCCESS, pointing to the jsp, and a doSearch method with SEARCH result, pointing to the other JSP. That way, you have only one action for both JSP. I don't like going straight to the JSP, as you lose all of the struts 2 benefits, and so I prefer everybody to go through their action, even if that sometimes means having a execute method that just return SUCCESS. We are using so many struts default functionnalities that only work with the underlying actions (like resource bundles, etc..) that I really couldn't live without an action. Denis. I'm with Denis in that I prefer not to invoke jsps directly from the browser - if there is truly no logic to be performed before the display of the page, why not make it a static html page? If it must be a jsp, you don't even need to write an action to get to your jsp (assuming you're using struts 2), you can just configure the default action with your jsp as the success result. Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Linking page
On Fri, 21 May 2010 11:39:56 -0400, ch...@chrismiles.org ch...@chrismiles.org wrote: If you are not populating/building a view then it makes no sense to go through the controller. It is counter intuitive just pass through an action which does nothing, when the JSP would get filtered anyway. Chris That's your choice of course, but always putting jsps behind actions is generally considered a Struts best practice. See: http://markmail.org/message/pq5svxnx4wuznou6 Always using the MVC pattern gives consistency - some people might think that mixing MVC and a view-only approach is counterintuitive... Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts vs SpringMVC
On Thu, 15 Apr 2010 22:04:53 -0400, Frans Thamura fr...@meruvian.org wrote: have anyone read this? http://www.java4learners.com/struts/faq/what-are-advantages-spring-mvc-over-struts http://www.java4learners.com/struts/faq/what-are-advantages-spring-mvc-over-strutsany comment? Kind of bizzare to publish a comparison between Spring MVC Struts 1. I'm wondering if this is really an old article - he says with the advent of Spring MVC as though it's just come out. Not worth reading IMHO. Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
profiling = too true
Hello, I occasionally add ?profiling=true to a url to see which interceptors are called on an action. All of a sudden we are seeing the interceptor trace list in our logs for pretty much any action someone invokes in a particular app (without the additional url param). devMode is not turned on. Is there an app-wide setting that would activate this profiling that we might have turned on by mistake? Thanks, Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 - Global Validation
Hello Arul, No worries - welcome to the list. The message you got was from a list subscriber's email system, not from the struts mailing list so it's outside the list admins' control. They happen from time to time - best to ignore those messages. Don't get discouraged - this is a good place to hang out for struts 2 help! Steve On Thu, 04 Feb 2010 07:10:31 -0500, Arulmani V A arulman...@yahoo.com wrote: Hi, Apologies for having posted the same query 5 times - it was purely UNINTENTIONAL. I'm new to this list and when I posted my query for the first time, I got the following reply : Hi. This is the deliver program at bjtu.edu.cn. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. 02211...@mail.bjtu.edu.cn quota exceed --- Attachment is a copy of the message. [这是服务器 bjtu.edu.cn 的投递程序返回的提示信息] 到下列地址的信件投递失败,对方服务器无法正常接受或者拒绝接受这封邮件, 这是一个永久性的错误,服务器已经放弃继续投递。 02211...@mail.bjtu.edu.cn 对方服务器返回错误提示: quota exceed -- [附件是您所发送信件的原件] Hence thinking that my message was not posted (owing to length), I went about modifying my query and tried posting it repeatedly, each time getting the same reply as above. Finally frustrated that my message is not going through at all and that I get do not spam replies, I unsubscribed from the mailing list.. When the message gets posted successfully, why would you send a auto-reply like above which perplexes the new user... If you could fix this, then there won't be confusion to the newbies who post. Regards Arul The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/ -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to handle input from iterated output
On Mon, 01 Feb 2010 10:55:55 -0500, Craig Ricciuto cricci...@symboticware.com wrote: Hi, just a quick question. I have a class that has 4 fields. 2 Strings, 1 int, 1 boolean. I shall refer to this class as MyClass In my Action class I have a List (call it MyList) that is a list of MyClass. It can be populated with as little as 1 item or as many as say 256 items (could be more but I'll keep this limit for simplicity). Iterating through MyList in a JSP with the struts tag s:iterator/s:iterator is easy enough. My question is this When I iterate through MyList in the JSP I'm setting form fields (of all 4 fields from MyClass). What would be the best way to get all that input back when I submit the form? Is there an example of this somewhere I haven't found or just a pretty straightforward way of doing this I'm not thinking of? Thanks, Craig You just need to tell struts what type of objects are in the list: http://struts.apache.org/2.0.8/docs/type-conversion.html Basically this would involve a Myaction-conversion.properties file alongside the action class. It would contain: Element_MyList=mypackage.MyClass Also, there's a pretty good section on this in Struts in Action. Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with excel download file from Action (S 2.1.8)
On Fri, 22 Jan 2010 09:59:52 -0500, Dale Newfield d...@newfield.org wrote: Glad you were able to get that working. Where did you find the documentation that suggested this part of your stream result? Oscar wrote: param name=contentDispositionfilename=nameoffile.xls/param The filename can also be specified, but the only valid contentDisposition values are inline or attachment. So you want: param name=contentDispositionattachment;filename=nameoffile.xls/param -Dale Dale, Oscar's syntax is described in the Struts docs: http://struts.apache.org/2.0.8/docs/stream-result.html It's working well for us without the attachment; piece. Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with excel download file from Action (S 2.1.8)
On Fri, 22 Jan 2010 10:33:25 -0500, Dale Newfield d...@newfield.org wrote: Disposition means OK, what do I do with this thing? If the answer is save it, THEN the question of as what? arises. Stating the filename without first answering the display it inline vs. save it question is ambiguous and not guaranteed to get you the result you want. -Dale Dale, Thanks for the explanation - this works much better now. We were basically deferring the handling of this to the browser, and by using attachment; we now get consistent behavior. Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Example of dumping the valuestack?
On Mon, 28 Dec 2009 07:38:38 -0500, Jim Collings jlistn...@gmail.com wrote: I'm having some trouble finding things due to some arcane code. Was wondering if anyone could provide me with an example of dumping the valuestack to the jsp so that I can take a look? Jim C. P.S. I've probably asked this before but I can't seem to find it via searching. Reminder anyone? Jim, Adding debug=xml to the URL will show the value stack as XML. I think you need to have struts.devMode=true set in the struts config as well. Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts 1.0 and Spring?
I maintain a Struts 1.0 app and need to make some changes. While I'm working on the app, I'm wondering if there's any chance I could integrate Spring into the app, to manage Struts action classes. I found a plugin for Struts 1.1, but I don't want to upgrade the Struts version at this point. Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 1.0 and Spring?
On Fri, 11 Dec 2009 13:26:46 -0500, Paul Benedict pbened...@apache.org wrote: Have you looked at the Spring API for its Struts support? All I've seen in the Spring code refers to Struts 1.1 Steve On Fri, Dec 11, 2009 at 12:13 PM, Stephen Turner stur...@mit.edu wrote: I maintain a Struts 1.0 app and need to make some changes. While I'm working on the app, I'm wondering if there's any chance I could integrate Spring into the app, to manage Struts action classes. I found a plugin for Struts 1.1, but I don't want to upgrade the Struts version at this point. Thanks, Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Type Conversion and Lists
Hello, I'm trying to get objects placed in a List using the type conversion functionality built into Struts 2 (2.0.14)/Java 1.4. The bean that should be in the list is called Grocery, with attributes name and quantity. My action class has a List called groceries. I have a conversion properties file set up like this: Element_groceries=mypackage.Grocery The JSP has this: s:textfield name=groceries(0).name label=Name / s:textfield name=groceries(0).quantity label=Quantity / s:textfield name=groceries(1).name label=Name / s:textfield name=groceries(1).quantity label=Quantity / If I fill in these values on the form, Name: Apples Quantity: 4 Name: Pears Quantity: 8 I get 4 Grocery objects in the List, not 2: Grocery obj 1: name=Apples, quantity=null Grocery obj 2: name=null, quantity=4 Grocery obj 3: name=Pears, quantity=null Grocery obj 4: name=null, quantity=8 What I want is two objects: Grocery obj 1: name=Apples, quantity=4 Grocery obj 2: name=Pears, quantity=8 I thought the (0) and (1) in the JSP would tell the framework to do this, but obviously not - it doesn't realize that the first two attributes (name quantity) should go into a single Grocery object. Does anyone know the magic incantation to make this happen? I've studied http://struts.apache.org/2.0.14/docs/type-conversion.html for hours without success. Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: realtive path and absolute path
On Fri, 11 Sep 2009 07:59:38 -0400, Martin Gainty mgai...@hotmail.com wrote: (i dont know what a realtive path is) Martin Gainty I think he spelt it like that to confuse bots... Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 - ScopedModelDriven - Unable to update the model and set the latest Model data in session
On Wed, 19 Aug 2009 09:24:52 -0400, Raghuveer.V raghuve...@infotechsw.com wrote: Hi, I have a problem implementing ScopedModelDriven. One thing that could be a problem: public void prepare() throws Exception { user = new User(); Don't instantiate a new User object - the interceptor will do that the first time, and will pull the object out of session after that, and inject it into your action class. Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Using Map as option list source with s:select tag
Hello all, I'm playing with the Struts 2 s:select tag, trying to use a Map as the backing collection for the options list. This is Struts 2.0.11. From the docs: Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body. So I have a Map, with values of type PayPeriod, which is a simple Java bean. What I get in the rendered values is the String representation of the class ( yadda.yadda.payper...@dfg65 ). Is it possible to code something in the tag to get a PayPeriod bean attribute showing as the rendered value? I know I can cheat by defining a toString() method in the bean, but I wondered if there's a cleaner way of doing this. Thanks, Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Using Map as option list source with s:select tag
On Tue, 11 Aug 2009 09:59:06 -0400, Johannes Geppert jo...@web.de wrote: I'am not sure, but I think you can access the attributes of your bean with value.myattribute s:select list=mymap listKey=key listValue=value.myattribute/ Best Regards Johannes Geppert Hello Johannes, You are indeed correct! Thanks for the help. Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Interceptor Execution Tracing
Is it possible to easily see a record of all the interceptors executed during an action invocation? I want to see the actual interceptors that are executed, not the config (which shows me what I _think_ is happening). Thanks, Steve -- Stephen Turner Sr. Analyst/Programmer MIT IST - SAIS - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Interceptor Execution Tracing
On Thu, 02 Jul 2009 08:37:28 -0400, Paweł Wielgus poulw...@gmail.com wrote: Hi Stephen, turn debug on by adding ?profiling=true after any action address in browser and turning devMode. Read more here: http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/util/profiling/UtilTimerStack.html Best greetings, Paweł Wielgus. Thanks Paweł, that's exactly what I was looking for - Steve -- Stephen Turner Sr. Analyst/Programmer MIT IST - SAIS - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Scoped Model Driven Example?
Would someone be kind enough to point me to an example of the Scoped Model Driven usage? Both the xml config part and the Action code. I've googled this, and delved into the sample source code, and not come up with anything - Thanks, Steve - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Portlet/Oracle Portal Problems
Hi Nils, I haven't tried the Struts 2 sample, but I plan to. The Oracle Portal version is 10.1.4.2.0 Thanks, Steve On Sat, 18 Apr 2009 07:32:15 -0400, Nils-Helge Garli Hegvik nil...@gmail.com wrote: Have you tried deploying the Struts 2 sample app and see if it's the same problem there? And which version of Oracle Portal are you using? Nils-H -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts 2 Portlet/Oracle Portal Problems
Hello all - We've had some trouble using Struts 2 portlets (2.0.14) with Oracle Portal, and I wondered if anyone else had used this combination successfully. The problems occur with portlets that have a form and submit buttons, and the issue seems to be that Struts uses render parameters to pass information (like action name) from the event phase to the render phase. Oracle Portal keeps these values in the generated URL for the form action, and so they persist for longer than Struts is expecting them to. An aside - this is also an issue with straight JSR 168 portlets in the Oracle portal, but we can work around this by using session attributes to pass data from event to render, rather than render params. However, as Struts uses render params internally to figure out which action to invoke, there's no similar workaround for Struts. I suspect the problem is in the Oracle portal - the JSR 168 spec seems to indicate that render params are for passing data from event phase to render phase, but I wanted to see if anyone was aware of the issue and if there is a workaround. This all works perfectly when running in Pluto. Here's an illustration of the problem - we are using a redirectAction to get from event to render. I have a simple Struts action class StrutsTest which has these methods: public String execute(); // implements event phase processing public String doView();// implements render phase processing These methods do nothing except logging. My form has a single text input field called pie and a single submit. Here's the relevant part of the struts config: action name=init result name=success/WEB-INF/view/index.jsp/result /action action name=StrutsTestAction class=struts2hello.StrutsTest result name=input/WEB-INF/view/index.jsp/result result name=success type=redirectAction param name=actionNameStrutsTestRender/param param name=portletModeview/param param name=pie${pie}/param /result /action action name=StrutsTestRender class=struts2hello.StrutsTest method=doView result name=success/WEB-INF/view/index.jsp/result /action Here's what happens, step by step: *** 1. First display. init action is invoked, which simply forwards to the jsp. The form action url has this in it: struts.portlet.action%3D%252Fview%252FStrutsTestAction%26struts.portlet.mode%3Dview *** 2. I enter apple in the pie field and submit. The event phase mthod (execute) receives the value correctly and form is redisplayed . Logging shows this: 2009-04-16 09:32:31,581 INFO struts2hello.StrutsTest.execute - Begin execute 2009-04-16 09:32:31,583 INFO struts2hello.StrutsTest.execute - End execute 2009-04-16 09:32:31,765 INFO struts2hello.StrutsTest.doView - Begin doView A. Pie = apple 2009-04-16 09:32:31,767 INFO struts2hello.StrutsTest.doView - doView B. Phase: RENDER 2009-04-16 09:32:31,768 INFO struts2hello.StrutsTest.doView - End doView This is all correct - the event phase action is invoked, and then the render phase action (doView method) is invoked and the phase (from PortletActionContext) is RENDER. But, on redisplay, the form action URL now has this embedded: pie%3Dapple%26struts.portlet.action%3D%252Fview%252FStrutsTestRender%26struts.portlet.mode%3Dview%26struts.portlet.eventAction%3Dtrue AND struts.portlet.action%3D%252Fview%252FStrutsTestAction%26struts.portlet.mode%3Dview I believe this is where things start to go wrong - Oracle has put the render parameters (action name of StrutsTestRender and pie of apple) into the generated action url, and subsequent submits will see these parameters. *** 3. Entering cherry into the pie field and submitting again shows this in the log: 2009-04-16 09:33:40,502 INFO struts2hello.StrutsTest.doView - Begin doView A. Pie = apple, cherry 2009-04-16 09:33:40,505 INFO struts2hello.StrutsTest.doView - doView B. Phase: EVENT 2009-04-16 09:33:40,508 INFO struts2hello.StrutsTest.doView - End doView So we've now gone directly into the render method, but we're in the event phase. Presumably because of struts.portlet.action value of StrutsTestRender in the form's action URL. Also we now have both apple and cherry in the pie parameter values: apple from being embedded in the URL, cherry from being entered in the form. -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Portlet/Oracle Portal Problems
On Thu, 16 Apr 2009 14:02:31 -0400, Nils-Helge Garli Hegvik nil...@gmail.com wrote: That does indeed seem a little odd... The portlet framework expects these parameters, so I'm not sure there is a way around it. Did you try upgrading to 2.1.6? Nils-H I do suspect the Oracle portal is at fault - as I mentioned, straight JSR 168 portlets also cause a problem when using render params in the Oracle portal. I didn't think upgrading to 2.1.6 would help, but I tried anyway and am now getting a runtime exception: 09/04/16 14:41:40 struts2-hello: [id=75664163303,2] WARNING: Could not find action or result There is no Action mapped for action name WSRPBaseService. - [unknown location] We are accessing our portlets through WSRP - WSRPBaseService is used in the markup URL. No idea why this is being interpreted as a Struts action though! Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Portlet/Oracle Portal Problems
On Thu, 16 Apr 2009 12:24:13 -0400, Martin Gainty mgai...@hotmail.com wrote: 30 second solution seems to indicate session variables are auto-populating url so last statement(s) in doView method should invalidate your PortletSession // Code fragment from class implementing SessionAware containing the // session map in a instance variable session. Attempting to invalidate org.apache.struts2.portlet.servlet.PortletSession session; try { ((org.apache.struts2.dispatcher.SessionMap) session).invalidate(); } catch (Exception e) { logger.error(msg, e); } out of curiosity are you implementing with METHOD=GET or METHOD=POST ? Martin Thanks for the reply Martin - I didn't get too far though. Implementing SessionAware gives me a simple Map object, not a PortletSession object. Also casting PortletSession to SessionMap doesn't seem to please my JVM. The form action uses a POST method. Thanks, Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Portlet/Oracle Portal Problems
On Thu, 16 Apr 2009 15:14:31 -0400, Nils-Helge Garli Hegvik nil...@gmail.com wrote: No, I didn't expect it to hel... But there was a bug with URLs and the includeParams attribute, although I don't think this is the same issue. Do you know if there's an official bug report for the render parameter behaviour? Nils-H No, I don't know if there's a bug report - but we have a contact for Oracle support so I'm going to run it by them. Thanks for the help- Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Portlet/Oracle Portal Problems
On Thu, 16 Apr 2009 15:48:49 -0400, Martin Gainty mgai...@hotmail.com wrote: you dont have a PortletSession? Implementing SessionAware just gives me a java.util.Map object called session, not a PortletSession object. I can get to the PortletSession through PortletActionContext: PortletActionContext.getRenderRequest().getPortletSession() Invalidating the PortletSession object gives me an IllegalState exception - Steve -- Stephen Turner Senior Programmer/Analyst - SAIS MIT IST - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org