Latest Opinions on Struts GWT, and Maven and GWT
Hello, Struts world... After a long time of not being able to follow the list very closely, i'm getting back up to speed building Struts 2 webapps, and i wanted to see what people thought about a couple of things we're investigating. First, we're having really great exploratory results with GWT, and are looking to integrate some UI widgets built with it into our webapp. I've looked at the GWT plugin, and I'm not immediately convinced to begin using it. We've already integrated Musachy's JSON Plugin, and it seems totally plausible to me to just use that from the GWT side. Does anyone have any direct experience that might persuade me differently? The other, bigger issue on my mind, is how to integrate GWT into a team development environment. I've found a couple of Maven/GWT plugins, but I have reservations about both of them (I'll have to review if anyone challenges me to say what those were!) So again, does anyone have direct experience using Maven and GWT, and if so, how are you going about it? Thanks, Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com I felt so good I told the leader how to follow. -- Sly Stone
Re: [S2] Multiple Submits with different actions in a Form
On 7/25/07, David Durham, Jr. [EMAIL PROTECTED] wrote: I tried having the form specify one action and one button have to submit the form, and another button (like the one above) to have the form submit to another action. But it seems the action in the form overrides my button. Things like: s:form action=MyAction.do s:submit type=button/ s:submit type=button action=MyAction!cancel value=Cancel/ /s:form work for me in firefox, but don't seem to work in IE. David: Could you provide the rendered HTML that works in one browser but not the other? -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com I felt so good I told the leader how to follow. -- Sly Stone
Re: [OT] How to handle non UTF characters in XML
On 4/16/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ashish, Ashish Kulkarni wrote: I have java class which creates an XML file from SQL resultset, It works fine in USA, but i am having issues when this process runs in Germany where they have non UTF characters in there database like ü or á. I think you mean non-lower-ASCII. This characters are certainly covered by UTF-8. How do we handle this kind of situation in XML file, i set the XML file to be of UTF-8 type. How do you set the file type to UTF-8? I'm assuming Ashish is talking about the encoding attribute of the XML declaration in the first line of the file. Chris is correct that the real magic happens when you serialize the DOM to a file, but you should be sure to use the same encoding with the writer that actually creates the file as you do in the XML declaration. If your characters aren't UTF-8 then don't use UTF-8. Any decent XML reading software will recognize the encoding when the file is read. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [OT] How to handle non UTF characters in XML
See, the problem is that you're not handling the character encoding correctly in general. You should use String's getBytes method only when you know what you're doing, because the whole point of character encodings is that you can represent any given string with different sequences of bytes. I'd suggest doing more research on encoding in general: here's one popular piece, although not Javacentric: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)http://www.joelonsoftware.com/articles/Unicode.html From there, you may want to review the APIs for java.io.Reader and java.io.Writer, which are specifically designed to help smooth over the issues involved in serializing Java strings to bytes. This looks like it's going way too far off topic to be something that should be discussed much further on the Struts list. Best, Joe On 4/16/07, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi Here is the code where i read the dom tree and then convert it to a String, then convert this string into Byte array and then user DocumentBuilder().parse to parse it. I get error in factory.newDocumentBuilder().parse(byteArray); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); StringWriter writer = new StringWriter(); DOMSource source = new DOMSource(doc); transformer.transform(source, new StreamResult(writer)); String obj = writer.toString(); ByteArrayInputStream byteArray = new ByteArrayInputStream(obj.getBytes()); Document doc = factory.newDocumentBuilder().parse(byteArray); Ashish On 4/16/07, Joe Germuska [EMAIL PROTECTED] wrote: On 4/16/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ashish, Ashish Kulkarni wrote: I have java class which creates an XML file from SQL resultset, It works fine in USA, but i am having issues when this process runs in Germany where they have non UTF characters in there database like ü or á. I think you mean non-lower-ASCII. This characters are certainly covered by UTF-8. How do we handle this kind of situation in XML file, i set the XML file to be of UTF-8 type. How do you set the file type to UTF-8? I'm assuming Ashish is talking about the encoding attribute of the XML declaration in the first line of the file. Chris is correct that the real magic happens when you serialize the DOM to a file, but you should be sure to use the same encoding with the writer that actually creates the file as you do in the XML declaration. If your characters aren't UTF-8 then don't use UTF-8. Any decent XML reading software will recognize the encoding when the file is read. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: problem extending the ComposableRequestProcessor process chain
On 4/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ... lookup catalogName=struts name=process-action optional=false/ ... Is there a way that I can terminate the process-action chain early but still have it execute the process-view chain after? I will greatly appreciate any help or suggestions that you can offer. Yes. LookupCommand has a property, ignoreExecuteResult that overrides its default process to return whatever boolean is returned by the looked-up-command. You would turn it on like this: lookup catalogName=struts name=process-action ignoreExecuteResult=true optional=false/ Intuitively, I expected the same behavior you expected, but that's not how the commons-chain package was first implemented. This should do it, unless you sometimes want the lookup to return Command.PROCESSING_COMPLETE (that is, true) When using ignoreExecuteResult, LookupCommand always returns Command.CONTINUE_PROCESSING (false). Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Thread.sleep(...) in Struts Action
On 3/9/07, Adam Gordon [EMAIL PROTECTED] wrote: Our login page performs a POST to authenticate and I'd like to put in a delay when a login failure occurs so that it hinders/frustrates any malicious users and any scripts they might be running. I realize this isn't a foolproof solution but since the user isn't authenticated yet, I don't have a ton of options. One other thing we'll probably be doing is session validation/invalidation. I would think that the kind of throttling you're talking about is something you're better off doing with Apache than trying to do in your application code. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Thread.sleep(...) in Struts Action
On 3/9/07, Adam Gordon [EMAIL PROTECTED] wrote: How so? Please elaborate. Our web application sits entirely Tomcat land and it's accessible only via Apache, but Apache is only acting basically as the redirector - it knows nothing of what's going on, it just rewrites/relays requests and serves up responses. I'm not an Apache administrative guru, but if you look around on the web for things like this http://www.perlcode.org/tutorials/apache/attacks.html you might be able to find something that suits your purposes. The point being that, as people have indicated, using Thread.sleep to control this is dodgy, and besides, who's to say that only people who can't login are malicious. What if you have some disgruntled legitimate user (or someone who compromises the password of a legitimate user) -- if you're concerned essentially about DoS attacks, you don't want to have to clutter your web application with managing all of that. Why have Apache in the middle if you don't use it for something? ;-) Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: How to create an action-mapping to another contaxtPath?
If you actually ran these as two separate modules in a single Struts app, then you could use the module switching facilities. See http://struts.apache.org/1.x/userGuide/configuration.html#module_config-switching If they are two separate web applications, then there is no built-in way to help one know about the other. You pretty much have to forget that they are on the same machine. You'd have to use redirects to send users over to the other app, and you'll have to go to some lengths to share any kind of state between the two webapps. Joe On 3/5/07, Edson Alves Pereira [EMAIL PROTECTED] wrote: Hello folks, i must use from my application an action from another struts application, both servers are in the same machine, for example: /server1/initProccess.do send a forward to /server2/fillStatements.do Regards, Edson -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: How to create an action-mapping to another contaxtPath?
No, the SwitchAction depends on having access to the same ApplicationContext for the destination as that in which it executes. For your purposes, two EARs deployed separately on the same server are no closer to each other than if they were on different continents. Joe On 3/5/07, Edson Alves Pereira [EMAIL PROTECTED] wrote: Those server are real separate applications, they are two EAR deployed in the same J2EE server. Can i use SwitchAction to manage that? On 3/5/07, Joe Germuska [EMAIL PROTECTED] wrote: If you actually ran these as two separate modules in a single Struts app, then you could use the module switching facilities. See http://struts.apache.org/1.x/userGuide/configuration.html#module_config-switching If they are two separate web applications, then there is no built-in way to help one know about the other. You pretty much have to forget that they are on the same machine. You'd have to use redirects to send users over to the other app, and you'll have to go to some lengths to share any kind of state between the two webapps. Joe On 3/5/07, Edson Alves Pereira [EMAIL PROTECTED] wrote: Hello folks, i must use from my application an action from another struts application, both servers are in the same machine, for example: /server1/initProccess.do send a forward to /server2/fillStatements.do Regards, Edson -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: What to use instead of tiles in Struts2?
that Tiles is the niftiest piece of Struts, and I can't see using Struts-2 without Tiles. Thanks, - Ray Clough [EMAIL PROTECTED] Dave Newton wrote: --- Neil Aggarwal [EMAIL PROTECTED] wrote: Is there another way of doing similar functionality on struts2? A lot can be done with the s:action.../ tag. That said, I have had essentially zero problems with the Tiles plugin and have been using it successfully for some months now. d. Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [S2] Equivalent of Servlet init() method?
On 2/22/07, Wesley Wannemacher [EMAIL PROTECTED] wrote: I looked for something similar a while back and didn't find anything simple. There are servlet context listeners (but that isn't really struts-2-ish). I would strongly disagree that ServletContextListeners are not really struts-2-ish. They are probably the best way to do any one-time initialization for an application, unless there's already some other code to do what you need... On 2/22/07, bob [EMAIL PROTECTED] wrote: I could be wrong, but perhaps you should use the Spring IoC container for this. I can't point you to the correct documentation off hand, but I believe that this is the way to maintain a resource such as what you had previoulsy done with the Servlet's init method and the factory class. Maybe someone with more experience integrating spring and struts2 can chime in with some doc recommendations. I'm a bit of a newbie myself unfortunatley. I don't think you have to use the Spring IoC container for this, but I think it's probably a pretty good way to do it. I am extremely fond of using Spring to establish an application context (not to be confused with the webapp application context) and letting most of my code be blissfully ignorant of how things get set up. This page is the place to start on using the Spring plugin with Struts 2: http://struts.apache.org/2.x/docs/spring-plugin.html In short, Spring can instantiate any beans you want, either as singletons or as prototypes (that is, a new bean is instantiated each time it is called for from the Spring app context). In instantiating, it can also satisfy dependencies automagically. In the Struts2/Spring model, this is usually applied to action classes, which would be instantiated by Spring when requested by Struts. Spring would just give you an Action instance with a reference to your factory (although once you start digging in Spring, you might find that you can even hide the Factory and keep your Actions super simple and flexible.) Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [S2] Equivalent of Servlet init() method?
On 2/22/07, Joe Germuska [EMAIL PROTECTED] wrote: This page is the place to start on using the Spring plugin with Struts 2: http://struts.apache.org/2.x/docs/spring-plugin.html In short, Spring can instantiate any beans you want, either as singletons or as prototypes (that is, a new bean is instantiated each time it is called for from the Spring app context). In instantiating, it can also satisfy dependencies automagically. In the Struts2/Spring model, this is usually applied to action classes, which would be instantiated by Spring when requested by Struts. Spring would just give you an Action instance with a reference to your factory (although once you start digging in Spring, you might find that you can even hide the Factory and keep your Actions super simple and flexible.) Oh, yes, I just remembered -- the page above has a Spring config file example using the Spring 1.x DTD. If you should instead use the Spring 2.xDTD (which you could, because Struts depends upon Spring 2), you must be aware that the default instantiation model for Spring 2 is singleton, not prototype, and that is at odds with the model behind WebWork, which assumes that each action is instantiated once per request. Thus, the example which is in the page referenced above: bean id=bar class=com.my.BarClass singleton=false/ would become bean id=bar class=com.my.BarClass scope=prototype/ Took me a little bit to realize that that was the source of a few quirks when I was first setting out with Struts2/Spring2. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [S2] Equivalent of Servlet init() method?
On 2/22/07, Wesley Wannemacher [EMAIL PROTECTED] wrote: I don't know much about Spring and shied away from servlet context listeners because I didn't want the external dependencies. I'm not suggesting that my way is the best way, but if you have a requirement to write unit tests for all of your code, then it's easier to stay away from the Servlet API. That is absolutely true. Then again, static initializer blocks can bring headaches of their own. I have never been very comfortable with them. I find that using Spring steers one to design code that is eminently unit testable, to the point where one need not use Spring in testing; one can simply satisfy a few simple dependencies as Spring would, and let the tests run. This is ultimately more a factor of designing for dependency injection than a characteristic of Spring itself, but I like Spring so... One of the great strengths of Struts 2 is that it does a much better job of hiding the Servlet API, making for components which are much more plausibly unit-testable. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: jsessionid appended to URL and page not found`
The solution Christopher and Dave discuss above can be handled with this in the Apache httpd.conf file: RewriteRule ^(.*);jsessionid=.*$ $1 This strips the session ID from anything that the HTTPD server is handling, although it should still get passed through the proxy. To be honest, our apps depend on cookies for other reasons so if URL rewrite sessions didn't work, we might never notice. The fact that your proxy config is not correctly brokering some URLs over to the servlet container would depend on how your proxy config is set up; I'm not very experienced in actally setting this up, but my diagnosis is correct, then the Struts mailing list is not the best place for the question anyway... Joe On 2/7/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave, Dave Newton wrote: --- Vinod Kumar [EMAIL PROTECTED] wrote: So I have apache+tomcat integrated. What confirguration settings, do I need to make this work in this scenario. IIRC when we had this problem we used one of the rewrite mods to nudge Apache to know that the ;jsessionid etc. was special. There's probably a better solution these days :) For me, this strategy is only necessary when I want Apache httpd to serve static content that has an encoded jsessiond in the URL. Anything that gets passed-through to the app server (Tomcat in my case) is handled correctly. Use of mod_rewrite is only necessary when Apache httpd incorrectly includes the ;jsessionid as part of the filename, and therefore fails to locate some-static.html;jsessionid=ABCDEF in the filesystem. mod_rewrite can be used to remove the jsessionid, allowing Apache httpd to correctly locate the static resource on the disk. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFyoWQ9CaO5/Lv0PARArqsAKDEW+7/4JQmg1QkbK8XiqL1elywvQCfVxa5 dteBRDBaFEmOqbktSGxrti0= =vchZ -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Action and ActionForm in popup window
There needs to be an element in your struts-config.xml action path=/criteriosOferta name=yourFormBeanName type=... etc. Whenever you use an html:form tag, Struts must be able to find (in struts-config.xml) the action you specify in the action attribute, and that action must have a name attribute which points to an ActionForm configuration. The form tag looks up an ActionForm instance in request or session scope, or creates one if necessary, and uses that bean to back the form fields inside html:form which may have values which need to be filled, as in the case of returning-to-a-form-after-validation-failures. I hope this helps. Joe On 2/8/07, Yariel Ramos Moreno [EMAIL PROTECTED] wrote: Hi all: From a page in my struts application, I need to open a popup window with some fields to pick up some values. I created an ActionForm with the filed's properties and an Action asociated to it. The problem is that when I try to open the popup the following exception is raised: Cannot retrieve mapping for action /criteriosOferta .. In this line: html:form action=/criteriosOferta It is possible to do that? Any idea of how fix it? Thanks in advance... -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Action and ActionForm in popup window
Yariel: Your struts config looks good. I can't guess why you'd have different results in a popup vs. a regular page unless you are perhaps using different modules or somehow have the webapp deployed under two contexts with slightly different configurations. Have you done a full clean reinstall, restart app server, etc? I suggest that not because it's likely to actually fix anything, but sometimes going through the complete process helps you methodically make sure your application is in a consistent state. not sure what else to suggest... Joe On 2/8/07, Yariel Ramos Moreno [EMAIL PROTECTED] wrote: Thanks for your help Joe, but I allready did everything you said. The action I'm using works perfectly in a normal window... the problem occurs when I use it in the popup window. I'm using struts 1.1. This is the struts-config code snippet: Form: form-bean name=criteriosOfertaForm type= com.coremain.sidt.ont.ofertas.form.CriteriosOfertaForm / Action: action attribute=criteriosOfertaForm name=criteriosOfertaForm path=/criteriosOferta scope=request type=com.coremain.sidt.ont.ofertas.action.CriteriosOfertaAction validate=false forward name=ofertas path=pagina.gestionOfertas / /action - Original Message - From: Joe Germuska To: Struts Users Mailing List Sent: Thursday, February 08, 2007 11:00 AM Subject: Re: Action and ActionForm in popup window There needs to be an element in your struts-config.xml action path=/criteriosOferta name=yourFormBeanName type=... etc. Whenever you use an html:form tag, Struts must be able to find (in struts-config.xml) the action you specify in the action attribute, and that action must have a name attribute which points to an ActionForm configuration. The form tag looks up an ActionForm instance in request or session scope, or creates one if necessary, and uses that bean to back the form fields inside html:form which may have values which need to be filled, as in the case of returning-to-a-form-after-validation-failures. I hope this helps. Joe On 2/8/07, Yariel Ramos Moreno [EMAIL PROTECTED] wrote: Hi all: From a page in my struts application, I need to open a popup window with some fields to pick up some values. I created an ActionForm with the filed's properties and an Action asociated to it. The problem is that when I try to open the popup the following exception is raised: Cannot retrieve mapping for action /criteriosOferta .. In this line: html:form action=/criteriosOferta It is possible to do that? Any idea of how fix it? Thanks in advance... -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts2, tiles2 and character encoding problem
TILES-28 should be resolved in the SNAPSHOT version you indicate, while the subsequent change (to the Taglib URI) hadn't been changed. I just deployed a 2.0-SNAPSHOT rather than let it hang on as something less clear going forward. But back to your issue: it might seem that you've found a variation of the problem that was fixed in TILES-28 Make absolutely sure you don't have more than one version of the tiles-core JAR in your app, but assuming that you don't, we'll have to sniff around some more and figure out what might be different. You're doing the right kind of monitoring already -- what does Fiddler say if you get a conventional Struts result (ServletDispatcherResult) from your app? What about if you get a JSP directly from the app without going through Struts? Joe On 2/7/07, elin [EMAIL PROTECTED] wrote: Thank you for your reply. I upgraded from struts 2.0.4 to 2.0.5 but with the same result. I use maven to build the project which gives me the tiles version tiles-core-2.0-20070130.184344-3.jar. It seems to be the latest snapshot. Is this the version where the bug you mentioned is fixed? Or do you mean that it is fixed in the next build? Monitoring the response with fiddler shows that there is no content-type header. I use a tiles definition file and the insertAttribute tag to build the tiles result. Elin -- View this message in context: http://www.nabble.com/Struts2%2C-tiles2-and-character-encoding-problem-tf3181491.html#a8841954 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts2, tiles2 and character encoding problem
OK, a few more notes: just to be clear, I have specified struts.i18n.encoding=UTF-8. This is not used to directly set the response character encoding. I use a CharacterEncodingFilter to set encoding to UTF-8. In my experience, a CharacterEncodingFilter is used to control the request content type, not the response content type. That's what the Spring class called CharacterEncodingFilter does. Assuming yours is the same, it won't come into play in debugging this problem. I specify meta http-equiv=content-type content=text/html; charset=UTF-8/ on the page. I am not sure whether browsers allow this to override an explicit content type set in the HTTP response, but in any case, it's more important that the HTTP response header be explicitly set. In a local test application I have, the servlet container is setting the header even when I don't explicitly set it. Using the latest code, I've tested going directly to a JSP (no struts), going to a default result (RequestDispatcher.forward) and going to a Tiles result. I get an explicit content type in all three cases, even though the JSP itself doesn't set the content type. I think there's something about that in the Servlet spec, that the container is required to set a content type, although that's at odds with what I experienced when I filed TILES-28 and with Elin's experience, so I'm not sure. This discussion REALLY belongs on [EMAIL PROTECTED] -- user lists are meant to discuss using the app, not fixing bugs in prereleased code. Elin, if you want to pursue this, please file a bug with as much as you can offer for reproducibility (especially since I just tried and can't reproduce it) and if you want to have further email, please join the [EMAIL PROTECTED] mailing list. See http://tiles.apache.org/mail-lists.html On 2/7/07, elin [EMAIL PROTECTED] wrote: I double-checked that there is only one tiles-core jar. Monitoring shows: Conventional Struts result response's Content-Type header is text/html;charset=utf-8 If I request a jsp directly, the response's Content-Type header is text/html;charset=utf-8 Tiles Result response has no Content-Type header Elin -- View this message in context: http://www.nabble.com/Struts2%2C-tiles2-and-character-encoding-problem-tf3181491.html#a8845842 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: jsessionid appended to URL and page not found`
What is handling the basic HTTP service for your application? If it is not a servlet container, but rather an HTTP server which proxies certain requests to a servlet container, then there is probably just a configuration problem. The scenario you describe is standard. A Servlet Container (or maybe it's the JSP engine) is supposed to encode the session ID in URLs unless it knows that the client accepts cookies, which it can only know if the client already presented a cookie with a session ID in it (as on reload or later clicks through the application.) If you don't have an HTTP proxy in the middle, then what servlet container are you using? I do local development with Tomcat and have for years with it being the HTTP server, and have never had this problem. joe On 2/7/07, Vinod Kumar [EMAIL PROTECTED] wrote: Hi All, I have a link to a struts web application in one of existing website like start.jsp?cntry_cd=US start.jsp is in struts application and contains the following line jsp:forward page=/setup.do / setup action does some pre-setup stuff and forwards to home page. The home page displays well with all navigation links. But, when I click on any of the navigation links (which are actions and their URL looks like status.do;jsession=jfdkfdkfdk ..jsessionid appened only initially ) , I get error message that page cannot be found. If before clicking on any of the links, I do refresh on the home page and then click on any links, then it works fine. My question is, why it cannot find actions, when jsessionid is appended to URL. What can i do to fix this issue. Thanks for your help. Vinod Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Problems with Maven
On 2/6/07, Manos Batsis [EMAIL PROTECTED] wrote: Quoting Christopher Loschen [EMAIL PROTECTED]: We had a report at my office that some downloads of the 1.5.0_10 JDK were missing that jar file Right, i think OSX doesn't have a separate jar for that. In that case the OP should probably add an exclusion element within the POM dependency that depends on that JAR to make the build independent of it. In the specific case of OS X, that element of the Maven config should not be being invoked. It should only be invoked for Sun JDKs. No changes should be necessary for Mac OS X users (of whom I am one.) Odds are good that your machine has only a JRE installed and not a JDK. The JRE does not include things like tools.jar. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts2, tiles2 and character encoding problem
Are you using the newest version of Tiles? There was a bug in which the content types were not being set in some cases; I was using a JSP page attribute to set the content type, not the other options, but it may be related. For everyone who is using Tiles 2, note that very soon now, the SNAPSHOT version of Tiles will be changing the URI for the TLD from http://struts.apache.org/tags-tiles to http://tiles.apache.org/tags-tiles so you will need to update the taglib declarations in your JSPs. (We use a JSP include directive like this %@ include file=/WEB-INF/tiles/_boilerplate.jsp % so that we only have to change it in one place. If you don't do something like that, then I hope you have a good global search/replace option... I will probably build a new Maven SNAPSHOT in the next few days unless another developer does it first. (Note that if you're using Tiles 2, you probably ought to monitor the [EMAIL PROTECTED] list in case no one mentions things like this to the Struts user list. In general, Apache projects expect discussion of pre-release software to occur on dev lists, not user lists.) For reference, the bug to which I refer is https://issues.apache.org/struts/browse/TILES-28 Joe On 2/6/07, elin [EMAIL PROTECTED] wrote: Hi, I use struts2 and tiles2 in my web application. When my tiles result contains data with åäö and I write the data using el, the characters are not displayed correctly. If I write the data with a struts tag, for example s:property the characters are displayed correctly. If I do not to use a tiles result, just a simple jsp, the characters are displayed correctly when I use el. I have specified struts.i18n.encoding=UTF-8. I use a CharacterEncodingFilter to set encoding to UTF-8. I specify meta http-equiv=content-type content=text/html; charset=UTF-8/ on the page. Any ideas? /Elin -- View this message in context: http://www.nabble.com/Struts2%2C-tiles2-and-character-encoding-problem-tf3181491.html#a8828883 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Producing links
There's an open ticket for this issue https://issues.apache.org/struts/browse/WW-1517 I assigned it to myself, since I, too, am interested in such functionality, but I'm looking for some suggestions from someone, anyone with more familiarity with the architectural model for the S2 tags because I don't quite see how to maximize reuse (because it's essentially a hybrid of the s:a and s:url tags and I'm not sure how to blend them while holding to what seems to be the model of a single component object per tag. Maybe we could make a completely new component object, but then the question is how to not have duplicate code with the Anchor and Url components. Joe On 2/4/07, Gonçalo Luiz [EMAIL PROTECTED] wrote: Hello, Even though the method I'm using to produce links is working, I think of it like a little bit awkward. An example of what I'm saying is: a href=s:url action=preferences_prepare/ s:text name=preferences / /a Is there a more elegant way of producing links that does not involve this sub-tag schema ? Thank you. Best Regards, -- Gonçalo Luiz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [s2] getting servletContext in actions
You need to make sure that your action is passing through an interceptor-stack that includes ServletConfigInterceptor http://struts.apache.org/2.x/core/apidocs/org/apache/struts2/interceptor/ServletConfigInterceptor.html The struts-default package does include this. http://struts.apache.org/2.x/docs/struts-defaultxml.html Another thing you can do is call the static method ServletActionContext.getServletContext() but this would be harder to support in a unit testing environment. If you implement ServletContextAware, then you could provide a mock ServletContext implementation in your unit test setup, while you'd have a lot more awkward setup to do to make sure that ServletActionContext.getServletContext was prepared to return a usable value. Joe On 1/31/07, Nagraj Rao [EMAIL PROTECTED] wrote: were u actually able to get the servletContext Object thru servletContextAware?? I'd tried it but couldn't get it :( do we need to do any additional stuff for that?? - Original Message - From: Jeffrey Hau [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, January 31, 2007 4:55 PM Subject: [s2] getting servletContext in actions Hi, If i need to get a servletContext object in my action class, is implementing the ServletContextAware interface the standard way of doing this? Is there any other alternatives? thanks, Jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [s2] getting servletContext in actions
Jeff: I think there are a lot of possible routes, but I'm not sure I understand your goal. Could you just have your service implement ResourceLoaderAware? If your Spring ApplicationContext is a WebApplicationContext (as it would be if set up by ContextLoaderListener), then the ResourceLoader would check the ServletContext for resources in addition to the class path, etc. If you don't want your service to implement a Spring interface, there are some Spring beans that help bridge the gap, briefly name-checked here http://www.interface21.com/news-home/2005/spring-1.1.4-released These mostly just let you apply ServletContext attributes to Spring beans in various ways without binding your code to the Servlet API. My hunch is trusting that the ResourceLoaderAware is the right solution, especially now that I realize that if you're passing in a ServletContextResource, then you've already accepted the Spring API into your service layer. Does that help? Joe On 1/31/07, Jeffrey Hau [EMAIL PROTECTED] wrote: Hi Joe, Thanks for the helpful information. I am just wondering is it possible to get the ServletContext object in my spring applicationContext.xml? What i am trying to do now is to create a Resource object (ServletContextResource) and inject into a service class and then use this service class in a struts action. At the moment, I have to pass in the resource path (as a string) into the action, instantiate the ServletContextResource in the action then pass it to the service class. many thanks, Jeff On 31 Jan 2007, at 12:53, Joe Germuska wrote: You need to make sure that your action is passing through an interceptor-stack that includes ServletConfigInterceptor http://struts.apache.org/2.x/core/apidocs/org/apache/struts2/ interceptor/ServletConfigInterceptor.html The struts-default package does include this. http://struts.apache.org/2.x/docs/struts-defaultxml.html Another thing you can do is call the static method ServletActionContext.getServletContext() but this would be harder to support in a unit testing environment. If you implement ServletContextAware, then you could provide a mock ServletContext implementation in your unit test setup, while you'd have a lot more awkward setup to do to make sure that ServletActionContext.getServletContext was prepared to return a usable value. Joe On 1/31/07, Nagraj Rao [EMAIL PROTECTED] wrote: were u actually able to get the servletContext Object thru servletContextAware?? I'd tried it but couldn't get it :( do we need to do any additional stuff for that?? - Original Message - From: Jeffrey Hau [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, January 31, 2007 4:55 PM Subject: [s2] getting servletContext in actions Hi, If i need to get a servletContext object in my action class, is implementing the ServletContextAware interface the standard way of doing this? Is there any other alternatives? thanks, Jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [s2] getting servletContext in actions
On 1/31/07, Tom Schneider [EMAIL PROTECTED] wrote: It would be very easy to create a Spring FactoryBean for this. In this case, couldn't one simply implement Spring's ServletContextAware interface? http://www.springframework.org/docs/api/org/springframework/web/context/ServletContextAware.html Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [S2] User authentication best practice (2nd time...)
On 1/31/07, Sébastien LABEY [EMAIL PROTECTED] wrote: Hi all (sorry for the previous unterminated mail), I would like to know if S2 provides a solution to manage user authentication. In short, no. S2 has a RolesInterceptor which allows you to specify that users in certain roles are allowed or disallowed from proceeding to the action invocation. This uses HttpServletRequest's isUserInRole method, so it leverages any authentication system which can be tested through that. Anything more would be hard to find the sweet spot for the right number of users. If someone had the right idea, perhaps someone could leverage the plugin framework to provide support for authentication. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: newbie question...struts2, spring and jdbc
On 1/31/07, Cecilia Castillo [EMAIL PROTECTED] wrote: I am new to Struts, Struts2, and Spring. (And maybe know too much about jdbc.) I have written my application with Struts2 and am only using Spring to manage my database connections. I have defined my oracle database as a JNDI resource in my Tomcat server.xml file. I have defined a dataSource bean in my applicationContext.xml for my database JNDI resource. I have written some DAO classes which are spring beans defined in my applicationContext.xml. These all have a dataSource property pointing to my database. These DAO classes have methods which execute various db stored procedures or select statements. Now, I have some strut2 ActionSupport subclasses which do something like this in my execute() method ThingDao thingDao= (ThingDao )getBean(ThingDao); All is well, all is working. However, what I want to know is something about how Spring works. Does it manage these beans as singletons? In Spring 2, bean lifecycle is controlled by the scope attribute of the bean element. See http://www.springframework.org/docs/reference/beans.html#beans-factory-scopesfor more info. Also, the scope defaults to singleton, which is counter to the original model for Struts2 Actions, where each action is generally expected to be instantiated once per request. For your DAO bean, etc, of course you would choose for yourself whether to set to a singleton scope or a prototype scope. Or every time the execute() method is called, and I get my dao bean, does it instantiate a new instance of the dao bean object? Should I save this dao bean object in a private member of my ActionSupport class and reuse it everytime execute() is called? This suggests that your model is also counter to the Struts2 model. If you are writing Action classes with properties that are populated based on request parameters, you will be subject to concurrency problems (race conditions) if you have singleton actions. I'd recommend against it. Actions are supposed to be lightweight. At what point does Spring get a database connection...when the dao bean is instantiated, or when the dao bean executes() some jdbc call. (I assume this is when it makes a jdbc call, but I just want to confirm). This I can't answer directly, but remember that Spring is open source. You could check the code. If anyone can enlighten me or point me to some good documentation on this subject, I would appreciate it. Spring's own documentation (referenced above) is thorough and pretty clear. There are also a number of good Spring books. Hope this helps. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: struts.xml error - Element type constant must be declared
On 1/31/07, shahab [EMAIL PROTECTED] wrote: Hi: I think I would need some more help from you. I dont see any dtd or xsd file in my application. What else I should look for? It's probably in the JAR. Which version of Struts are you using? The change was introduced after Struts 2.0.1 Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Tiles2 and Struts2
On 1/30/07, Gonçalo Luiz [EMAIL PROTECTED] wrote: Hello, After a few days fighting with Struts2 and Tiles2 I decided to ask in the mailing list: does actually anybody managed to get them to work together? I tried different approaches: 1 - Use a listener in web.xml - got an error that kept tomcat throwing 404 error 2 - use a servlet in web.xml - all went to until I used a tile result type which threw a java.lang.NoClassDefFoundError: org/apache/tiles/TilesContext TilesContext is obsolete (see http://issues.apache.org/struts/browse/TILES-82); you're best off moving to the newest possible versions of all of the relevant jars. I'm not sure if true nightly builds of Tiles have been set up yet, but the latest snapshots for Struts and Tiles are all working together for me. It's easier by a long shot to do this with Maven, but if you need to retrieve new JARs yourself, you could manually retrieve them from the Maven repository anyway... Struts nightly builds can be retrieved from http://people.apache.org/builds/struts/nightlies/2.0.x/ As far as I know, the SNAPSHOTs here represent the HEAD of the SVN repository even though they aren't published as official nightly builds: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tiles/ Maybe that will help... -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts 2 and tiles
That looks right to my eye. I'd suggest setting your logging config to debug for the category org.apache.tiles.impl (the class which specifically handles the definitions is BasicTilesContainer). Perhaps that will help. I have to stress once again that Tiles 2 has not been released. If you are interested in using it, you have to be ready to get inside the code to understand how it works until more documentation is written (and to be ready to make changes to your code as changes get made to the framework, since there's no specific backwards compatibility baseline we have to guarantee for the first Tiles 2 release.) Joe On 1/30/07, Sai Nay Thurein Nyo [EMAIL PROTECTED] wrote: Hi Joe, I am testing on the tiles 2 to use in my new framework using Struts 2. I tried the following and it doesn't work. The tiles keep looking for the /WEB-INF/tiles.xml file which is default. All I need to do is simply add in the context parameter in web.xml right? context-param param-nameorg.apache.tiles.DEFINITIONS_CONFIG/param-name param-value/WEB-INF/tiles-common.xml,/WEB-INF/tiles-sample.xml /param-value /context-param I did try a few other configurations with different params names such as definition-config, tiles-definiation also didn't working. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts 2 and tiles
Have you seen http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html ? Struts 2 is intentionally mostly ignorant of Tiles, except for the plugin, so something like per-package tiles defs would involve writing your own code, perhaps a custom subclass of the TilesResult. However, if you just want to spread out your config among multiple files (which I like to do), you just need to specify a context parameter like this: context-param param-nameorg.apache.tiles.DEFINITIONS_CONFIG/param-name param-value /config/tiles/common.xml, /config/tiles/create.xml, /config/tiles/library.xml, /config/tiles/profile.xml, /config/tiles/login.xml /param-value /context-param While I think Tiles 2 is probably reasonably close to a release, it is still under development, and documentation is one thing that is needed. (Contributions are always welcome...) It doesn't have much traffic yet, but there is now a tiles user mailing list -- see http://tiles.apache.org/mail-lists.html In the mean time, remember that it hasn't been released, so if you plan to use it, you should probably subscribe to the [EMAIL PROTECTED] mailing list to keep up with status and changes. Joe On 1/29/07, Gonçalo Luiz [EMAIL PROTECTED] wrote: Hello, I'm developing a web application using struts2. I'm a struts1 developer and now I'm migrating myself (not a specific app) to struts2. The documentation is very good so I managed to setup struts and run a few actions. The problem I found was in what it regards to Tiles. Despite the documentation refers the web.xml (the interceptor and configuration file) and struts.xml (return types) it does not show a tiles-configuration.xml example. I was used to have a tiles-configuration.xml for each subapplication (STRUTS2's namespace) and now it seems that there can be only one. I'm good with that, but I'd like to know the tiles-configuration.xml format. So, what I'd like to know is: 1 - is there any way to specify multiple tiles-configuration.xml files? 2 - is there any way to associate a different tiles-configuration.xml file to each package 3 - is there an example of a tiles-configuration.xml usage with struts2? 4 - is tiles1 or tiles2 which comes bundled with struts2? Where can I find this info in documentation. Oh, planetstruts.org is down for at least 3 days, where can I report this? Best Regards, -- Gonçalo Luiz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts 2 and tiles
The struts-tiles-plugin depends on the nightly snapshot of Tiles 2, which means that some things may get out of sync with the docs -- for instance, we've recently been working on clarifying the names of some of the JSP tags and I know for a fact some of the doc at tiles.apache.org is not in sync with the current snapshot. The example I gave is for using the TilesListener (ServletContextListener) instead of the servlet, as in item (2) of the Confluence Wiki page ( http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html) In this case, the context-params are for the general Application Context and would probably go right above your filter element for the Struts 2 FilterDispatcher. I have only just recently reconnected with Tiles development, but I suspect that the TilesResult would work if you used the Servlet, but if you don't intend to allow direct links to tiles, then there's no reason to use the servlet; the Listener will take care of initializing the configurations, and that's all that the Struts2 Tiles Plugin needs. Note also that there are some differences in the DTD for Tiles2: more attempts to simplify and clarify compared to Tiles1. The new DTD is at http://struts.apache.org/dtds/tiles-config_2_0.dtd (although I guess we may want to move it to tiles.apache.org before officially releasing Tiles 2.) The main difference I can think of offhand is the XML attribute path in the definition element in Tiles 1 becomes template in Tiles 2. That is definition name=xyz template=/xyz.jsp / Joe On 1/29/07, Gonçalo Luiz [EMAIL PROTECTED] wrote: Hello Joe, thank you for your reply. In fact I had already saw http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html, however I did not found any reference to an example of tiles-config.xml nor the version of the bundled Tiles (I assume from your answer that is tiles2). I'd still like to look into a tiles-config.xml example. Currently I'm using this configuration: servlet servlet-nametiles/servlet-name servlet-classorg.apache.tiles.servlets.TilesServlet /servlet-class init-param param-namedefinitions-config/param-name param-value/WEB-INF/tiles-config.xml /param-value /init-param load-on-startup1/load-on-startup /servlet Where are you suggesting to add the context-param? Should param-namedefinitions-config/param-name be param-nameorg.apache.tiles.DEFINITIONS_CONFIG/param-name instead? Thank you once again. Best Regards, Gonçalo Luiz. On 29/01/07, Joe Germuska [EMAIL PROTECTED] wrote: Have you seen http://cwiki.apache.org/S2PLUGINS/tiles-plugin.html ? Struts 2 is intentionally mostly ignorant of Tiles, except for the plugin, so something like per-package tiles defs would involve writing your own code, perhaps a custom subclass of the TilesResult. However, if you just want to spread out your config among multiple files (which I like to do), you just need to specify a context parameter like this: context-param param-nameorg.apache.tiles.DEFINITIONS_CONFIG/param-name param-value /config/tiles/common.xml, /config/tiles/create.xml, /config/tiles/library.xml, /config/tiles/profile.xml, /config/tiles/login.xml /param-value /context-param While I think Tiles 2 is probably reasonably close to a release, it is still under development, and documentation is one thing that is needed. (Contributions are always welcome...) It doesn't have much traffic yet, but there is now a tiles user mailing list -- see http://tiles.apache.org/mail-lists.html In the mean time, remember that it hasn't been released, so if you plan to use it, you should probably subscribe to the [EMAIL PROTECTED] mailing list to keep up with status and changes. Joe On 1/29/07, Gonçalo Luiz [EMAIL PROTECTED] wrote: Hello, I'm developing a web application using struts2. I'm a struts1 developer and now I'm migrating myself (not a specific app) to struts2. The documentation is very good so I managed to setup struts and run a few actions. The problem I found was in what it regards to Tiles. Despite the documentation refers the web.xml (the interceptor and configuration file) and struts.xml (return types) it does not show a tiles-configuration.xml example. I was used to have a tiles-configuration.xml for each subapplication (STRUTS2's namespace) and now it seems that there can be only one. I'm good with that, but I'd like to know the tiles-configuration.xml format. So, what I'd like to know is: 1 - is there any way to specify multiple tiles-configuration.xmlfiles? 2 - is there any way to associate a different tiles-configuration.xml file to each package 3 - is there an example of a tiles-configuration.xml usage
Re: Example of a working tiles-config.xml
Gonçalo: You and others trying to explore Tiles 2 may want to check out the examples from the SVN repository: http://svn.apache.org/repos/asf/tiles/examples/trunk/ Again, I want to point out that people who plan to use Tiles 2 really ought to subscribe to the tiles-dev mailing list. This is always advised when using unreleased open source software. Besides, now that Tiles is its own TLP (Apache top level project), all general Tiles discussion should start moving to the Tiles mailing lists except when dealing with specific Struts integration issues. The specifics for Struts integration are really about as simple as depending upon the struts-tiles-plugin and making sure that a TilesResult is defined, which is most easily done by having your package extend tiles-default. Obviously it will take some time for the Tiles mailing lists to have a good critical mass of users, but if we only discuss Tiles on the Struts list, it will take longer ! ;-) Joe On 1/29/07, Gonçalo Luiz [EMAIL PROTECTED] wrote: Hello comunity, After a couple of hours searching for a working example of tiles2 config file that actually works with struts2 I decided to ask on the mailing list if anyone actually got tiles2 working with struts2. I now that some elements changed from tiles1 but I'd prefer to customize a given example than build a tiles-config.xml from the dtd. Isn't there any working example of tiles2? Best regards, -- Gonçalo Luiz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [s2] Cannot create a session after the response has been committed: struts or tomcat ?
On 1/29/07, Tom Schneider [EMAIL PROTECTED] wrote: Does this http://jira.opensymphony.com/browse/WW-291 have anything to do with this? I don't think so, although I'm just reading that ticket for the first time and haven't encountered this bug. In short, it looks like the DebuggingInterceptor always assumes that a session exists, when in Bob's case, the session has not been created. The easy work around would be to disable the debugging -- turn off devMode, don't pass the debug param with a value of console, or define an interceptor stack for your actions that doesn't use the DebuggingInterceptor. I'm not sure that the Struts2/Webwork API provides a clean conceptual way to know that it's not safe to write to the session, and I'm not sure what the DebuggingInterceptor is trying to do in putting something in the session. (It looks like that operation has moved to line 210 in SVN Head -- at least, there's only one call to SessionMap.put that I can find. (ll 208-211: if (devMode consoleEnabled) { final ActionContext ctx = ActionContext.getContext(); ctx.getSession().put(SESSION_KEY, ctx.get( ActionContext.VALUE_STACK)); } ) As you said, it will appear to work because this is happening probably after everything else has already been invoked. I haven't spent much time with the debug facilities, so I can't offer much more of a suggestion as to how this should be fixed, but it probably deserves to be filed as a bug. Joe java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession( Request.java :2214) at org.apache.catalina.connector.Request.getSession(Request.java :2024) at org.apache.catalina.connector.RequestFacade.getSession( RequestFacade.java:831) at javax.servlet.http.HttpServletRequestWrapper.getSession( HttpServletRequestWrapper.java:215) at org.apache.struts2.dispatcher.SessionMap.put(SessionMap.java :172) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept( DebuggingInterceptor.java:178) -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Struts 2.0 vs Struts 1.3.5 vs Struts 1.2
Struts 1.3.5 is intended to be essentially backwards compatible with 1.2.x; information on the details is here: http://wiki.apache.org/struts/StrutsUpgradeNotes12to13 Struts 2 is substantially different. I would not expect a Struts 1 developer to implement a project on the same time frame if it also included learning to switch to Struts 2. Joe On 1/26/07, Chetan Pandey [EMAIL PROTECTED] wrote: Hi All: We have been using Struts 1.2 for many months in our company. Now we have a fresh project and some of us are confused whether we should use Struts 1.3.5 or Struts 2.0 or just continue with 1.2 as we have been doing for the past few months. I have gone through the Struts Docs and their arguments for one or the Other have left me still unclear. Our new project will be for one programmer with Time Period of 1.5 Months. It will be using a lot of Ajax. Will Learning Curve be too steep for 2.0. Incase of choice between 1.2. and 1.3.5 how do I convince them that we should go with 1.3.5. How is it better than 1.2 Thanks. Chetan _ CHETAN PANDEY Executive - Technology Services BLUE, 1 Maritime Square, #13-02 Harbourfront Centre, Singapore 099253 DID +65-6212-0863 main line +65-6333-3336 fax +65 6336-6334 email mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] http://www.bluesingapore.com/ www.BLUEsingapore.com _ BEIJING SHANGHAI LONDON TOKYO PALO ALTO SINGAPORE CONFIDENTIALITY STATEMENT: This email and its attachment(s) contain Privileged/Confidential information. If you are not the intended recipient, the distribution, use or replication of the information in this email is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email, then delete this email and any attached documents. Any opinions, conclusions or views expressed in this email are those of the individual sender, except where he/she -- expressly and with authority -- states them to be the views of BLUE. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Creating an instance of an action a class
On 1/26/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Frank, Frank W. Zammetti wrote: There is no special status for an Action beyond that though, no values set on it by Struts, that sort of thing. Just instantiate and execute as you would any other class. I feel obliged to point out, though, that if you have a lot of behavior in your actions such that this is an initially attractive solution, you may want to reassess your architecture and possibly refactor. Should you set up an inheritance tree of actions? Should you factor some of that logic out into classes which aren't even dependent upon Struts? I always aim to keep my actions light weight, mostly responsible for managing the translation between HTTP request parameters (fundamentally Strings) and the application object model (either other primitives converted from the strings, or model objects looked up based on the parameter values, etc), and session management. This helps write code that is more easily unit tested, and also plays much better with the overall ecosystem we find ourselves developing in now that we use Spring and Hibernate extensively. Things like proper transaction management in Spring/Hibernate are pretty much predicated on limiting the behavior in your action and putting more of it behind one model method which can be marked with transaction semantics. It also lends itself better to mixed mode applications where you want the same basic code to handle both online (web) processes as well as offline (batch file processing, etc). Just something to keep in mind... Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Tiles 2 - problem with putList tag.
In doing some other work on the Tiles tags, I found some problems with how the PutListTag is implemented. I fixed these (SVN revision r495431 and r495722, see also http://svn.apache.org/viewvc/tiles/trunk/tiles-core/src/main/java/org/apache/tiles/taglib/PutListTag.java?view=log ) I didn't build a new snapshot, because these changes also involved changing the names of some of the tags and committers were not 100% united that the changes were correct. (see http://www.nabble.com/-Tiles2--JSTL-functions-for-Tiles-taglib--t2961079.html ) If you build from SVN and change some JSP tag names, you will probably be ok, although I am not a regular user of the PutList tag; I just found these issues while working on the rename and testing the changes. Questions about unreleased code like Tiles2 are generally better aimed at the struts-dev list (or, now, the recently created [EMAIL PROTECTED]). I'll stir things up over there and see if people are game for a new SNAPSHOT build based on those changes. Joe On 1/25/07, amboss [EMAIL PROTECTED] wrote: Hi, I have problem using putList tag on jsp page. Namely I`m trying to use definition that looks like this: definition name=tilestest.layout.list template=/listLayout.jsp putList name=testlist add value=listItem0 type=string/ add value=listItem1 type=string/ add value=listItem2 type=string/ /putList /definition On a page whose contains code: tiles:insertDefinition name=tilestest.layout.list tiles:putList name=testList tiles:add value=item_00 type=string/ tiles:add value=item_01 type=string/ tiles:add value=item_02 type=string/ tiles:add value=item_03 type=string/ tiles:add value=item_04 type=string/ /tiles:putList /tiles:insertDefinition Unfortunately this cause some problems which results in exception in jboss logs. org.apache.jasper.JasperException caused by: java.lang.NullPointerException org.apache.tiles.taglib.PutListTag.release(PutListTag.java:60) org.apache.jasper.runtime.TagHandlerPool.release(TagHandlerPool.java:146) Layout page looks like: tiles:importAttribute name=testlist/ ul c:forEach var=item items=${testlist} lic:out value=${item} //li /c:forEach /ul This problem occurs only when I`m trying to change values on the list in the jsp page. It works just fine when I`m using values form the definition in xml or I use my own ViewPreparer to change default values. Could you please help me with this issue? I`m using tiles2 snapshot on jboss-4.0.3SP1 with java 1.5.0_6 on Linux box. -- Best regards, Piotr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [s2] Struts Dependency Injection and EJB3 - support ? or how can i Do it?
While I have not used it, the Spring Framework provides strategies for defining Spring Beans which are EJB factories (or something like that.) Struts 2 works quite nicely using Spring as the Action Factory, which can take care of resolving all Action dependencies whether or not they are EJBs. See http://cwiki.apache.org/S2PLUGINS/spring-plugin.html for more on using Spring as your object factory and this Spring documentation on EJBs: http://www.springframework.org/docs/reference/ejb.html Hope that helps. Joe On 1/22/07, Paris Apostolopoulos [EMAIL PROTECTED] wrote: Hi again. Ian thank you for your reply. If I understood well, please pardon me...if it is wrong the following you said 1) implement your custom ejb3 annotations into struts ok I wonder the @EJB annotations are not going to work (I guess). I had a look @ some glassfish FAQ.. 2)Then implement Struts interceptors that are going to do the JNDI lookup?right? I have to admit I am bit confused My first attempt was to implement the classical ServiceLocator Pattern and stick it with delegates, though the pattern does not fit well with EJB3. Any hint from the Struts team ..is there any intention to implement that kind of support to Struts (Struts 2+ EJB3) integration? Or do you know any other extention project that is targeting this way..maybe we could contribute. At the moment this kind of problem does not make me fee confortable, I am a great Struts supporter(picked Struts as the web framework for our new j2ee web app) and its a pitty EJB3.0 is targeted towards either plain servlets or JSF for Dependency Injection etc etc. Any more hints if possible would be much appreciated! Thanks Stas Ostapenko wrote: Hi ! Ian, can you provide some kind of example source code to play with ? I'm interesting in Struts 2 and EJB 3 interoperability, but I can't figure out how to get started. Thanks ! On 1/22/07, Ian Roughley [EMAIL PROTECTED] wrote: Currently there is no EJB3 support in Struts, however I have done this on a couple of projects. I used a custom annotation to mark action setters as ejb3 then a custom interceptor that looks for the annotation, looks up the ejb3 and injects it into the action. Doing it this way is less than a days work. Another option would be to replace the ObjectFactory (the class that does the dependency injection) with a a custom implementation that does EJB3 dependency injection. /Ian -- From Down Around, Inc. Innovative IT Solutions Software Architecture * Design * Development ~ web: www.fdar.com email [EMAIL PROTECTED] phone:617.821.5430 ~ papo wrote: Hello I am trying to find a way of calling efficienlty from Struts Actions - SLSBs EJB3. I have made a question before. - Doing JNDI calls all the time through every action works though its a very primitive way of doing it. -Tried to implement the Service locator pattern though the semantics on EJB3 are different (how to cache Intefaces, which interfaces) I know tha EJB3 on the web layer Serlvets/ JSF supports Dependency Injection for EJB3. Will Struts 2.0 support such a feature if NOT can anyone point me the mechanics so to (try) doing it on my own. I am bit stuck for days at this very point of efficiently glue-ing Struts and my EJB3 Business layer Any hint would be much appreciated! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: combining chain of commands with struts action
It is unlikely that you need to use the ChainListener in a Struts 1.3.xapplication. First, you can have the ActionServlet instantiate all of your command catalogs by specifying the servlet init parameter chainConfig with a comma-separated list of classpath or servlet resources. Remember that if you manually provide this property, you must be sure to include the default Struts chain (org/apache/struts/chain/chain-config.xml) or one which establishes an alternate processing chain, in addition to any of your own which are used purely for per-request custom mappings. Once you've done that, you can use the catalog and command attributes of an action to cause Struts to invoke that command for a request instead of, or in addition to an action. (The command will be executed first if you specify both a command and a type.) You can count on your commands used in an action mapping being invoked with a Context which is actually a subclass of ActionContext and use that to access the request/response/mapping/form and the like which would be passed in to an Action's execute method. Please note that I don't think a whole lot of people have been using this feature, so you may well find bugs or even simply find that it could use some refinements. But this is the basic overview of how it's supposed to work. I hope this helps. Joe On 1/19/07, manunixx [EMAIL PROTECTED] wrote: hallo guys! I spent a lot of time trying to retrive a catalog from a struts action but i didn't get results! :( Following the guidelines found in the jakarta commonsChain, I did this: defining a catalog.xml catalog.../catalog adding a ChainListener to web.xml defining a parameter org.apache.commons.chain.CONFIG_CLASS_RESOURCE to tell the listener where to locate the catalog.xml trying to retrive the catalog parsed from an action by doing: Catalog catalog = CatalogFactory.getInstance().getCatalog(); // this return null Question: do I have to config a CatalogFactory before? can anyone suggest me any reference or updated documentation regarding struts action and common chain? I saw that action mapping in struts-config.xml do accepts parameters catalog and command. Do I have to use these to interact with commands? Please halp me, I'm getting Nuts! Emanuele. -- View this message in context: http://www.nabble.com/combining-chain-of-commands-with-struts-action-tf3039447.html#a8447680 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: combining chain of commands with struts action
On 1/19/07, manunixx [EMAIL PROTECTED] wrote: i find this pattern very useful for dividing problems in little pieces to be combined. I'm quite surprise that no many people release on that. what do you think about it?! I'm glad you like it! I think the issue is just that adoption of Struts 1.3.x is probably relatively low -- it hasn't even been six months since we voted 1.3.5 to General Availability. Keep using it, keep talking about it -- people will hear you and say maybe I should check that out... Joe Emanuele. -- View this message in context: http://www.nabble.com/combining-chain-of-commands-with-struts-action-tf3039447.html#a8451273 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
[S2] question about controlling display with css_xhtml theme and errors
So, I'm working on my first S2 application and enjoying a lot of the things which always looked pretty cool about WebWork. However, I'm doing client side validation with s:form and the css_xhtml theme, and there's something I want to change. Given my design, the insertion of error messages at the top of the control looks awful. I want the messages at the bottom. What is the best way to take control of this? I'm no CSS whiz, but I don't think there's a way to do it just with CSS rules. Do I need to override the definition of the addError javascript method which actually puts the message in the HTML? That seems a lot harder than it should be. Do I need to tell the designers that they designed it wrong? ;-) Thanks in advance, Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [Struts 2] Database access
This example is for Struts 1.x, not Struts 2. Struts 2 provides no direct support for managing database connections, although one could achieve something like this rather readily using Spring, or probably with any other ObjectFactory. Here's a tutorial which gets much more involved than your basic request, but which might help. Note that since the tutorial uses Hibernate, it isn't exactly what you asked for, but it also demonstrates using Spring to instantiate a Datasource, and then you could have Spring also instantiate your Action Classes and inject the datasource dependency into them. http://cwiki.apache.org/S2WIKI/struts-2-spring-2-jpa-ajax.html Let me issue the standard disclaimer that if you are doing a lot of database work in your Action classes, you may want to consider refactoring anyway. Joe On 1/16/07, Philippe Le Gal [EMAIL PROTECTED] wrote: Hi, Thanks again. Is it possible that you give me the complete listing of this example because, I've problem to find how to initialize the 'context' object. Thanks Philippe Le mardi 16 janvier 2007 11:14, Stanislav a écrit: in java action class you can also connect through struts db mechanisam: DataSource dataSource = (DataSource) context.getAttribute(org.apache.struts.action.DATA_SOURCE); conn = dataSource.getConnection(); or direct to db Connection conn = DriverManager.getConnection (ConnectionURL,ConnectionUserName,ConnectionPass word); From: Philippe Le Gal [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: Re: [Struts 2] Database access Date: Tue, 16 Jan 2007 11:08:28 +0100 - Original Message Follows - Hi, Thanks for the information. I'm also looking for the mecanism of accessing the database in the java action class. Thanks Philippe Le mardi 16 janvier 2007 10:59, Stanislav a écrit : in struts-config for sql database. data-sources data-source type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClassName value=com.microsoft.jdbc.sqlserver.SQLServerDriver / set-property property=url value=jdbc:microsoft:sqlserver://xxx.xxx.xxx.xxx:1433;DatabaseName=xxx xx;S electMethod=Cursor / set-property property=username value=x / set-property property=password value=x / set-property property=maxActive value=0 / set-property property=maxWait value=5000 / set-property property=defaultAutoCommit value=false / set-property property=defaultReadOnly value=false / /data-source /data-sources From: Philippe Le Gal [EMAIL PROTECTED] To: user@struts.apache.org Subject: [Struts 2] Database access Date: Tue, 16 Jan 2007 10:53:12 +0100 - Original Message Follows - Hi, I'm looking for a simple struts 2 database access example. Thanks for any url Philippe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: [S2-ish] deploying exploded webapps with maven2 and cargo
On 1/12/07, Wendy Smoak [EMAIL PROTECTED] wrote: On 1/12/07, Joe Germuska [EMAIL PROTECTED] wrote: (I sent the below to the cargo users list, but haven't gotten a response in several days, so I'm going to be gauche and send it to struts; now that Struts2 uses Maven2, some Struts folks must be dealing with this [*cough* Wendy :-) ] If anyone has advice, it will be appreciated... ) You must have learned the secret-- I can't read all the mail I get, so I search for my name occasionally to see if anyone is calling me. :) duly noted! I'm slightly confused about what's going on, since you mention both an exploded webapp and remote deployment. I don't see how that would work. Maybe I'm confused; the combinations of values for type (container), type (configuration) and type (deployer) are not manifestly clear to me, which I think is a combination of unintuitive naming, overloading the concept of type, and my laziness in not wanting to spend time developing a deep understanding of the Cargo architecture. I thought remote was the way that you did things if you had an already running Tomcat instance. That's how we used the Codeczar plugin, so I was trying to maintain the analog. Perhaps I should switch to trying to have the plugin start Tomcat. When we used Tomcat with Maven 1 this way it resulted in a fat memory-hogging Maven process hanging around not achieving much, so I steered away from that and wasn't enthusiastic Best bet would be to construct a simple example app, maybe start with the Struts blank archetype and add the Cargo config, and post back to the Cargo list with a link to it. I'll probably give this a shot when time allows, which is not just right now... Thanks again Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Failed build of svn HEAD on Mac OS X
This should be fixed now in the snapshot build of struts-annotations on the Apache Snapshot repository. The tools.jar dependency was misconfigured; this Maven documentation explains how to set it up so that it is not attempted for Mac OS X: http://maven.apache.org/general.html#tools-jar-dependency This is the solution which was used and it seems to be working. You shouldn't need to change the pom.xml file, or we are doing things wrong. Joe On 1/14/07, Christian Stone [EMAIL PROTECTED] wrote: I actually just tackled this very problem. OS X java configuration renames and repackages the tools.jar into classes.jar. I fixed the mvn pom file for this consideration. I have a detailed description on what I did to fix this (and the out of memory error that you will encounter next) on my blog: Building Struts 2 on Mac OS X with Maven using mvn install http://stonescape.net/roller/xtian/?cat=Javadate=20070113 Hope this helps! Christian Stone - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
[S2-ish] deploying exploded webapps with maven2 and cargo
(I sent the below to the cargo users list, but haven't gotten a response in several days, so I'm going to be gauche and send it to struts; now that Struts2 uses Maven2, some Struts folks must be dealing with this [*cough* Wendy :-) ] If anyone has advice, it will be appreciated... ) I'm exploring the possibility of moving my webapp development team from using Maven1 to Maven2 and one of the major practices we've developed has to do with deploying our work in progress to a locally running Tomcat instance. In the interest of not changing too many things at once, I'm hoping to figure out how to use Cargo to do what we've previously had great success achieving with the CodeCzar plugin. I have found examples from various folks online indicating success with this, but I am hitting a roadblock when I try to run exploded. Everything seems to be fairly functional (if not quite straightforward!) when I run from the WAR, but when I follow instructions from this post (http://www.nabble.com/-mvnreloadable-webapps-t2762768.html#a7715823 ) and add a location element to my deployable, I get the following FileNotFound error java.io.FileNotFoundException: /Users/germuska/Development/myriad/webapp-customization/target/webapp- customization-1.0-SNAPSHOT (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.init(FileInputStream.java:106) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatDeployer.deploy( AbstractTomcatDeployer.java:115) When I copy the not-found path and execute the following, I get something: % ls -lad /Users/germuska/Development/myriad/webapp-customization/target/webapp- customization-1.0-SNAPSHOT drwxr-xr-x 20 germuska admin 680 Jan 8 13:29 /Users/germuska/Development/myriad/webapp-customization/target/webapp- customization-1.0-SNAPSHOT Any suggestions on how to dig more deeply on this? Below is the cargo section of my effective POM. One thing which seems a little odd is that the location element is only partially interpolated, although as seen in the error message, it ends up fully interpolated by that point. So I don't know if that is of any import or not. plugin groupIdorg.codehaus.cargo/groupId artifactIdcargo-maven2-plugin/artifactId configuration container containerIdtomcat5x/containerId home/opt/tomcat/home typeremote/type /container configuration typeruntime/type properties cargo.remote.username*/cargo.remote.username cargo.remote.password*/cargo.remote.password cargo.servlet.port9000/cargo.servlet.port /properties /configuration deployer typeremote/type deployables deployable location${project.build.directory}/webapp- customization-1.0-SNAPSHOT/location properties contextcustomization/context /properties /deployable /deployables /deployer /configuration /plugin Thanks in advance... Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: Failed build of svn HEAD on Mac OS X
This was actually just fixed in an obscure side dependency, struts-annotations (https://issues.apache.org/struts/browse/WW-1392) I haven't deployed snapshots to the Apache repo since Struts moved to M2; I'll give that a crack right now, but if you need to, you could check out http://svn.apache.org/repos/asf/struts/maven/trunk/struts-annotations/ and do mvn install and that should do it... (in general, discussion of unreleased versions of struts is targeted at the dev list, but it's not a big deal...) Joe On 1/12/07, Eric Rank [EMAIL PROTECTED] wrote: Greetings, I don't know if this is the best place to post this, so let me know if this question is out of scope. I recently attempted building the latest snapshot of Struts 2 (rev 495680) on Mac OS X and I get this error when building with Maven. = Missing: -- 1) com.sun:tools:jar:1.5.0 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=com.sun -DartifactId=tools \ -Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) org.apache.struts:struts2-core:jar:2.0.3-SNAPSHOT 2) org.apache.struts:struts-annotations:jar:1.0-SNAPSHOT 3) com.sun:tools:jar:1.5.0 == It seems to me that there's a dependency of the tools.jar library. That'd be fine, but I'm trying to build this on a Mac, where tools.jar doesn't exist. ( http://developer.apple.com/documentation/Java/Conceptual/ Java14Development/02-JavaDevTools/JavaDevTools.html#//apple_ref/doc/ uid/TP40001884-208117 ) Am I missing something? or did I stumble upon a real problem? Also, for what it's worth, building the revision tagged as 2.0.2 works fine. Thanks, Eric Rank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso
Re: FRIDAY #2 non-MVC pages
When building a struts application, is it a good idea to base everything on actions? For instance, let's say I'm writing an 'About Us' page or 'Terms Of Service'... Should I build an action to handle them, or just write the JSP. My assumption is that it would be pedantic to have struts handle it, but I just want to make sure that there isn't some reason I don't see that I should struts-ify every page/action. In general, I advise using actions for everything, because you never know when you might need to intervene in the handling. It is a little tedious to have to deploy a new struts-config.xml for every new page; some judicious work with the wildcard based forwarding can eliminate a lot of that - set something up that automatically forwards to a JSP or a Tile based on the pattern match. Especially if you are exposing URLs that might get bookmarked, you don't want to have to change them later. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Spring 2.0 - should I use Struts 1.2.9, 1.3.5, or 2.0?
I have not spent much time with Spring 2.0, but I doubt that the issues at hand are substantially different than with Spring 1.x. Struts 1.3.x is backwards compatible with Struts 1.2.x in most important ways (there's a Wiki page detailing issues.) However, depending on what parts of Spring's struts-integration libraries you use, you may find that certain Struts 1.3 features are not available or do not behave as expected. Specifically, Spring 1.x provides a custom implementation of the Struts Request Processor. You can use Struts and Spring together without using it, but if you choose to use it, you must understand the issues I'm going to try to explain here. Struts 1.3 attempted a substantial refactoring of request processing so that custom functionality would be more easily integrated without running into the limitations of Java single-inheritance. People found that they wanted behavior that was implemented in two different custom Request Processors (usually the TilesRequestProcessor and something else) and had to wrestle with how to achieve that. Those of us who wanted to write reusable extensions to the request processing cycle had to consider extending both the TilesRequestProcessor and the base RequestProcessor, and if someone wanted to put in even more customizations, this quickly becomes totally unworkable. If you use Spring's custom request processors in Struts 1.3.x, you will lose some new functionality which is only implemented in commands which are part of the new ComposableRequestProcessor's command chain. This mostly has to do with other uses of the commons-chain integration (like per-action and per-forward command execution), but also a little bit with the exception handling, where Struts now handles exceptions a little better when they occur in the midst of tiles. Struts 2.0 doesn't even use the same RequestProcessor, and I'm sure that the Spring folks haven't tried to write integration code with either Struts 1.3.x or Struts 2.0 since they've only recently seen full releases. Joe At 9:20 AM -0500 10/5/06, Bruno Melloni wrote: I decided to use Spring 2.0 with Struts for my next project. But I can't find info on the highest version of Struts that I can use with it. This is what I found: - Spring 2.0 comes with some parts of Struts 1.2.9, so it would be the safe bet. - The latest Struts 1.x is 1.3.5. It seems to have done significant repackaging, but I am not clear whether it is supposed to be backward compatible to 1.2.9 or not. - Struts 2.0 is out, but from what I read it is quite different from 1.x, and makes me doubt that it would be compatible with something that was built for 1.2.9. I also heard that it still has a few bugs... normal for a software version .0. Can someone bring some light into this darkness? --- On a separate but related question... RAD 6 comes with Struts 1.1 (hopelessly outdated). Can it be upgraded to a more recent Struts version? If yes, it is probably documented somewhere, could you point me to the docs? Of course, it might be something as simple as including the desired version of struts in the WEB-INF/lib folder and ignoring the version that came with RAD 6. Thanks. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Spring 2.0 - should I use Struts 1.2.9, 1.3.5, or 2.0?
At 11:16 AM -0500 10/5/06, Paul Benedict wrote: I use Spring 2.0 with Struts 1.3.5, and employ the legacy RequestProcessor because Spring supports auto-wiring action classes with it. That's an invaluable feature to me. So, then (as expected), Paul's experience demonstrates that it works -- the point is mostly that whatever future changes happen in Struts 1.3, you can expect that gradually some things may be documented as working which wouldn't work in this case. We can certainly try to point out those cases, but the goal is for the request processor to be invisible to most users, so it will be a challenge to balance clarity with completeness. (Isn't it always ;-) ) Also note that it is entirely possible to set up custom commands and introduce them into the Struts 1.3.x request processing chain that do what the Spring autowiring request processor does. It's a little more awkward than I'd like to add in custom commands, but we have done it on a half-dozen apps already. We probably won't add that Spring integration code to Struts 1.3.x since we don't otherwise have a Spring dependency. I don't know if the Spring team has given any consideration to adding it to the Spring distribution now that we've made a GA release. But I'd personally be happy to respond to questions about it as much as I see them. (My bandwidth for monitoring the Struts lists has been unfortunately low for a few months, but I try to at least scan subject lines...) Joe Paul Bruno Melloni wrote: I decided to use Spring 2.0 with Struts for my next project. But I can't find info on the highest version of Struts that I can use with it. This is what I found: - Spring 2.0 comes with some parts of Struts 1.2.9, so it would be the safe bet. - The latest Struts 1.x is 1.3.5. It seems to have done significant repackaging, but I am not clear whether it is supposed to be backward compatible to 1.2.9 or not. - Struts 2.0 is out, but from what I read it is quite different from 1.x, and makes me doubt that it would be compatible with something that was built for 1.2.9. I also heard that it still has a few bugs... normal for a software version .0. Can someone bring some light into this darkness? --- On a separate but related question... RAD 6 comes with Struts 1.1 (hopelessly outdated). Can it be upgraded to a more recent Struts version? If yes, it is probably documented somewhere, could you point me to the docs? Of course, it might be something as simple as including the desired version of struts in the WEB-INF/lib folder and ignoring the version that came with RAD 6. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1.3 set-property key
At 1:45 AM -0700 8/20/06, Paul Benedict wrote: The key attribute of set-property reads: Since Struts 1.3, an alternate syntax is supported. By using the key attribute instead of the property attribute, you can set arbitrary string properties on the Config object which is populated based on the containing element. NOTE: the key attribute is NOT supported for set-property inside a plug-in element. I might be glossing over a difference here, but how is this alternative syntax better or different than the property attribute? It highlights the arbitrary string properties feature, but I don't have problems with property for the same thing. This is not simply alternative syntax. It is an alternative method for handling configuration. Before arbitrary string properties, one was obliged to subclass the config object and add JavaBean properties with setters and getters. This led to a fair amount of boring code and configuration, including trivial subclasses, extra lines in struts-config.xml to specify the config object subclass, casts in Action classes when trying to read these values... The addition of a properties object to all of the config objects reduces all of that clutter. It also makes it more plausible, in my mind, to have Struts itself accept configuration with a little less commitment - for example, the ComposableRequestProcessor allows for an alternative implementation of ActionContext to be specified using an arbitrary property (ACTION_CONTEXT_CLASS). Since this area is still possibly subject to change/improvement, I find this more palatable than changing the ControllerConfig class and the DTD to have this provided as a bean property of ControllerConfig. Hope that helps to clarify things a little bit. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1.3 set-property key
At 9:59 AM -0700 8/20/06, Paul Benedict wrote: So it's just a map of properties? yep. So I guess you lose type conversion, if you were using non-string bean properties in subclasses of the config objects. Otherwise, I think it simplifies things considerably. Joe Joe Germuska [EMAIL PROTECTED] wrote: At 1:45 AM -0700 8/20/06, Paul Benedict wrote: The key attribute of set-property reads: Since Struts 1.3, an alternate syntax is supported. By using the key attribute instead of the property attribute, you can set arbitrary string properties on the Config object which is populated based on the containing element. NOTE: the key attribute is NOT supported for inside a element. I might be glossing over a difference here, but how is this alternative syntax better or different than the property attribute? It highlights the arbitrary string properties feature, but I don't have problems with property for the same thing. This is not simply alternative syntax. It is an alternative method for handling configuration. Before arbitrary string properties, one was obliged to subclass the config object and add JavaBean properties with setters and getters. This led to a fair amount of boring code and configuration, including trivial subclasses, extra lines in struts-config.xml to specify the config object subclass, casts in Action classes when trying to read these values... The addition of a properties object to all of the config objects reduces all of that clutter. It also makes it more plausible, in my mind, to have Struts itself accept configuration with a little less commitment - for example, the ComposableRequestProcessor allows for an alternative implementation of ActionContext to be specified using an arbitrary property (ACTION_CONTEXT_CLASS). Since this area is still possibly subject to change/improvement, I find this more palatable than changing the ControllerConfig class and the DTD to have this provided as a bean property of ControllerConfig. Hope that helps to clarify things a little bit. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - Stay in the know. Pulse on the new Yahoo.com. Check it out. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: writing my own chain command in 1.3.5?
At 10:24 PM +0100 7/19/06, Adam Hardy wrote: I'm trying to set up a new app using 1.3.5 and I am going to set up the process-view chain to do some view logic, if possible. Please could someone in-the-know check these steps to configure 1.3.5: *snip* This sounds exactly right. * write a bespoke command to do the view logic, extending ActionCommand.java (is that correct?) and reference it in the chain-config.xml in the 'process-view' chain You don't *have* to extend ActionCommand, but by doing so you save yourself the trouble of casting the Context to an ActionContext. By the way, the 'servlet-exception' chain from struts-core has only 2 commands: ExceptionHandler, PerformForward. But the chain from struts-tiles.jar has 4: ExceptionHandler, ExecuteForwardCommand, TilesPreProcessor, PerformForward. Is that 'ExecuteForwardCommand' tiles specific? hm. No, ExecuteForwardCommand is not tiles specific. I can't think of any reason off-hand for the inconsistency, except for error. applying per-forward commands is something new that not many people have begun using, so I can imagine that no one has contemplated whether they should or should not be supported automatically on exception-handling commands or not. In general, I don't see why not, except that one wants to keep exception handling processes as simple as possible to minimize the risk of a secondary error derailing the handling of the original error. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com The truth is that we learned from João forever to be out of tune. -- Caetano Veloso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Poll: What part of a Struts will be the most important to support for migration?
At 5:18 PM -0400 6/12/06, Ted Husted wrote: In the field, it seems like that once a Struts application hits production, it continues to use the same version. A new application might use 1.2, but the old ones continue to plug along on 1.1. If it ain't broke, why fix it? This is definitely not true in my shop. We usually find it very constraining when going back to an older app and adding new features if we can't bring the app up to modern practices. Our environment may be somewhat unusual, in that our sales people often sell small enhancements to existing projects, and they often sell the same thing we just implemented in a new app to a client whose project is 3 years and two versions of Struts old. Also, we find it pretty cumbersome to mentally switch between what can and can't be done between different versions of apps (this isn't only Struts changes, but also catching up with servlet, JSP, and JSTL evolution.) Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: Extending Struts with Spring
At 9:14 AM +0200 6/8/06, Julian Tillmann wrote: Thank you for your replies! When I understand this right: - Giving Actions a state using Spring makes no sence Not so much makes no sense as doesn't get you anything. At least, once you are used to writing threadsafe actions, you don't see as much value. The value of request-scoped, stateful actions comes with a design like that used in WebWork and Struts 2.0, where the request parameters are used to populate properties of the Action itself, instead of being wrapped in an ActionForm and passed in. - It cannot be recommended to overwrite the request processor with Spring (we already have our own) This isn't quite true either. If you're using Struts 1.2.x and Spring, there's no reason not to use Spring's DelegatingRequestProcessor or DelegatingTilesRequestProcessor -- especially since they set you up to use the IOC (see below). The issue is only if you are using Struts 1.3 (or Struts 1.2.x with the struts-chain library) -- in this case, since you can only have one RequestProcessor, using Spring's will interfere with using the one which uses the Chain-of-Responsibility for handling the request. However, if you look at what the DelegatingRequestProcessor does (remember, this is open source!), it's not hard to write your own replacement for the SelectAction command that provides equivalent functionality. - But the spring Context offers some new possibilites like IOC but to be honest I'm not expert enough to understand this up to date! This is the Spring feature that I appreciate the most. Before we started using Spring, it was always awkward to make sure that your Action classes had references to business support and persistence manager classes. While there are plenty of solutions, all of them looked clumsy after we saw how we could use Spring to inject those dependencies into the action classes directly. Thanks I watched this example of IBM with the interceptor. Which other business-cases (aspects) could you reasonable use this way? Isn't this a performance problem, because interceptors always have to use refelection? Reflection performance has been markedly improved since earlier editions of the JVM. Struts already uses it all over the place (specifically for ActionForm population on every request, plus a lot of stuff at initialization time.) Do you have an application which needs extremely careful performance tuning? Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extending Struts with Spring
At 2:05 PM +0200 6/7/06, Julian Tillmann wrote: Hello, I've read that you can use Spring to make your Struts Actions thread safe. Is someone using this or has experience with it? Wendy gave you the right pointer. Note that the Spring custom RequestProcessor which is part of the strategy pointed out in the article Wendy referenced is not really good to use with Struts 1.3, because it doesn't use the chain of commands, and so some Struts 1.3 functionality would not be available. However, also note that with Struts 1.3 you could also just change the behavior of the CreateAction class so that it doesn't cache actions, but instead instantiates them anew for each request. In fact, if there were much interest at all, it would be easy make this a configurable option in the Struts core. (Alas, the way chain configs work, actually configuring it is a tiny bit more work than it should be, but not all that bad, and we could probably think of some other ways to express your intention without requiring a custom chain-config.xml -- perhaps a property on ActionMapping and/or a default setting?) Are there other arguments for using Spring with Struts like, for example an easy implemented Interceptor that might improve the application and is not as easily achieved with a filter? Totally aside from managing the instantiation of Action classes, it's extremely valuable as a mechanism for externalizing business services so that your controller code can be as light as possible. We've simply found that it makes using best practices a lot easier. We used to use Struts PlugIns, which are a functional way to initialize business services for actions to call up, but Spring can provide the same sort of model scaffolding much more cleanly. With a little study of Spring's advanced application configuration mechanisms (with layered application contexts and such), you can design your application so that you have a core of Spring config that is just as easily used by offline, non-webapp processes as it is used in the webapp; this was a real revelation to us for writing things like offline batch processes, where we used to struggle to maintain equivalent application configurations in the webapp and outside. I should try to write a HOWTO about this, but I don't really feel that expert about it. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: displaying ActionMessages.GLOBAL_MESSAGE messages only
At 12:47 PM -0700 6/7/06, Chris Cheshire wrote: In my actions I have messages stored in the session either under ActionMessages.GLOBAL_MESSAGE, or my own key (eg 'search'). In my jsp I have a section to display the search specific messages. logic:messagesPresent message=true property=search /logic:messagesPresent I also need to display the global messages at the top of the page, however this displays everything, including the search messages: logic:messagesPresent message=true ... /logic:messagesPresent What do I set for the property to ONLY display the messages keyed by ActionMessages.GLOBAL_MESSAGE? technically, you would use logic:messagesPresent message=true property=org.apache.struts.action.GLOBAL_MESSAGE /logic:messagesPresent It has been observed that this is kind of cumbersome. A nice enhancement (that just about any willing volunteer could do, hint hint :-) ) would be to enhance the logic:messagesPresent, logic:messagesNotPresent, and html:messages and html:errors tags to have another attribute, global which if it had the valuetrue would save you from needing to know that verbose property name. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: displaying ActionMessages.GLOBAL_MESSAGE messages only
Is ActionMessages.GLOBAL_MESSAGE going to be deprecated? I use org.apache.struts.Globals.MESSAGE_KEY instead. No! Read the javadoc -- that constant is not used for the purpose of locating messages added to an ActionMessages object with no defined property. Instead, it's used to locate an ActionMessages object in request or session scope whose contents are of message priority for user display (as opposed to errors, warnings, or any other arbitrary grouping.) http://struts.apache.org/struts-action/struts-core/apidocs/org/apache/struts/Globals.html#MESSAGE_KEY At 5:32 PM -0400 6/7/06, Adam Samere wrote: I agree that scriptlets are undesirable, but IMHO when compared with the consequences of having to track down and modify the key in every page that referenced it directly it's the lesser of two evils. So the goal of the new attribute on the tags would be to display/test for only messages stored under the globals key? Which takes precedence then, name/property or global? good question. I'd probably give global precedence, but really, as long as it's documented, I don't think it matters. There's also the matter of describing what [globals=false] means -- I'd ignore it, but some might argue that it should throw an exception, or might argue that the mere question suggests that a different syntax is in order. me, I just think someone who's been thinking about trying to contribute to Struts ought to take this one and run with it :-) Joe Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog
Re: Action Mapping
At 3:00 PM -0700 6/6/06, James Bost wrote: I am working on URL cleaning in my struts web application. How can I create a custom ActionMapper and how to use it? If you're talking about Struts 1.x, there's no ActionMapper class, and ActionMapping is more like a configuration object than a piece of logic. Still, in Struts 1.3.x, you could radically alter the way a specific action for invocation is selected simply by replacing the SelectAction command in the chain of commands used by the composable request processor. this URL may help a little, if you haven't looked into this a lot: http://struts.apache.org/struts-action/userGuide/building_controller.html#request_processor here's a little about how you actually change where Struts looks for a chain-config XML file (since you'd have to copy the one in the distribution and edit it if you want to change any of the steps in the chain.) http://struts.apache.org/struts-action/userGuide/configuration.html#dd_config_servlet Is this the direction you were looking to go? Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules menus
At 3:50 PM -0400 5/30/06, Brian Long wrote: Hi folks - appreciate any input on this one: I have a menu in a Struts 1.2.9 modularized app. The menu has links to some jsps and some actions. When the app is launched, the links all work. However, once I've navigated into a module, the links all get prefixed with that module, and the links don't work any more. Do I have to use a separate menu for each module? You have to specify that you want the links interpreted relative to a different module, using the module attribute of html:link http://struts.apache.org/struts-action/struts-taglib/tlddoc/html/link.html The default behavior is to assume that links are within a module, so when you want to do other than that, you need to be explicit. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using modules with JSPs behind WEB-INF
At 1:58 PM -0500 5/16/06, David Durham wrote: Berk, Jason R. wrote: I'm using struts 1.2.9 which the struts site claims is the prime time ready version. I would like to use modules and put my JSPs behind WEB-INF to protect them. When I try this with struts, it rewrites my URL with the module name and causes 404 errors on validation failures. I read all over the net that I need to change my forwardPattern pagePattern in my controller to /WEB-INF/$M$P, but again, the struts site docs explicitly state that anything other then $$, $M and $P are silently swallowed. Been trying to get this to work for almost two weeks now. Any help appreciated. The thing is that The Browser can not request /WEB-INF/..., but a RequestDispatcher will happily forward to /WEB-INF/... Does this answer your question? Also, note that you do not need to use modules to hide your pages behind WEB-INF, as David noted. Don't use them if that's all you want to do. You should only use them if you really need them. (I just found a handful of bugs in Struts 1.3 related to modules; modules are infrequently used by the Struts community, which I think will lead to your team being surprised by certain things as well as possibly having a hard time finding good support here with them.) Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SAF 1.3.x, chain naming and arbitrary chains
Default command for ControllerConfig seem to be hardcoded - Now the interesting part: these strings are never referenced anywhere. The command is initialized in ControllerConfig class: protected String command = servlet-standard; It has getter and setter, but setter does not seem to be called from anywhere. The ControllerConfig properties can be set by specifying attributes in the controller element in struts-config. This is ultimately handled by the config digester. (see http://struts.apache.org/struts-action/struts-core/xref/org/apache/struts/config/ConfigRuleSet.html#87) Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is Action Chaining Strongly Discouraged?
On 4/30/06, Caroline Jen [EMAIL PROTECTED] wrote: I have seen some discussions on this forum regarding action chaining. Primarily, the advices are to think through the business logic before making decision on chaining actions. What are the disadvantages of action chaining? Why action chaining is not a good practice? http://wiki.apache.org/struts/ActionChaining As noted in that page, ActionChaining is using Struts in a way which often works, but for which it was not specifically designed. It's possible that you might run into some odd situations where the assumption that a single HttpRequest results in only a single pass through the RequestProcessor causes something to go wrong. I usually just refactor my app when I find myself wanting to use action chaining, but many people just do it and find that it works. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is Action Chaining Strongly Discouraged?
At 5:10 PM -0700 4/30/06, David Evans wrote: below... On Sun, 2006-04-30 at 17:47 -0500, Joe Germuska wrote: On 4/30/06, Caroline Jen [EMAIL PROTECTED] wrote: I have seen some discussions on this forum regarding action chaining. Primarily, the advices are to think through the business logic before making decision on chaining actions. What are the disadvantages of action chaining? Why action chaining is not a good practice? http://wiki.apache.org/struts/ActionChaining As noted in that page, ActionChaining is using Struts in a way which often works, but for which it was not specifically designed. It's possible that you might run into some odd situations where the assumption that a single HttpRequest results in only a single pass through the RequestProcessor causes something to go wrong. I usually just refactor my app when I find myself wanting to use action chaining, but many people just do it and find that it works. Joe How do you handle the population of the contexts which are passed to the jsp to which you are forwarding? ... Is there a reason you don't use the two action (setup and submit) approach? The reason I don't is because I know that the original design of the RequestProcessor didn't expect there to be two passes through in a single request, so that it's possible (in theory) for some values to be in unexpected state. Having known that, i've just developed design strategies which don't require chaining. We use Tiles in every webapp we do, so I have often used Tiles Controller classes for view population; I've also designed a few strategies implemented with changes to the RequestProcessor (or with custom chain commands since struts-chain) -- but none of which I felt were clearly something which should be committed to Struts proper. I know for a fact that many people have used action chaining (and I have at times too) and it hasn't been a problem. I can't cite specific problems people have raised in the past that traced back to action chaining, but maybe there's something in the archives. So it's not so much that ActionChaining is considered harmful as it's understood to be potentially surprising. Hope that helps Joe I'm in the process of learning webwork and while i'm at it i'm trying to decide on best practices for action architecture. Webwork makes the two action thing even easier, because you can specify a method to call on an action class in the action mapping, so the setup and submit handling methods can exist in the same action class. or you can even specify the method to call on an action class in the url using the ! character, as in /customer!setup.action. You can achieve most of this with dispatch actions. -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MVC Dilemma
JSTL SQL calls don't conform to MVC principles in any way at all. I'd suggest creating a business manager service in Spring which has access to the two DAOs and having a Struts action call a single method on that business manager. This one sounds like read only, but if you have write operations, this allows you to use Spring's declarative transaction handling to integrate both databases into a single transaction. hope this helps... Joe At 4:09 PM -0500 4/6/06, olonga henry wrote: Using Struts-Spring-Hibernate: I have a situation where I have to fetch a list of records from a table 'Ticket' (in database 1) in which a column is a employeeId so my action class calls the service layer which in turns calls the DAO layer to get the Certain Tickets List. Now, there is another table 'Employee' (in database 2) which contains employeeId and employeeName columns. In order to display the list of tickets with the employee names (in place of the employee Ids), I could have done a join if both the tables were in one database, which I cannot do in this case. I can make JSTL SQL calls to database 2 - Employee table to find the names at the view layer. But I would like to know if there are better alternatives out there which confirm to MVC principles. Thanx -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Has anyone intregrated DWR with AJAX?
At 11:31 AM -0700 4/4/06, Ashish Kulkarni wrote: hi I have a website which is developed using struts, I am looking to convert some of it to AJAX and working on different approaches, In my current application, i have a common Action class which has all the common functions like getting the information stored in ServletContext, or Session or getting the connection from JNDI I am using Ibatis SQL mapping to run SQL querries, with SqlMapClient stored in ServletContext. What would be the best way to start converting to DWR, in DWR i can just define simple java beans (POJO). I can get access to servlet request, etc using WebContext ctx = WebContextFactory.get(); req = ctx.getHttpServletRequest(); This is what i am planning, using Action class and ActionForm to load initial data on jsp, and then use DWR to update information on this screen jsp after user does some funtions. Is this the right approach? Can i access this form bean (in request scope in java bean class) see http://getahead.ltd.uk/dwr/server/struts Personally, I don't think there's much point to trying to use Struts objects in your DWR code. As noted on that page, you may be just as well off refactoring your code to a more general model which can be used both by the action and by the object you expose remotely via DWR. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog
Open Source Motivations (Re: I Apologize)
At 5:30 PM +0200 3/29/06, Jonathan Revusky wrote: It has some clear implications too. No matter how you shake it, the two things were technical *competitors*. Normally, the Struts people should be about as happy to say that Webwork is better as to have a tooth pulled. So if they say it... Here you ascribe an outlook on things to the Struts people which assumes that your motivations are theirs. Frankly, this is inaccurate for me. I see open source software as cooperative, not competitive, even between projects. I think Niall's answer to the question why did Struts development stagnate is pretty much what I would say. I'm not doing this for bragging rights, and it's not the only thing I like to do in my spare time. I contribute when I can. If it helps anyone, that's great. As far as I can tell it hasn't hurt anyone. Also note that the WebWork team is supporting this merger process. As far as I know, none of them have vigorously objected, nor sworn to carry on WebWork under its own name, etc. So perhaps there is another group of developers whose motivations are not what you personally might guess they are. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Open Source Motivations (Re: I Apologize)
At 7:09 PM +0200 3/29/06, Jonathan Revusky wrote: Joe Germuska wrote: At 5:30 PM +0200 3/29/06, Jonathan Revusky wrote: It has some clear implications too. No matter how you shake it, the two things were technical *competitors*. Normally, the Struts people should be about as happy to say that Webwork is better as to have a tooth pulled. So if they say it... Here you ascribe an outlook on things to the Struts people which assumes that your motivations are theirs. Frankly, this is inaccurate for me. I see open source software as cooperative, not competitive, even between projects. LOL. Well, Joe, wouldn't a casual observer say that you are taking this position because your team lost the technical competition? Some might; some might not. Whether or not they said it wouldn't mean it was correct. Of course, you'd expect the losers to rationalize things saying it wasn't *really* a competition. No. You would expect this. I would not. So your assertion that it hasn't hurt anyone is quite debatable. By leveraging the extra placement and visibility advantages of ASF to promote an inferior body of work, you have been breathing the oxygen of an innovative project that really was doing the real work of pushing forward the state of the art. See, I am not doing any of these things. I'm just a person who has a job to do, and I choose to work with others to help me get this job done. Everything else you have written is your own window dressing on the situation. But if you think these guys like Patrick and Jason aren't ego-driven, surely you're kidding yourself. Just as you'd be kidding yourself if you think Craig, say, isn't extremely ego-driven. None of these people, as far as I can see, make the slightest attempt even to hide it. Frankly, I don't care what their motivations are. But, Joe, I think that, most poeple, in their heart of hearts, don't believe this kind of line. It's a bunch of politically correct drivel really. Get real. I just thought I should point out that for all of your self-assured declarations about how the world works, you are not necessarily right. You can try to speak for most people, but you don't speak for me. Really, Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Order of struts-config.xml
To: Struts Users Mailing List Subject: Re: Order of struts-config.xml Do the struts actions work? On 3/27/06, Gaurav Jain [EMAIL PROTECTED] wrote: I am experiencing Parse Error in my Tomcat for changed order of struts-config.xml. But my application is working fine. Its strange. Regards, Gaurav -Original Message- From: Dion Gillard [mailto:[EMAIL PROTECTED] Sent: Monday, March 27, 2006 6:14 PM To: Struts Users Mailing List Subject: Re: Order of struts-config.xml On 3/27/06, Gaurav Jain [EMAIL PROTECTED] wrote: Hi, The struts-config.xml file contains following sections:- 1. Form bean definition section 2. Global forward definition section 3. Action mapping definition section 4. Controller configuration section 5. Application Resources definition section What if we change the order of these sections? The action servlet should fail to load up. What effect it'll have on my application? It will be unavailable. Will it work? No. Gaurav Jain -- http://www.multitask.com.au/people/dion/ Chuck Norris sleeps with a night light. Not because Chuck Norris is afraid of the dark, but because the dark is afraid of Chuck Norris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://www.multitask.com.au/people/dion/ Chuck Norris sleeps with a night light. Not because Chuck Norris is afraid of the dark, but because the dark is afraid of Chuck Norris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically adding form beans in plugin
Eamonn: The plugin gets the specific ModuleConfig for the module in which the plugin element appears. If you want to perform a certain setup operation in several modules, then each of them should repeat the same plugin element (or as close to the same as is appropriate.) If you only put the plugin element in one struts-config.xml, then it will only be initialized once, for that specific module. I'm not totally sure I understood your question, but if I did, hopefully this helps. We developed a library once that does something like this where it reads from a database to set up a form object. Joe At 6:45 PM -0500 3/25/06, Eamonn O'Donnell wrote: Hi, I have multiple modules configured in my web application I want to in the init() method of my plugin 1. read a file with some info 2. find a particular ModConfig object corresponding to 1 of my modules 3. According to the info in the file create and add FormBeanConfig objects to that ModConfig object. I think my big problem would be in finding the correct ModConfig object? I know I am passed a ModConfig object in the init method but how can I access one that I want to manipulate? Any pointers appreciated Eamonn -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Developing and running Struts on Tomcat without an Internet Connection
At 9:37 AM -0600 3/17/06, [EMAIL PROTECTED] wrote: You are referring to the tab lib files which are hosted on jakarta.apache.org website. When you are connected to the internet it get resolved by your web server and the moment you unhook it The problem starts. Best practice is to download the same tab lib files (Tld) and copy them in any of the folder under Your web application once done change the path in your JSPs to load the tld file from your local path instead of jakarta.apache.org This is not true. Struts never retrieves TLD files from the internet. The fact that the URIs look like URLs is not important. TLD files are retrieved from the JAR in which they are packaged. On the other hand, Struts does (and commons-validator does) retrieve DTDs from the SYSTEM URL provided in a DOCTYPE declaration when doing validating parses of the various config XML files, IF there is no PUBLIC identifier, or if it doesn't recognize the public identifier. You can see exactly which PUBLIC identifiers Struts knows here: http://struts.apache.org/struts-action/xref/org/apache/struts/action/ActionServlet.html#259 For any DOCTYPE using one of these identifiers, Struts will retrieve the corresponding DTD from the classpath instead. Hope this clarifies things. If it turns out that struts-blank has bad public ids in its DOCTYPE, please file a bug to that effect. Joe -Original Message- From: Richard Yee [mailto:[EMAIL PROTECTED] Sent: Thursday, March 16, 2006 9:28 PM To: Struts Users Mailing List Subject: Developing and running Struts on Tomcat without an Internet Connection I know this is supposed to work, but I'm getting an error starting up my Struts 1.2.8 application on Tomcat 5.5.15 when I unplug my computer from the Internet. The stack trace is: java.net.UnknownHostException: jakarta.apache.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.Socket.connect(Socket.java:507) at java.net.Socket.connect(Socket.java:457) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) at sun.net.www.http.HttpClient.openServer(HttpClient.java:365) at sun.net.www.http.HttpClient.openServer(HttpClient.java:477) at sun.net.www.http.HttpClient.init(HttpClient.java:214) at sun.net.www.http.HttpClient.New(HttpClient.java:287) at sun.net.www.http.HttpClient.New(HttpClient.java:299) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC onnection.java:792) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne ction.java:744) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection .java:669) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:913) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrent Entity(XMLEntityManager.java:973) I'm using Java 1.5.0 I'm using the standard DOCTYPES from the struts_blank webapp Any help is appreciated. Thanks, Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog
Re: Developing and running Struts on Tomcat without an Internet Connection
At 1:34 PM +1000 3/17/06, Hey Nony Moose wrote: Richard Yee wrote: I know this is supposed to work, but I'm getting an error starting up my Struts 1.2.8 application on Tomcat 5.5.15 when I unplug my computer from the Internet. The stack trace is: java.net.UnknownHostException: jakarta.apache.org when i get these in this scenario i look for url references in xml, xsl, and dtd files in the assorted files and fetch the targetted file off the internet, put it locally and alter the url reference to point to the local file. this usually works, but there's probably a more elegant way out of it ... which i'm sure someone will post ... ? The problem in this case is that you have the wrong DOCTYPE declaration, If your XML files carry the correct PUBLIC identifier, then Struts will find the DTD for validation in the JAR. For Struts 1.2.x, that would be: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Filters with Struts?
At 8:23 AM +0100 3/10/06, starki78 wrote: Hi I made thoughts about filters (javax.servlet.Filter) e.g. use them for logging and performance measuring purposes. Now as we are using struts I would like to know if you can, and if it makes sense to assign a filter to an action. Can someone help me understand if this might be a good solution? You can certainly use servlet filters with Struts. It would be hard to apply a filter to a specific action, since the filters operate before-and-after Struts but not during the execution. I suppose you might have the filter set a request attribute and then have an Action look for it, but that seems tangled and suboptimal. I suppose in the end it depends on what you're trying to do. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Filters with Struts?
At 2:55 PM +0100 3/10/06, starki78 wrote: Yes I also come to the conclusion that it doesn't fit optimally, but it's always worth making such considerations to come to new solutions! And speaking of new solutions, it's worth pointing out that in Struts 1.3 you can use the commons-chain API to execute a chain of Commands instead of or in addition to an action. If you used a chain instead of an action, you could use the commons-chain Filter interface to have reusable code operate before and after just the action execution stage. Note that the complete chain is executed before the action, so you couldn't use this around an Action, per se. It wouldn't be that hard to move your action into a chain by implementing Command, but I'll spare the details... And, with WebWork, which is becoming the basis of Struts 2, you can apply a stack of interceptors on a per-action basis, which is another way to reuse common code in processing requests. Joe Thanks for your input Starky -- Initial Header --- From : Joe Germuska [EMAIL PROTECTED] To : starki78 [EMAIL PROTECTED],user user@struts.apache.org Cc : Date : Fri, 10 Mar 2006 07:25:33 -0600 Subject : Re: Using Filters with Struts? At 8:23 AM +0100 3/10/06, starki78 wrote: Hi I made thoughts about filters (javax.servlet.Filter) e.g. use them for logging and performance measuring purposes. Now as we are using struts I would like to know if you can, and if it makes sense to assign a filter to an action. Can someone help me understand if this might be a good solution? You can certainly use servlet filters with Struts. It would be hard to apply a filter to a specific action, since the filters operate before-and-after Struts but not during the execution. I suppose you might have the filter set a request attribute and then have an Action look for it, but that seems tangled and suboptimal. I suppose in the end it depends on what you're trying to do. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm Patterns? Nested Javabeans as ActionForm properties
At 11:03 PM -0600 3/7/06, news.gmane.org wrote: What are the recommendations for dealing with ActionForms that contain or represent complex nested data structures, preferrably using JavaBeans that already exist within the application? Check out FormDef: https://formdef.dev.java.net/ I haven't actually had need to apply it, but I believe its intention matches your use case. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles : Path teste does not start with a / character
At 10:14 AM -0300 3/8/06, vinicius wrote: my stack trace: java.lang.RuntimeException: Path teste does not start with a / character When using Tiles, interpret this message to mean that your path is not defined as a tile. The error cannot be more meaningful because Tiles is meant to co-exist peacefully with other usages -- so if tiles doesn't recognize a path, it simply does nothing, leading to an error later on. From your tiles config, it would appear that you want to go to the path .teste, note teste (note the leading . character.) From your Struts config, it appears that's where you are intending to go, but the actual exception indicates that you are somehow passing a different value. Joe org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1055) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1000) org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:560) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) sun.reflect.GeneratedMethodAccessor393.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:500) org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161) --- My forward and action: forward name=institucional path=/Institucional.do/ action path=/Institucional forward=.teste/ --- My plugin conf.: plug-in className=org.apache.struts.tiles.TilesPlugin !-- Path to XML definition file -- set-property property=definitions-config value=conf/tiles-defs.xml / !-- Set Module-awareness to true -- set-property property=moduleAware value=true / /plug-in --- my tiles.defs.xml definition name=Layout path=/tiles/layout/layout.jsp put name=titulo value=Portal FCDL-RS / put name=logo value=/tiles/logo.jsp / put name=header value=/tiles/header.jsp / put name=login value=/tiles/login.jsp / put name=menu value=/tiles/menu.jsp / put name=corpo value=/tiles/corpo.jsp / put name=parceiros value=/tiles/parceiros.jsp / put name=rodape value=/tiles/rodape.jsp / /definition definition name=.teste extends=Layout put name=body value=/tiles/teste.jsp / /definition --- -- At.: Vinicius Dittgen Analista Programador - T.I. www.fcdl-rs.com.br - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles : Path teste does not start with a / character
At 10:36 AM -0600 3/8/06, Greg Reddin wrote: On Mar 8, 2006, at 7:14 AM, vinicius wrote: My forward and action: forward name=institucional path=/Institucional.do/ action path=/Institucional forward=.teste/ my tiles.defs.xml definition name=.teste extends=Layout put name=body value=/tiles/teste.jsp / /definition Does it work to specify a Tiles Forward that begins with a . or will it try to find a relative URL? That looks a bit strange to me and I'm not sure if I'd expect it to work. I'd try using a name like teste.tiles in your forward and tiles def. My team uses use the .x.y naming convention for Tiles universally so that they are easily visually distinguished -- they are definitely legal. What happens is that the Tiles RequestProcessor tries to look up the tiles def name (a pure literal string match) and if it finds it, it changes the operative ActionForward to one whose path is the base path of the tiles definition. Then, control resumes as if Tiles were not being used and processForward tries to use RequestDispatcher.forward(req,resp) using the path in the ActionForward. (or in Struts 1.3, the PerformForward command executes.) Which is a long way of saying that a tiles definition can be any string, but if you get an IllegalArgumentException Path XXX does not start with a / character, the reason is that Tiles was not able to replace the ActionForward whose path was a tiles definition with one whose path is acceptable to ServletContext.getRequestDispatcher() Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormFile throws Serializable exception in session scope
Ben newreaders at gmail.com writes: I defined an ActionForm of which it has a FormFile. Prepopulation is not needed for this ActionForm. Configuring this ActionForm is similar to any other forms and here is the exception. I get this exception when I startup/shutdown Tomcat. ... 2005-11-11 09:45:30,000 WARN [ContainerBase.[Catalina].[localhost].[/]] - Cannot serialize session attribute uploadForm for session 0556C80B681118276F9F2B02FEC497E0 java.io.NotSerializableException: org.apache.commons.fileupload.DeferredFileOutputStream DeferredFileOutputStream is not serializable in commons-fileupload before version 1.1. (see http://issues.apache.org/bugzilla/show_bug.cgi?id=32785, http://jakarta.apache.org/commons/fileupload/changelog-report.html) However, having just run into this problem myself, the solution is not as simple as merely changing the commons-fileupload dependency. I'm just starting to scout this out myself, but I'm wondering if Struts needed to have some update to use the correct classes, or if I'm just blundering and I missed something else more straightforward. In any case, it appears that CommonsMultipartRequestHandler has not actually been updated to catch up with deprecations in commons-fileupload 1.1, but I haven't yet figured out if that is the reason simply using the newer commons-fileupload is still resulting in a problem with the serialization. http://struts.apache.org/struts-action/xref/org/apache/struts/upload/CommonsMultipartRequestHandler.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RequestProcessor processPopulate heavily increases memory usage
Do you have a session scoped form with one or more FormFile properties? Consider switching the scope to request, or alternatively, using the controller element to reduce the size of the in-memory file representation before the data is written to disk (see the memFileSize attribute described at http://struts.apache.org/struts-action/userGuide/configuration.html#controller_config ) Joe At 6:12 PM +0100 2/21/06, [EMAIL PROTECTED] wrote: Hi, Last week we migrated our Struts 1.0 application to 1.2.8. As far as we can tell, we correctly followed the migration steps inbetween. Since the migration we have noticed the following weird behaviour: upon submitting a form from a jsp to as struts form/action, the method processPopulate of RequestProcessor will increase memory usage on our windows box by some 30M for each call. Unfortunately, this extra memory is not freed, not even after waiting more than say one hour. After a few such requests, needless to say, this produces OutOfMemoryErrors. I pinpointed the memory usage to this method by setting log4j.logger.org.apache.struts=DEBUG in my log4j.properties. In the log, after form submission, the following info appears: DEBUG: RequestUtils.createActionForm.300 - -- [EMAIL PROTECTED] (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processActionForm.327 - Storing ActionForm bean instance in scope 'request' under attribute key 'incidentForm' (21 feb 2006 17:59:31,156) DEBUG: RequestProcessor.processPopulate.793 - Populating bean properties from this request (21 feb 2006 17:59:35,616) DEBUG: CommonsMultipartRequestHandler.getRepositoryPath.388 - File upload temp dir: C:\dev\workspace-reconstruct-hibernate\Attend\work\org\apache\jsp (21 feb 2006 17:59:35,772) What could be the cause of this excessive memory increase? Could it be that the entire Struts config is accidentally reloaded because of a problem in our configuration? Thanks, Willem -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules
At 5:17 PM -0500 2/13/06, [EMAIL PROTECTED] wrote: Can someone explain to me the benefits of using modules? I can see how it will help logically compartmentalize different regions of an application so that developers will have a more manageable view of the project, but does it provide anything a bit more technical? In my view, modules are more like distinct applications than components of a single application; although they technically share the same application (servlet) context, Struts walls them off from each other so that about the only thing which is shared is the servlet URI mapping (i.e. *.do). After trying a few applications using modules, my team and I found that the walls between modules were higher than appropriate for our model of development, and we stopped using them. We have been satisfied instead with Struts' support for using multiple config XML files for struts-config, tiles-definitions, and validations. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action Framework: simultaneous requests on the same path, in the same session.
but I wonder if that's a good idea. Am I missing something here? Is there a way to ensure that the action is called each time with the set of parameters it was supposed to receive? If your forms are request scoped, there should be no problem; a new object would be created each time. If you must use session scoped forms, it's not so easy, as the token mechanism for dealing with double-posts is not automatic; you must invoke it from your action, which means that the population/corruption may have already happened. If you are actually using JavaScript to submit these forms, then I'd suggest adding some JavaScript which sets a submitted flag and tests it before actually causing a submit, setting it to true after it does submit. I think that in a single page (not frame), things should be single-threaded so that this is relatively safe. The other solution would be to extend the RequestProcessor to add a token validation step earlier than in the Action's execute() method. Actually, in Struts 1.3 this would be easier for all the reasons that Struts 1.3 makes changing the request processing path easier. You could make a validate token command which would check the ActionMapping to see if it had been configured to require valid token (probably using Struts 1.3's arbitrary config properties) and if that configuration had been set, you'd do the validation (which can be done using ActionContext), and if the validation failed, you'd probably fall back to using some other configuration property of the ActionMapping to determine the fallback action. It actually seems like something which would be useful to add to the Struts 1.3 core, and perhaps even into the default chain. Unfortunately, I don't have time to code up something like that this month, but if you're interested, I can at least try to field basic questions here on the list (and hopefully so can others!) The use of tokens in Struts 1.3 is probably something which could use a bit of a workout anyway; I can't remember why offhand, but I had some questions about how I adapted the processing model from Action to ActionContext and I haven't had an opportunity to really give that a workout myself. Joe -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com You really can't burn anything out by trying something new, and even if you can burn it out, it can be fixed. Try something new. -- Robert Moog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3: Arbitary key/value pair
At 5:43 PM +0100 1/6/06, Manfred Wolff wrote: Hi everybody. Since Struts 1.3 it is possible to set an arbitary key/value pair to retrieve at runtime such as: action path=/EditSubscription extends=Editor set-property key=foo value=bar / /action In a document from the struts university (author Ted Husted) is an example to retrieve such pair: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { string foo = getProperty(foo); // ... In the nightly builds and in the newest subversion branch (366511) there is no getProperty() method in the Action class. So does anybody know, how to retrieve such a pair von set-properties. The properties are set on the ActionMapping, not the Action class. So in this case you'd use String foo = mapping.getProperty(foo); Hope this helps Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The framework I think I want...
At 9:39 AM -0500 1/5/06, Rick Reumann wrote: Craig McClanahan wrote the following on 1/4/2006 4:24 PM: On 1/4/06, Rick Reumann [EMAIL PROTECTED] wrote: Since I've been working on a rich client .NET app for a while, I've been a bit out of the loop on all the latest 'goings on' in regard to frameworks. (I couldn't keep up with all the Struts/JSF/Shale/WebWork comments on the list a while a back.) I'm actually quite happy with what Struts has to offer except for the deal with having to use ActionForms. I'd really like a Struts-like framework but allows me to use POJOs to capture my data and provides a nice way to redisplay that data back to the user if validation fails (ie a POJO that backs a form with a Data datatype will display back the String they entered). The managed bean approach to JSF that I've used some was REALLY nice - but I'm not yet convinced I want everything else in regard to JSF at this time. I don't know why ... JSF already does exactly what you are asking for here. I knew you were going to say that:) I do love the JSF 'backing bean' concept. Other aspects of JSF I'm not completely sold on yet, but I think I will spend more time with it again shortly to get up to speed the latest developments. (The last app I built with it was about five months ago.) And you may also want to look at the ModelDriven interface in WebWork. I don't know of a succinct explanation of it online, but it's discussed in the Webwork in Action book enough that you could get the idea. But it would basically allow you to use POJOs to collect form data instead of writing or configuring form classes. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts DTD - basic question
At 1:23 PM +0100 12/13/05, Danny Lee wrote: Shalom there, http://jakarta.apache.org is dead :(, have the same problem. yes you can hold the stuff localy. Just put it in your /lib/ folder... when jackarta's up, I'll do it too. Struts, Tiles, and Validator all are distributed with the correct DTDs (as well as several historic versions) packaged in the JAR. If you have the correct DOCTYPE declaration in your XML file, the DTD will be read as a classpath resource rather than over the internet. People generally don't understand that the PUBLIC identifier in the DOCTYPE is literally an identifier. It is an unstructured text string which must exactly match the value which is encoded in the validation Java code. (Well, it looks structured, but the process of identifying the DTD is based on a pure string match.) I recently collected the correct DOCTYPE declarations for the various XML files which Struts (or common Struts libraries) wants to validate; if you use these values, there should be no attempt to retrieve the DTD over the internet: Struts 1.3 !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.3//EN http://struts.apache.org/dtds/struts-config_1_3.dtd; Struts 1.2 !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; Struts 1.1 !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; Struts 1.0 !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; Servlet 2.3 !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; commons-validator 1.2 !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.2.0//EN http://jakarta.apache.org/commons/dtds/validator_1_2_0.dtd; commons-validator 1.1.3 !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; commons-validator 1.1 !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN http://jakarta.apache.org/commons/dtds/validator_1_1.dtd; commons-validator 1.0.1 !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0.1//EN http://jakarta.apache.org/commons/dtds/validator_1_0_1.dtd; commons-validator 1.0 !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN http://jakarta.apache.org/commons/dtds/validator_1_0.dtd; Tiles 1.1 !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration 1.1//EN http://struts.apache.org/dtds/tiles-config_1_1.dtd; Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts DTD - basic question
At 3:41 PM +0100 12/13/05, Danny Lee wrote: Hi Joe, thanks for your answer, now I realy understand how this stuff works :) But it still don't works with validator. JAR is right and in scope, DTD is there in jar, DOCTYPE is right too but Eclipse allways tries to search for it online... I think I missed that part; the suggestions I had are only for running Struts; not for work in an IDE. Eclipse has an XML Catalog (at least 3.1 with the Web Tools installed; I'm not sure where that came in). With that, you can do a similar process -- register a public ID and tell Eclipse where it can find a locally stored copy of that DTD. You can get a copy from the URL (if the server is working) or from a Struts JAR or the SVN repository. For other IDEs, I can't say, but they could all offer similar services. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to set token after an exception occurs ?
At 3:03 PM +0100 12/5/05, Nicolas De Loof wrote: Hello, I'm using token to avoid multiple submits in this flow : /commande.do creates an empty form-bean, saves a token and forwards to tile:commande.new /commande/create.do checks for token and creates datas in the database. If an exception occurs, an exceptionHandler is used to display an error message. I'm using it to catch Data integrity exception when user try to create an allready-existing entry. In this case, no token is saved anymore and user cannot change it's input and resubmit. How can I setup struts to have a new token beeing saved when an exception occurs, to allow the user to correct the form and submit ? The easiest thing I can think of would be to drop the declarative exception handling; catch the exception in the action mapped to /commande/create.do instead, where you can save a new token and return the user to tile:commande.new. Of course, you could extend the base ExceptionHandler, perhaps adding a configuration element that tells it to reset the token when the config is in a certain state. In Struts 1.2 you can extend ExceptionConfig and add arbitrary bean properties like you might with ActionMapping, and in Struts 1.3 ExceptionConfig participates in the arbitrary property-map model so that you don't even need to extend it. But I think that may be too much behavior for an exception handler. I am not inclined to use exceptions to route control flow. Joe Nico. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with DWR - Please help
At 3:29 PM -0600 12/5/05, Sonali Kulkarni wrote: I am trying to use Ajax (DWR framework) within Struts Framework. Per DWR Documentation, they have added StrutsCreator in current version to support struts framework. I just do not know how to use / integrate it. I am new to AJAX. Can anyone please help me out. When I try to make a dwr call on jsp, I get javascript error [object error] and on the console I can see error - uk.ltd.getahead.dwr.util.CommonsLoggingOutput error SEVERE: No converter found for org.apache.struts.action.ActionServletWrapper . You probably don't actually want to be sending or receiving the ActionServletWrapper in your remote calls, so you probably want to take a step back and assess your remote object's API. You might also want to review the DWR documentation on Converters: http://getahead.ltd.uk/dwr/server/dwrxml/converters In short, it requires you to show it how to marshall any object except a few core types to and from JavaScript, so that it knows which properties to expose and which to protect. Joe Please help! --- My dwr.xml - !DOCTYPE dwr PUBLIC -//GetAhead Limited//DTD Direct Web Remoting 1.0//EN http://www.getahead.ltd.uk/dwr/dwr10.dtd; dwr init creator id=struts class=uk.ltd.getahead.dwr.create.StrutsCreator/ /init allow create creator=struts javascript=BatchTransDetailActFrm param name=formBean value=BatchTransDetailActFrm/ include method=addTransaction/ /create /allow /dwr --- My Javascript from JSP - script language=javascript1.2 src=sys:write propertyName=' apache.root.alias'//dwr/interface/BatchTransDetailActFrm.js/script script language=javascript1.2 src=sys:write propertyName=' apache.root.alias'//dwr/engine.js/script script language= javascript1.2 src=sys:write propertyName=' apache.root.alias'//dwr/util.js/script !-- This is how we access javascript and css otherwise -- script language=javascript1.2 src=system:getServer propertyName=' apache.base.name '//javascript/Validation.js/script link href=system:getServer propertyName='apache.base.name'//stylesheet/greatvic.css rel=stylesheet type=text/css script function addTrans(){ var acctType= document.getElementById(acctType).value; var acctNum= document.getElementById(acctNum).value; var vletters= document.getElementById(vletters).value; var suffix= document.getElementById(suffix).value; var amount= document.getElementById(amount).value; var checkType= document.getElementById(checkType).value; BatchTransDetailActFrm.addTransaction (fillTable, acctType, acctNum, vletters, suffix, checkType,amount); $(resultTable).style.display = ''; } function fillTable(transactionBeans) { DWRUtil.addRows(transactionbody, transactionBeans, [ getBatchNum, getAcctType, getAcctNum, getVletters, getSuffix, getCheckType, getAmount ]); } --- When I make call to addTrans function I get [Object Error] javascript popup. And on server I see Error - uk.ltd.getahead.dwr.util.CommonsLoggingOutput error SEVERE: No converter found for org.apache.struts.action.ActionServletWrapper. -- - Also while loading that jsp page initially on the server I see error - Dec 5, 2005 2:37:49 PM uk.ltd.getahead.dwr.util.CommonsLoggingOutput error SEVERE: Error loading class for creator 'StrutsCreator[BatchTransDetailActFrm]'. java.lang.NullPointerException at org.apache.struts.util.ModuleUtils.getModuleConfig( ModuleUtils.java:76) at org.apache.struts.util.ModuleUtils.getModuleConfig( ModuleUtils.java:127) at org.apache.struts.util.RequestUtils.getModuleConfig( RequestUtils.java:1110) Can someone please guide whats going wrong? I am new to DWR.. and I am stuck! --- -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex
Re: [FRIDAY] Struts 1.x is Struts Classic after all
Struts = Legacy Struts 1.2.x - Action based architecture Struts Shale = Framework that leans on JSF and has a compatability layer written so it can support 1.x Struts apps This is not correct. Struts Shale does not have a compatibility layer for Struts 1.x apps. There is struts-faces, a library which provides some support for using Java Server Faces with Struts 1.x apps. There is Struts Ti, a framework which will probably provide some kind of compatibility layer with Struts 1.x apps. From a marketing perspective it's a bit untidy. It would be better if Shale were it's own project, not tied to the Struts name and Struts core was allowed to ride off into the Sunset. This would be less confusing to the business decision maker, I believe. Hm. Is it untidy that the Apache Software foundation has at least three web application frameworks? Should they be untethered from the Apache name and allowed to ride off... ? For that matter, why does Apache clutter itself with anything other than the original httpd? Decision makers out there are trying to figure out what to do about Microsoft Vista, or that Apple is releasing Intel-based Macs next year; there's always something. Decision makers can choose to sit and wait for things to clear up, or they can make their best educated decision about something now. For that matter, a decision maker could decide to commit development resources to an open source project, so as to have some control over its direction, and thus improve their ability to be confident in the decisions they have made. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] Struts 1.x is Struts Classic after all
At 3:12 PM -0800 12/5/05, Paul Benedict wrote: Hm. Is it untidy that the Apache Software foundation has at least three web application frameworks? Should they be untethered from the Apache name and allowed to ride off... ? For that matter, why does Apache clutter itself with anything other than the original httpd? Joe, I like your philosophy :-) My question is why is Shale under the Struts banner? As far as I see it, it has nothing to do with the Struts community, minus the creator. That's not true; there are other committers who have done work under Shale. It's not even a revolution. It addresses a wholly different problem set and I think it's wrong to call it Struts. Imagine, as an analogy, the brouhaha if Tapestry suddenly began calling itself Struts Tapestry because it's a framework too! I think Struts Shale wholly confuses the brand name. I'd like to see it be it's own man -- call it Jakarta Shale or Apache Shale. And either of these might happen some day. In the meantime, what trouble is it to you? Why don't we hear any sniping about the project to wean Tiles from having dependencies upon Struts? It is similarly at the periphery of struts-core. What's the big deal? I know this thread has [FRIDAY] written all over it, but there's all this other sniping about Shale that doesn't. Why not leave it be and put your (collective) energy towards building something you want to use instead of kibitzing about something you don't? There are plenty of open tickets for Struts 1.x, a world of discussions that can be had about moving Struts Titanium forward, and a handful of other web applications that probably need volunteer efforts as well. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Integrating Struts in DWR??
At 6:27 PM -0600 12/3/05, netsql wrote: Sorry to be a broken record but Shale + DWR might be a good combo to consider since Shale has an Ajax module. That Shale has an Ajax module has nothing to do with DWR; DWR provides all of its own AJAX plumbing, if by AJAX you mean having a page communicate with a server without a full page refresh. (The other facet of behavior commonly lumped under AJAX is DHTML effects; DWR has a small util library for those but doesn't really try to serve that space.) Frank's pointer to the DWR site hits the button, I think. If you have designed your Struts application correctly, then you can easily use DWR where you need to, but DWR has no need to know anything about Struts at all. You would have two servlets in one application context sharing access to the same business-level components. If you have so much behavior bound up in Struts Actions and ActionForms that you can't easily use DWR in the same application context, then you have too much behavior bound up in Struts. Time to refactor! We're using DWR on my most current project to very nice effect. I heartily recommend it. I wouldn't presume to make security recommendations for a banking application, but DWR seems to have a pretty good handle on basic security issues, in that it only exposes the things you configure for exposure, rather than automatically allowing things. Joe .V Frank W. Zammetti wrote: From the DWR web site: http://getahead.ltd.uk/dwr/server/struts Just reading through it quickly, that's just about what I would have suggested too in terms of separating out core logic from Actions and letting your Actions and DWR servlet call them as needed. There might be some better approaches, but it sounds like the DWR team is looking for those approaches themselves. Frank Sonali Kulkarni wrote: Please suggest if there are any good links, or some working examples that explain how Struts could be integrated into the DWR (AJAX) framework. Any help would be appreciated. There is hardly any online support or documentation. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do you prepopulate your forms?
This is essentially the standard approach. Your code leaves out the possibility that the form already exists (and that it may be in the session scope). This may be practical for your cases, but might lead to confusion should someone change part of the flow in your application. In Struts 1.3, there are actually a few places where this basic operation (check a scope for existing form, if not found, create it and place in scope, and return either pre-existing or new form) are done. I haven't seen a path to encapsulate it into one single operation, although I haven't actually thought about it for quite a while; it could probably just be put into a static util method on some class, but I was sort of down on static util methods for a while. Anyway, Struts does this for you in the CreateActionForm class. This isn't appropriate to prepopulation, though. If you want to do it yourself, there are two ways to get at it, but both involve newer features of Struts 1.3. First, and probably best, would be to use the CopyFormToContext command as part of a chain of commands; it can actually do the lookup so that all you have to specify is the path of the destination action and it will look up the form name and scope, much as html:form does. This provides for clean configuration. You can make a chain which uses this command and then has a subsequent command retrieve the form from the context and do the population. This behavior is also implemented in the ActionContextBase class, in the method findOrCreateActionForm(String formName, String scopeName). This method is not part of the ActionContext interface. Perhaps it should be, but I thought it best to figure out a way to put this code in one place rather than three before adding it to the interface. Still, if you have an ActionContext instance which inherits from ActionContextBase then you can cast and use the method. However, at this time a typical Struts Action class does not have a reference to an ActionContext object; we have not yet committed to changing the Action interface to receive one, and we haven't yet settled on a potential place to offer static access to a ThreadLocal which might store the ActionContext, although I'm using this basic pattern in a custom implementation of ActionContext and finding it workable, and there was some interest in having this last time it came up on the dev list. I've seen people using the input attribute point to an prepopulate action? the input attribute is only used when form validation fails. In some approaches, some page prep needs to happen here, although what I usually consider prepopulation (seeding with persistent values) is not relevant because the form should be refilled with whatever was submitted in the HTTP request. However, if you have dynamic menus or other form elements, of course you need to arrange for those to be restored. Hope this helps, Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1.3 Struts Validator Plugin Bug
By default, Struts expects a path as the value to input, not a forward name. You must explicitly configure if you prefer to use the forward name. See http://struts.apache.org/struts-core/userGuide/configuration.html#controller_config, specifically the inputForward attribute. Joe At 2:19 PM + 11/17/05, Aaron Evans wrote: Following the example validator application, I make a simple action config like so: !-- Contact Action -- action path=/contact forward=/contact.jsp / action path=/contact-submit type=com.mycompany.actions.ContactAction name=contactForm scope=request validate=true input=input-form forward name=input-form path=/contact.do / forward name=success path=/contacted.jsp / /action I have the validator plugin turned on and validating the form. If I submit it with no form values filled in, then I get the following exception: java.lang.IllegalArgumentException: Path input-form does not start with a / character The reason? The action's input attribute is set to the value input-form. This simply references the forward named input-form, just like the example. But the validator plugin errors out because the input-form does not start with a /. Changing the input attribute and forward name to /input-form does not help because it then tries the literal URI /input-form and I then get a 404 with: The requested resource (/input-form) is not available. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANNOUNCE] Release of Commons Validator 1.2.0
At 11:47 PM + 11/15/05, Niall Pemberton wrote: Whenever I can find out how to get ibiblio updated. You want to define a bunch of properties like this (probably in your ~/build.properties file) ## # DEPLOYMENT PROPERTIES ## # http://maven.apache.org/reference/plugins/artifact/properties.html # http://maven.apache.org/reference/plugins/artifact/examples.html # http://maven.apache.org/reference/user-guide.html#Properties_Processing #IBiblio Mirror maven.repo.ibiblio-mirror=scp://people.apache.org maven.repo.ibiblio-mirror.directory=/www/www.apache.org/dist/java-repository maven.repo.ibiblio-mirror.group=apcvs maven.repo.ibiblio-mirror.username=germuska maven.repo.ibiblio-mirror.privatekey=/Users/germuska/.ssh/id_rsa # Apache repository maven.repo.apache=scp://people.apache.org maven.repo.apache.directory=/www/cvs.apache.org/repository maven.repo.apache.group=apcvs maven.repo.apache.username=germuska maven.repo.apache.privatekey=/Users/germuska/.ssh/id_rsa ## and then do maven dist deploy -Dmaven.repo.list=ibiblio-mirror That should do it, assuming of course you change the user name and path to the private key accordingly. I haven't done this in a while, so I may have missed something. Joe Niall - Original Message - From: Mick Knutson [EMAIL PROTECTED] Sent: Tuesday, November 15, 2005 11:42 PM When will this be available in the ibiblio Maven Repository? -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 15, 2005 3:30 PM To: Struts User Jakarta Subject: [ANNOUNCE] Relase of Commons Validator 1.2.0 The Jakarta Commons Validator team is pleased to announce the availability of Commons Validator 1.2.0. For a summary of what's new in Validator 1.2.0 see the notes on the Commons Wiki: http://wiki.apache.org/jakarta-commons/ValidatorVersion120 A complete list of changes is available in the change log: http://jakarta.apache.org/commons/validator/changes-report.html Validator is available in either binary or source form from the Validator downloads page: http://jakarta.apache.org/site/downloads/downloads_commons-validator.cgi For more information on Commons Validator, see the Validator web site: http://jakarta.apache.org/commons/validator/ Niall Pemberton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] MMS safeway.com made the following annotations. -- Warning: All e-mail sent to this address will be received by the Safeway corporate e-mail system, and is subject to archival and review by someone other than the recipient. This e-mail may contain information proprietary to Safeway and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are notified that you have received this message in error and that any review, dissemination, distribution or copying of this message is strictly prohibited. If you have received this message in error, please notify the sender immediately. == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Best AJAX framework
At 10:36 AM +0200 11/10/05, Ovidiu EFTIMIE wrote: You should also take a look at www.openrico.org Rico builds upon prototype.js and so is subject to the same warning:as prototype. If you don't use html:javascript in your Struts app, it's no problem, but if you want to add AJAX to your app while still using Struts' client-side validation, you will have a problem with Rico, prototype.js, JSON, and any other library which modifies the base javascript Object class. I would recommend against using Prototype[3] or JSON[4] with Struts, as they use a JavaScript strategy which is incompatible with commons-validator and the html:javascript tag (see Bug #37134[5]). Joe ... [3] http://prototype.conio.net/ [4] http://www.crockford.com/JSON/index.html [5] http://issues.apache.org/bugzilla/show_bug.cgi?id=37134 -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Lock in BeanUtilsBean.getInstance(BeanUtilsBean.java:78)
) at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:950) at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:230) at jsp_servlet.__test._jspService(__test.java:309) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Best AJAX framework
At 4:43 PM +0100 11/8/05, Nicolas De Loof wrote: I'm using DWR on my webapp for navigation in a table, using a Page 1 2 3 ... footer. DWR makes it realy simple based on a List put into user session. Browser can get requested elements from list and DWR comes with utils to upgrade the table contain. I second the recommendation of DWR[1] for integrating backend logic with pages in an Ajax form -- it's very straightforward to use; I was up and running in less than an hour. DWR doesn't provide any solutions for page display (well, it has a few util methods, but...) I still haven't settled on one library for those, having mostly opted to write my own. I'm watching Dojo[2] carefully as our own Martin Cooper is a big fan, but it is still in very active development and is minimally documented, so I'm waiting to either have more time to read the code or for more docs to be drafted. I would recommend against using Prototype[3] or JSON[4] with Struts, as they use a JavaScript strategy which is incompatible with commons-validator and the html:javascript tag (see Bug #37134[5]). Joe [1] http://getahead.ltd.uk/dwr/ [2] http://dojotoolkit.org/ [3] http://prototype.conio.net/ [4] http://www.crockford.com/JSON/index.html [5] http://issues.apache.org/bugzilla/show_bug.cgi?id=37134 Faisal Mahmoud a écrit : Check out http://www.backbase.com for an Ajax framework. On 11/8/05, Frank W. Zammetti [EMAIL PROTECTED] wrote: sarcasmFar be it from me to push my own creation.../sarcasm http://javawebparts.sourceforge.net Go into the javadocs and look at the javawebparts.taglib.ajaxtags package. This isn't the AjaxTags you may have heard of lately, they are two separate projects that just happen to have the same name. I think it's reasonable to say that this AjaxTags is a bit different from most of the other Ajax toolkits/taglibs/whatever out there, but folks might like what they find here (many do already!). If it seems interesting, I recommend downloading the cookbook and checking out the examples there. The recipes in there are simpler than what you'll find in the Java Web Parts sample app, much mroe focused, and can even be used as-is. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Tue, November 8, 2005 10:24 am, David Gagnon said: Hi all, Sorry for the OT guys. I'm looking for a good AJAX framework. I haven't found one under apache.org. Is there one? If not is there one who is more popular/cool/good that other? Thansk for your help!! Best Regard /David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://www.quidprocode.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionServlet - registration of DTDs
The ActionServlet doesn't know about Tiles. Tiles registers the appropriate DTD in another location, specifically: http://struts.apache.org/struts-tiles/xref/org/apache/struts/tiles/xmlDefinition/XmlParser.html#65 (Thanks, Wendy for getting the new Maven site up! I've been wanting to link straight to line numbers in the source code for a long time now!) Joe At 11:52 AM +0200 10/26/05, Chris Searle wrote: I see that org.apache.struts.action.ActionServlet has an array of DTD public identifier to path in jar file that looks like: protected String[] registrations = { -//Apache Software Foundation//DTD Struts Configuration 1.0//EN, /org/apache/struts/resources/struts-config_1_0.dtd, -//Apache Software Foundation//DTD Struts Configuration 1.1//EN, /org/apache/struts/resources/struts-config_1_1.dtd, -//Apache Software Foundation//DTD Struts Configuration 1.2//EN, /org/apache/struts/resources/struts-config_1_2.dtd, -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN, /org/apache/struts/resources/web-app_2_2.dtd, -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN, /org/apache/struts/resources/web-app_2_3.dtd }; The jar file contains org/apache/struts/resources/struts-config_1_0.dtd org/apache/struts/resources/struts-config_1_1.dtd org/apache/struts/resources/struts-config_1_2.dtd org/apache/struts/resources/tiles-config_1_1.dtd org/apache/struts/resources/web-app_2_2.dtd org/apache/struts/resources/web-app_2_3.dtd In other words - the tiles-config DTD is not referenced. This means that for a project using tiles installed on a box that has no access to the web - the resolution of the tiles DTD fails. Is this by design? Or should the DTD be added? If by design - how best to get the tiles DTD to resolve on boxes that have no net access? At present I appear to be creating a descendent of ActionServlet where the only difference is that in the init method adds the tiles DTD - is there a better way? -- Chris Searle [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding images to option items in a select drop down list
At 3:11 PM -0400 10/19/05, Frank W. Zammetti wrote: This isn's something that is possible in straight HTML. There could be a way to do it via CSS, but nothing obvious presents itself to me... I tried setting a background-image, but that didn't work. Can you find an example of it being done? Unless there's some non-obvious CSS trick, or perhaps some non-standard browser extension, I'd bet this isn't possible. Here's an example of something a user might not distinguish from what is described, although it wouldn't be using select http://script.aculo.us/demos/ajax/autocompleter_customized By using DHTML like this and having an event cause a hidden form field value to be set, you could achieve the goal. Note that Scriptaculous builds upon the Prototype library, which breaks commons-validator client side javascript validation. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: So boring issues about character encoding in action ......
At 1:44 PM +0800 10/18/05, Tony Lu wrote: I need to create an internationalized Web application by struts,mysql and hibernate. Each component Character Encoding is utf8. It runs well when I run a pure servlet to save 'Chinese Character' to database and load it from database. But when I implement it with struts action, the application can not save Chinese correctly. I really don't know why struts action can not work well. I am sure there is no difference between them. By the time that your action class is executing, Struts has already read from the request input stream (to populate the ActionForm). In any web application, if you want to set the request character encoding, you must arrange to do it before any code will read from the request input stream. The best way to do this in a Servlet 2.3 or later web environment is to use a ServletFilter. In fact, most of the worked examples of writing ServletFilters on the web are to solve this problem. You could also do it by extending RequestProcessor (or TilesRequestProcessor, if you use Tiles) and overriding the processPreprocess method. However, in Struts 1.3 the processPreprocess method is no longer used. Using a ServletFilter will apply to any application you write in any Struts version, or with a non-Struts approach. Joe Is there anywhere to set character encoding for action? Please help! --Pure Servlet ( It runs well) - public class UtfTest extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding(UTF-8); String description = request.getParameter(description); description = (description == null?:description.trim()); try{ ItemDAO itemDao = ItemDAO.getInstance(); Item item = new Item(); item.setDescription(description); itemDao.save(item); }catch(Exception e){ e.printStackTrace(); } response.sendRedirect(test.jsp); } } --Action for struts public class TestAction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { req.setCharacterEncoding(UTF-8); String description = req.getParameter(description); description = (description == null?:description.trim()); try{ ItemDAO itemDao = ItemDAO.getInstance(); Item item = new Item(); item.setDescription(description); itemDao.save(item); // Determine which action forward should be returned return mapping.findForward(success); }catch(Exception e){ } } } -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: errorStyleClass with ActionMessages
At 3:26 PM +0100 10/17/05, [EMAIL PROTECTED] wrote: Hi there, I would like to make use of the errorStyleClass functionality with validation errors that I create in my action class using ActionMessages. I guess there must be a way of letting the ActionMessage object know which UI field it is relating to. Has anyone managed to do this without creating custom validation controlled by validation.xml? When you add an ActionMessage object to an ActionMessages collection, you must specify the property with which the message associates. This string should be exactly the value in the property attribute of your form element in the JSP. Hope that helps, Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom Struts code or 1.2.8?
At 9:17 PM -0700 10/13/05, Paul Benedict wrote: Does anyone ever run any custom versions of Struts or the Commons library? The reason I ask is because the bug that I need fix (it is now fixed) in Commons Validator isn't released for the Struts 1.2.x branch, but most likely will be released with Struts 1.3 Well I don't like using release 1 of anything :-) I wouldn't want to upgrade to Struts 1.3 until it at least gets into version 1.3.3 or something - the theoretical risk for large bugs is high... Just think of how many releases were for Struts 1.2! Yes, but think of how many applications are in production right now built on Struts 1.1, or on Struts 1.2.[x7]. Most of the changes from version to version of Struts are feature enhancements, and most of the bug fixes clearly don't prevent most people from building applications that operate perfectly well even while the identified bug has not been fixed. My team and I have put three Struts 1.3.x webapps into production so far, and we're working on more all the time. I'm certain it's possible that there are bugs in there that just haven't been exercised given some particulars of how we write webapps, but it's not like it was rewritten from the ground up. So what's the right solution here? I would like to see a Strut 1.2.8, as I said, with an upgraded Commons Validator too. Do I just compile a custom version of Validator for myself? I'd like to hear opinions. If this particular bug is in commons-validator, then why do you need a different version of Struts? Sorry, I haven't been following the validator development extremely closely, but if the bug isn't in Struts, why is the release version of Struts a concern? Struts, as with most open source code, doesn't go through the kind of testing process prior to a versioned release that you might imagine if you are thinking of commercial software. I don't know if that clarifies anything or not. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]