RE: Slow file upload?
Don't know if its really bug because it does actually work just fine; it just chews up allot of CPU when doing network I/O. I'm not sure if this only happens on Windows boxes or if it happens on other platforms as well. The thing about Netscape/Mozilla is that it runs on allot of different platforms. And many of the different platforms have a slightly different take on how you do asynchronous non-blocking network I/O. So they probably have created some library to abstract out these differences. Now maybe its a bug in how they implemented asynchronous non blocking I/O on windows or maybe they just decided it would be easier to poll rather then handling the many different ways different Os's can provide asynchronous notification that there is more data available or that its OK to send more data. -Original Message- From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 11:04 AM To: Struts Users Mailing List Subject: RE: Slow file upload? I just tried this from another PC running Windows and IE, and then the upload took less than a second.. Is this a "bug" in Mozilla or? BTJ On Tue, 2003-09-16 at 15:58, Kurt Post wrote: > If you are running on a Windows box, I would try using IE instead of Mozilla > for your timing tests. On windows, Netscape and thus probably Mozilla, > seems to spin in a hard loop poling for new data while its trying to receive > data over the network. This results in 100% CPU utilization and really > slows things down. It might just be that it also spins in a hard loop when > its waiting for the transmit buffer to empty enough so it can continue to > send more data. > > -Original Message- > From: Daniel Washusen [mailto:[EMAIL PROTECTED] > Sent: Monday, September 15, 2003 11:54 PM > To: Struts Users Mailing List > Subject: RE: Slow file upload? > > > > Yes, I am using Struts 1.1 and the default upload in commons-fileupload. > > The hw I am running on is a 2.4GHz PC with 1GB memory, with at least > > half of it free.. The browser I tried the upload with was Mozilla.. > > > > BTJ > > > > I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in > about 1 second and a 8 MB file in about 3 seconds... Struts 1.1, > commons-fileupload and Tomcat 4.1.27. Not really much help for you but it > would confirm that it all works... > > > - > 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]
RE: Slow file upload?
If you are running on a Windows box, I would try using IE instead of Mozilla for your timing tests. On windows, Netscape and thus probably Mozilla, seems to spin in a hard loop poling for new data while its trying to receive data over the network. This results in 100% CPU utilization and really slows things down. It might just be that it also spins in a hard loop when its waiting for the transmit buffer to empty enough so it can continue to send more data. -Original Message- From: Daniel Washusen [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 11:54 PM To: Struts Users Mailing List Subject: RE: Slow file upload? > Yes, I am using Struts 1.1 and the default upload in commons-fileupload. > The hw I am running on is a 2.4GHz PC with 1GB memory, with at least > half of it free.. The browser I tried the upload with was Mozilla.. > > BTJ > I'm running a P4 1.7 with 512MB of RAM and I can upload a 1.8 MB file in about 1 second and a 8 MB file in about 3 seconds... Struts 1.1, commons-fileupload and Tomcat 4.1.27. Not really much help for you but it would confirm that it all works... - 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: Avoid Validate After Submit
Here's how I do it in Struts 1.1. I'm not sure how 1.1 is different from 1.01 in the validation area so your mileage may very. First I have a base class for all my ActionForm's called ExtendedActionBase. Among other things, this class defines some standard button name for "next", "back", "cancel", and "OK" verbs. The class will only perform validation if a "next" or "OK" button was used to submit the form. There's also some extra junk in the class that has to do with accepting either simple buttons. The only other thing you need to do is on "back" and "cancel" buttons make sure they are buttons. This insures that the JavaScript validator will not validate the form. I'll include ExtendedActionBase.java below. Hope this helps, Kurt --- /* * ExtendedActionForm.java * * Created on July 11, 2003, 10:39 AM */ package com.kaptec.dateweb.web.struts.actionforms; import org.apache.struts.action.ActionErrors; /** The purpose of this class is to provide a base class for ActionForms that want * to prepopulate their values when they are created. This class takes advantage * of the fact that STruts calls Reset() when an ActionForm is created and in * addition to calling Reset() before populating ActionForm properties from * submitted HTML form data. * * Descenden ts of this class need to implement two methods. the onInitialize() * method is called when the ActionForm is created and the onProcessForm() method * is called before HTML form values are passed into ActionForm properties. * @author Kurt Post */ public class ExtendedActionForm extends org.apache.struts.validator.ValidatorActionForm { /** indicates if the ActionForm has been initialed yet */ private boolean isInitialized = false; /** This attribute will be set to a non-null value if the user pressed the "Submit" button on * the form. */ private String btnProcessForm; /** This attribute will be set to a non-null value if the user pressed the "Cancel" button on * the form. */ private String btnCancelForm; /** This attribute will be set to a non-null value if the user pressed the "Next" button on * the form. */ private String btnNext; /** This attribute will be set to a non-null value if the user pressed the "Back" button on * the form. */ private String btnBack; /** The X and Y attributes of this object will be set if the user clicks on a * "Submit" image button */ private ImageButtonCoordinates imgProcessForm = new ImageButtonCoordinates(); /** The X and Y attributes of this object will be set if the user clicks on a * "Submit" image button */ private ImageButtonCoordinates imgCancelForm = new ImageButtonCoordinates(); /** The X and Y attributes of this object will be set if the user clicks on a * "Next" image button */ private ImageButtonCoordinates imgNext = new ImageButtonCoordinates(); /** The X and Y attributes of this object will be set if the user clicks on a * "Back" image button */ private ImageButtonCoordinates imgBack = new ImageButtonCoordinates(); /** Simply catch the Struts framework calles to reset() and forward it to * onInitialize() or onProcessForm(). * @param mapping Action mapping that caused our ActionForm to be * created or populated * @param request HTTP request which caused this ActionForm to be * created or populated. */ public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { super.reset(mapping, request); if (isInitialized == false) { onInitialize(mapping, request); isInitialized = true; } else { onProcessForm(mapping, request); } } /** Override this method to handle ActionForm initialization * WARNING: The method in this base class should be called by descendent * classesthat override it since it handles resetting form * submit/cancel related properties. * @param mapping Action mapping that caused our ActionForm to be * created * @param request HTTP request which caused this ActionForm to be * created */ public void onInitialize(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { } /** Override this method to handle any processing needed before HTML form data is * passed to the properties of this ActionForm * WARNING: The method in this base class should be called by descendent * classesthat override it since it handles resetting form * submit/cancel related properties. * @param mapping Action mapping that caused our ActionForm to
RE: Working visual on presentation layer
No problem. If you need to make any changes for MX compatibility, please send me a copy so I can integrate them. -Original Message- From: Hookom, Jacob [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 10:30 AM To: 'Struts Users Mailing List' Subject: RE: Working visual on presentation layer Kurt, Could you also bounce me your extension? Our JSP developers are using Dreamweaver MX, if there are issues with compatibility, I'm sure we will be able to make the appropriate modifications. Many thanks! Jacob Hookom Senior Analyst/Programmer McKesson Medical-Surgical Golden Valley, Minnesota http://www.mckesson.com -Original Message----- From: Kurt Post [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 9:32 AM To: Struts Users Mailing List Subject: RE: Working visual on presentation layer If you are using Macromedia Ultradev I might have an answer for you. When I started working with Struts a couple of weeks ago, the first thing I did was whip up a crude Ultradev extension for Struts. The extension allows you to see struts tags in the design view as their corresponding HTML elements, insert common Struts tags from the insert menu and convert standard HTML form tags to their corresponding struts tags. This extension doesn't require that you be in the live data mode so there is no real setup required to use it. The extension could use allot of improvement, but its good enough for what I wanted. The extension doesn't do a very good job with tags now, but I plan to fix this pretty soon. If I get some spare time there are allot of nice features I would like to add to it. I would be glad to email you the extension if your want to give it a try. I am using Ultradev4 so I'm not sure how/if the extension will work on DreamWeaver MX. -Original Message- From: Altug B. Altintas [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 3:04 AM To: 'Struts Users Mailing List' Subject: Working visual on presentation layer Hi, If i give jsp page to a web designer, how can she/he can see the actual web objects ? For example if i wrote a simple web application using struts, i have to put custom tags into this JSP page Logon.jsp *** <%@ page language="java" %> <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %> Logon with username "test" and password "test". Username: Password: *** When the web designer opens this JSP page using Macromadia DreamViewer (also import custom tags) he/she doesn't see the web objects (text box, checkbox, submit button), Are there any way or any tool to work visual on presentation layer while developers use Struts on backend? Regards. - 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]
RE: Working visual on presentation layer
If you are using Macromedia Ultradev I might have an answer for you. When I started working with Struts a couple of weeks ago, the first thing I did was whip up a crude Ultradev extension for Struts. The extension allows you to see struts tags in the design view as their corresponding HTML elements, insert common Struts tags from the insert menu and convert standard HTML form tags to their corresponding struts tags. This extension doesn't require that you be in the live data mode so there is no real setup required to use it. The extension could use allot of improvement, but its good enough for what I wanted. The extension doesn't do a very good job with tags now, but I plan to fix this pretty soon. If I get some spare time there are allot of nice features I would like to add to it. I would be glad to email you the extension if your want to give it a try. I am using Ultradev4 so I'm not sure how/if the extension will work on DreamWeaver MX. -Original Message- From: Altug B. Altintas [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 3:04 AM To: 'Struts Users Mailing List' Subject: Working visual on presentation layer Hi, If i give jsp page to a web designer, how can she/he can see the actual web objects ? For example if i wrote a simple web application using struts, i have to put custom tags into this JSP page Logon.jsp *** <%@ page language="java" %> <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %> Logon with username "test" and password "test". Username: Password: *** When the web designer opens this JSP page using Macromadia DreamViewer (also import custom tags) he/she doesn't see the web objects (text box, checkbox, submit button), Are there any way or any tool to work visual on presentation layer while developers use Struts on backend? Regards. - 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: Populating form from request parameters in JSP
Hi, I just started using struts. And like you, I thought creating all the extra Action mappings and Action objects would add extra complexity. So I created an enhancement request asking that a new method be added to the ActionForm object which would be called when the ActionForm is created. This method would be passed the HttpRequest which caused the ActionForm to be created so that the ActionForm could use the HttpRequest object to pre-populate itself without the need for a separate action. But someone in struts-dev mentioned that ActionForm.Reset() is called after an ActionForm is created in addition to being called just before HTML form values are populated to the ActionForm's properties. This was great because it provided the functionality I was looking for. So basically what happens is that when an element is referenced in the JSP, the ActionForm which matches the 's "action" property gets created if it doesn't already exist. Since you know the first call to reset() corresponds with the creation of the ActionForm object, you can do all your initialization. Then when the JSP continues on to render other fields in your form, they will be populated with good data. I tried it out and it worked great. I didn't have to make any Action objects just for the purpose of initializing ActionForm objects. I just let the ActionForm objects take care of it themselves on the first call to reset(). I also configured struts to keep the ActionForm on the session scope so that the ActionForm wouldn't have to go through an extra initialization when the user actually clicked the submit button on the form rendered by the JSP. The only thing that worries me is that the behavior of calling ActionForm.reset() upon ActionForm creation is not documented so I'm a little worried that future versions of Struts may change this behavior. But taking advantage of the current behavior makes prepopulating forms allot easier so I'll take my chances. What can I say, I'm lazy :) Kurt -Original Message- From: Ajay Patil [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 6:21 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Populating form from request parameters in JSP Thanks Nagi, Atleast I know that I am not doing something wierd. Anyway, why does the JSP page care about the origin of the forward. Why cant it simply autopopulate the form from request parameters ? Defining an extra action class just to do the forward seems to unnecessarily increase complexity. What do you think ? Ajay hi, your two jsp pages have different action forms associated with them. so u cant expect the second jsp page to autopupulate the previous request parameters. u have to go thro' the struts thing(action class) which will then autopopulate ur new action form and then the jsp page associated will show the values.. if both ur jsp pages share a single action form(which is in session) then the second jsp page will automatically show the values hope its clear now -- nagi ---Original Message--- From: Struts Users Mailing List Date: Friday, July 11, 2003 12:33:32 PM To: [EMAIL PROTECTED] Subject: Populating form from request parameters in JSP Hello, I know this question has probably been asked several times. But, possibly a Struts developer can explain because I am confused. Generally, my action classes receive posted data, query the database, put the query result as request attribute and then forward to the next JSP. However, I find that form properties in the next JSP dont get auto-populated from the request parameters. So, I define a new action class (associated with the next form), and use it simply for forwarding. And then I can see the form properties auto-populated. So, why is this extra step (or extra action class) needed ? Or am doing something wrong here ? Please clarify, Ajay - 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]