Re: DownloadAction and concurrent threads
I see no reason why the DownloadAction would be programmed to synchronize against anything, especially for the whole download, that would be a real showstopper! If you don't use instance variables, and only read from a database (with a connection for each download) or a filesystem, you wouldn't need to synchronize either. Oliver Meyn wrote: Hi all, My app needs to allow downloads of relatively large files (10MB). Because Struts can/will reuse Actions for different threads, I'm worried that when multiple requests attempt to download these big files that a single BigFileDownloadAction will block until a download is complete thereby slowing all downloads (effectively making them serial). Am I missing something? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormFile arrays
You are right about the jakarta commons fileupload and struts, you can't use commons fileupload in an action, because struts have already taken care of the multi-part parsing. You do have the option to make a servlet and commons fileupload, where you will have total control of the form data. I'm not certain about your way of making the files go into an array. Is that the way to do it with for example html:text? One would expect it to work in a similar fashion. http://www.jguru.com/faq/view.jsp?EID=915898 This link suggests that you use the same name all over again for each entry, like notworkingfile, notworkingfile, and so on... Jeremiah Johnson skrev: I would like to upload multiple files on a single web page by having multiple html:file elements. The exact number of these are different depending on the user who is using the application. So I want to store this in an array (FormFile[]) in order to have N number of files uploaded. When I try to use html:file/ tags in an iterate loop (with indexed=true) I get an error about requiring property attribute. There's isn't a good way of doing that so I just rendered the the HTML with scriplets. It looks something like: input type=file name=workingfile/ input type=file name=notworkingfile[0]/ input type=file name=notworkingfile[1]/ input type=file name=notworkingfile[2]/ The form has getters and setters for workingfile (of type FormFile) and notworkingfile ( of type FormFile[] that is 3 elements). workingfile is assigned an instantied object however each element of notworkingfile[] is null after submit. I then attempted to use commons-fileupload-1.1.1 in a struts action (struts 1.2.9) to read the uploaded data but it does not recognize that any files are being uploaded (including workingfile). I tried this code: List items = new ServletFileUpload( new DiskFileItemFactory()).parseRequest(request); items results in an empty collection (but not null). I've read that you can not use commons-fileupload in a struts action which may be why that doesn't work. Anyone know how to have variable number of file upload boxes? I know I could have properties for each file (file1,file2,file3 and so on) instead of array but I'd rather not implement it that way. Thanks! Jeremiah - 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: Constructor of Action is executed but getting a blank screen
Try overriding execute, not excecute :) krishan rathi wrote: hi all Infact the constructor of Action is called but i am getting a blank screen and in the log file just getting the SOP in the constructor not even getting the Sop in the Exceute method. plz help Thanks krishan rathi [EMAIL PROTECTED] wrote: Hi all I am trying to use struts with netbeans 5.0 but having strange problems. I have wrtten One ActionForm i.e EmployeeForm ,one action i.e AddEmpAction. then in the struts-config.xml provided following entries: and using /addEmployee.jsp as welcomefile. But when i run my application it is displaying the addemployee.jsp correctly but when i click on the submit button it just displays a blank screen showing addemp.do in the address bar. can anybody provide what i am missing. the listing of my formbean and action class is following. import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; /** * * @author admin */ public class AddEmpAction extends Action{ public ActionForward excecute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){ try{ System.out.println(inside action**); EmployeeForm empForm=(EmployeeForm)form; String name=empForm.getName(); float salary=empForm.getSalary(); String address=empForm.getAddress(); Employee emp=new Employee(name,salary,address); EmployeeDao dao=new EmployeeDao(); dao.insertEmployee(emp,1); } catch(Exception e){ e.printStackTrace(); } return mapping.findForward(success); } } /* * EmployeeForm.java * * Created on September 11, 2006, 11:52 AM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package com.myapp.struts.forms; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; /** * * @author admin */ public class EmployeeForm extends ActionForm { private String name; private float salary; private String address; public void reset(ActionMapping mapping,HttpServletRequest request){ setName(null); setSalary(0.0F); setAddress(null); } public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){ return null; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getSalary() { return salary; } public void setSalary(float salary) { this.salary = salary; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } } thanks Krishan rathi. - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. - How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using bean tag in scriptlet
I would try using instead of ' as value delimiter. (key=test.hello instead of key='test.hello') Have you set up the resource bundle in strutsconfig? [EMAIL PROTECTED] wrote: Hi Everybody, i have a struts application which gives multilanguage support. And i want to a assign a property file key value to a string in scriptlet. Here is the example jsp: . . . % String str=bean:message key='test.hello'/; out.print(str); % . . When i want to print str value, there is no output shown at the page. In addition, I do not have any error message Any other solutions please? Best Regards. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do I get the original RequestURI?
Hi, I want to do something like this: 1. User enters http://localhost/appname/welcome.do 2. PlaceAction forwards to list.do 3. In ListAction, I want to retrieve the URL the user entered /appname/welcome.do. The problem: when I run getRequestURI in the ListAction, all I get is /appname/list.do. I guess this is a sort of natural thing for it to do, but how do I get the original URI? (/appname/welcome.do) Any help appreciated! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Double Execution of Struts Actions
Daniel Chacón Sánchez skrev: I understand all that, but It not have to happen, fot me its a bug, because the action don´t have to be call twice, no matter that the property of the td was wrong Use td bgcolor=#ff instead of td background=#ff. When you ask the browser to request the background image #ff, the browser will call the action again, because that is simply how it is designed. If you want to change to background color you must use the bgcolor attribute of td, not the background one. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get the original RequestURI?
Martin Gainty skrev: http://www.docjar.com/docs/api/org/apache/struts/action/Action.html#execute(org.apache.struts.action.ActionMapping,%20org.apache.struts.action.ActionForm,%20javax.servlet.http.HttpServletRequest,%20javax.servlet.http.HttpServletResponse) The second parameter of the Action execute method is 'ActionForm' What I want to retrieve the original request URL. I don't see how the ActionForm would help me with that. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get the original RequestURI?
You are absolutely right about that, I could modify PlaceAction to save the URL somewhere. But you see, I'm doing a lot of forwarding to the ListAction, and I don't want to change every Action that forwards to ListAction. Come on! There's got to be a way to find the original URL. Adam J Samere skrev: You could call getRequestURI in PlaceAction and set the result into a request attribute (assuming PlaceAction forwards to list.do, not a redirect) which would then be available to ListAction. If you are redirecting you would need to either set the value into the session, or append it as a request parameter to list.do. Not sure if there is a better way though. Adam David Grundberg wrote: Hi, I want to do something like this: 1. User enters http://localhost/appname/welcome.do 2. PlaceAction forwards to list.do 3. In ListAction, I want to retrieve the URL the user entered /appname/welcome.do. The problem: when I run getRequestURI in the ListAction, all I get is /appname/list.do. I guess this is a sort of natural thing for it to do, but how do I get the original URI? (/appname/welcome.do) Any help 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]
Re: How do I get the original RequestURI?
What? I'm sorry, but I'm not asking about how to assemble an URL. I want to retrieve the original URL sent by the browser in the request. The request.getRequestURL() is wrapped and modified with each forward, and I want the first, by the browser, requested URL. Since so many seem to misunderstand me: 1. User inputs http://localhost/appname/input.do; in browser. (Mapped to InputAction) 2. InputAction's request.getRequestURL() is http://localhost/appname/input.do; 3. InputAction forward to OtherAction. 4. The OtherAction's request.getRequestURL() is http://localhost/appname/other.do;. -- THIS ISN'T WHAT I WANT. I want to retrieve the URL http://localhost/appname/input.do; in the OtherAction WITHOUT modifying InputAction. How do I do this? Rimzim Sinha skrev: Try getContextPAth + gathRequestURL... Martin Gainty [EMAIL PROTECTED] wrote: http://www.docjar.com/docs/api/org/apache/struts/action/Action.html#execute(org.apache.struts.action.ActionMapping,%20org.apache.struts.action.ActionForm,%20javax.servlet.http.HttpServletRequest,%20javax.servlet.http.HttpServletResponse) The second parameter of the Action execute method is 'ActionForm' HTH, Martin- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: David Grundberg To: Struts Users Mailing List Sent: Sunday, September 10, 2006 8:46 AM Subject: How do I get the original RequestURI? Hi, I want to do something like this: 1. User enters http://localhost/appname/welcome.do 2. PlaceAction forwards to list.do 3. In ListAction, I want to retrieve the URL the user entered /appname/welcome.do. The problem: when I run getRequestURI in the ListAction, all I get is /appname/list.do. I guess this is a sort of natural thing for it to do, but how do I get the original URI? (/appname/welcome.do) Any help appreciated! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Why keep checking for Mail? The all-new Yahoo! Mail shows you when there are new messages. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get the original RequestURI?
He, I'm using Struts 1.2.7, and it's not there. :( Too bad for me. However, I think my problem must have been solved in some way, because what I'm trying to do isn't that remarkable. Some actions require the user to be logged in. I want to direct them to a login screen. When they successfully logged in, I want to return to where they came from. Is the only option to *redirect* to the login action and use the HTTP Referer-header to save where they came from? (Or send the returnurl as a GET-parameter to the login action) I guess action chaining is kind of evil. Hey, it's not like there is any actual, factual documentation about struts out there waiting for me to find it? I'm having a very hard time finding any hints how to accomplish things. Adam J Samere skrev: 1.2 does not have this behavior. You could either use a filter as I mentioned, or to stay within the struts framework either create a common base Action subclass, or subclass RequestProcessor or ActionMapping to add the desired functionality. Either way would be a trivial task. I agree with Don, action chaining is bad! :) Don Brown wrote: Well, first of all, action chaing is bad ;), but second, Struts 1.3 at least, and perhaps 1.2 automatically saves the original request uri for you. Look in the request under the o.a.struts.Globals.ORIGINAL_REQUEST_URI key. Don On 9/10/06, David Grundberg [EMAIL PROTECTED] wrote: You are absolutely right about that, I could modify PlaceAction to save the URL somewhere. But you see, I'm doing a lot of forwarding to the ListAction, and I don't want to change every Action that forwards to ListAction. Come on! There's got to be a way to find the original URL. Adam J Samere skrev: You could call getRequestURI in PlaceAction and set the result into a request attribute (assuming PlaceAction forwards to list.do, not a redirect) which would then be available to ListAction. If you are redirecting you would need to either set the value into the session, or append it as a request parameter to list.do. Not sure if there is a better way though. Adam David Grundberg wrote: Hi, I want to do something like this: 1. User enters http://localhost/appname/welcome.do 2. PlaceAction forwards to list.do 3. In ListAction, I want to retrieve the URL the user entered /appname/welcome.do. The problem: when I run getRequestURI in the ListAction, all I get is /appname/list.do. I guess this is a sort of natural thing for it to do, but how do I get the original URI? (/appname/welcome.do) Any help 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] - 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: How do I get the original RequestURI?
I got it working know, with no action chaining, and with redirects. The reason why I'm not using roles and J2EE security is because I haven't been able to figure out it is meant to work, and I just thought it would be easier to do myself. Any tips on how to start with the standard security and how to make integrate it with struts would be appreciated, however. Adam J Samere skrev: You didn't mention what you were trying to do was login related. You *could* render the target (original) URL as an input parameter in the generated markup when redirecting to the login page. Is there a reason you can't use the standard J2EE security and login configuration? This does exactly what you are trying to do, and handles checking whether the user is logged in, has the correct roles etc. for you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Token is wrapped by div/div
Antonio Petrelli wrote: MC Moisei ha scritto: When I use html:form with tokens the hidden token is wrapped by div. Is there a reason for that ? It messes up my layout and seems that Firefox is most affected by the div... form name=editForm method=post action=edit.do divinput type=hidden name=org.apache.struts.taglib.html.TOKEN value=ad973e398c964ca17174b3a9434b957d/div I think you're right, AFAIK usually the div tag adds also a new-line. I think that you should ask this question to Struts Developers list: http://struts.apache.org/mail.html Try to specify the stylesheet for this specific tag to display:none; It should remedy the problem. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Token is wrapped by div/div
MC Moisei wrote: That implies I cannot have divs without class or id... David Grundberg wrote: Try to specify the stylesheet for this specific tag to display:none; It should remedy the problem. Well, I suppose you'll have to use some tricks to make it work. div class=hidedivs html:form .. div class=workaround html:text ../ divs with class or id attributes left unspecified /div /html:form /div And stylesheets: div.hidedivs { display:none } div.workaround div { display:block; } Haven't tested it. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]