Re: struts capabilities with myEclipse
Upgrade ! Version 3.8.4 must be about 3 years old. prem_gadgetquest wrote: I am using MyEclipse 3.8.4... when I create new project and add struts capabilities (struts 1.2) to it..it doesnt show me validator -rules.xml and validation.xml..I want to use these files for form validations..Similarly if I add struts capabilties 1.1 those files are added properly..please tell me how can I move with the form validations using struts 1.2 in this case. Thanks :working: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Ajax performance optimisation
Maybe too late, but I found that you have to do the following : - create a directory struts under your Webroot directory - copy all contents from the static directory into this struts directory - copy the entire contents of template directory into this same struts directory, without the template directory itself. This means that the Webroot/struts directory contains the following items : -ajax -archive -CommonFunctions.js -css_xhtml -dojo -inputtransferselect.js -niftycorners -optiontransferselect.js -simple -tabs.css -template -tree.css -validationClient.js -xhtml Now you can upgrade dojo to the most recent version in the 0.4 branch (currently 0.4.3). When you upgrade, make sure to copy the dojo/struts directory under the new dojo directory. bartlebooth Jason Wyatt wrote: I've been trying to speed up the Ajax performance of our application, based on the notes at http://cwiki.apache.org/WW/performance-tuning.html I'm a bit unsure where I should extract the static content to, such as the css and javascript files included by the Ajax theme (shown below): For example, the styles.css file above is stored in the struts2-core-2.0.8.jar under the path /template/xhtml. But if I extract this file to the webroot/template/xhtml, it seems that the link in the code above won't work, so I should instead extract it to webroot/struts/xhtml. Is this understanding correct? Basically I'm wondering how the mapping works between the template folder in the jar file and the struts folders mentioned in the Ajax theme's code. Thanks for any help, Regards Jason - Falun Dafa Truth - Compassion - Forbearance A mind & body practice under persecution in China http://www.faluninfo.net - 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]
Re: Setting application properties
You could put a context parameter into your web.xml tmpDir /tmp/test If your action is ServletContextAware (you implement the setter public void setServletContext(ServletContext servletContext)), then you can access this parameter using servletContext.getContext(your_application_context_name).getInitParameter("tmpDir")" hope this helps bartlebooth SimonK wrote: Thanx for you reply. The 'problem' with this solution is that I then have to explicitly access the file each time I want a property. I was hoping that There was a place that I could load such parameters then simply access it. The things I have experimented with (and which have failed) are: attempt 1 - place the line: in struts.xml (just after ). attempt 2 - place the line: gov.brs.mapping.RegionSelector.tmpDirectory=/temp in struts.properties, which is in "WEB-INF/classes" In both cases, the class gov.brs.mapping.RegionSelector has static getter and setters for tmpDirectory, which is a static member. I was hoping that this would set tmpDirectory (a String) in gov.brs.mapping.RegionSelector. This does not happen. The above solutions would not be ideal in any case. What I would really like to know how to get struts to put key value pairs in the application map (which I *think* is the appropriate place) or atleast on the stack, when the application is loaded by tomcat, so I can write something like: String tempDir = ActionContext.getApplication().get("tempDirectory"); or String tempDir = ActionContext.getValueStack().get("tempDirectory"); to get at it. Can I do this... and if so, how? Cheers again, Simon. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 and images from database
Perhaps the result name in my example does not correspond to the return value of your action ? I assume you are using the param interceptor here public class ImageAction { privateint imageId; privateImage image; // this method is called when using the param-interceptor public void setImageId(int imageId) { this.imageId = imageId; } public InputStream getImageStream() { // create a stream from your image } public String execute() { // get image image = dao.getImage() // or something like that, could be in the prepare method if you're using the prepare interceptor return "all"; // if you use "success" here, you have to modify the result name in your struts.xml } } hope this helps bartlebooth Roberto Nunnari wrote: Hi bartlebooth. That is very neat! But the getImageStream method in my action is never called.. why? bartlebooth wrote: You could use the stream result-type. image/jpg imageStream name="contentDisposition">filename="image.jpg" 1024 In your action, you have to provide a method getImageStream (corresponding to the inputName parameter above). public InputStream getImageStream() { // create a stream from your image } Josh Vickery wrote: If you return null from your Action you can write directly to the response: HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("image/jpg"); out = response.getOutputStream(); write image here return null; On 7/18/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: hehe.. ok.. let's add some context.. Till now I was using a servlet to serve to the web images stored in a database. To access the database I had the myDAO object in the applicationContext and so it was accessible by the servlet and actions. Now I have added Spring to the game, and the myDAO object is no longer in the applicationContext, as it is managed by Spring. All my actions now extends a base class that has a setMyDAO method, and so they get access to the myDAO object. But what about the servlet? It will not be injected by Spring. What is the solution? Thank you. Best regards. -- Robi. Roberto Nunnari wrote: > Hello. > > What is the best way to serve images stored in database in Struts2? > > action, resultType, or servlet? > > Thank you. > - 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]
Re: Struts2 and images from database
You could use the stream result-type. image/jpg imageStream name="contentDisposition">filename="image.jpg" 1024 In your action, you have to provide a method getImageStream (corresponding to the inputName parameter above). public InputStream getImageStream() { // create a stream from your image } Josh Vickery wrote: If you return null from your Action you can write directly to the response: HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("image/jpg"); out = response.getOutputStream(); write image here return null; On 7/18/07, Roberto Nunnari <[EMAIL PROTECTED]> wrote: hehe.. ok.. let's add some context.. Till now I was using a servlet to serve to the web images stored in a database. To access the database I had the myDAO object in the applicationContext and so it was accessible by the servlet and actions. Now I have added Spring to the game, and the myDAO object is no longer in the applicationContext, as it is managed by Spring. All my actions now extends a base class that has a setMyDAO method, and so they get access to the myDAO object. But what about the servlet? It will not be injected by Spring. What is the solution? Thank you. Best regards. -- Robi. Roberto Nunnari wrote: > Hello. > > What is the best way to serve images stored in database in Struts2? > > action, resultType, or servlet? > > Thank you. > - 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]
Struts2 StrutsTestCase
though I put the WEB-INF directory, and the directory containing the WEB-INF directory in the classpath. I also have the impression that my current Test configuration does not use the struts.xml file at all (that's why I have to explicitly set the package configuration via the getPackageConfigs method). This is a pity, since I would like to have any modification in my struts.xml file reflected in my tests. Is it possible anyhow to configure the StrutsTestCase to use the web.xml file. Is there any documentation on how to configure the StrutsTestCase correctly to use the web configuration ? Any pointers are welcome. Thanks, bartlebooth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]