Re: Getting maxFileSize from Controller in a JSP
Raghuveer- Uh...I appreciate your help, but that's neither from within a JSP, nor does it tell me what the max file size is - it just tells me that the max file size has been exceeded. Right now I do what you've listed below, but in order to inform the user that the file is too large, I have to have the file size referenced in two different locations, one in the resource file and in the struts XML file for the module in which I am currently working - with comments to make sure any future developers change the number in both locations - my goal was to have the ability to reference the file size in one location only. I hope that was more clear. -adam Raghuveer wrote: for multipart request it can be checked in actionform as below. Boolean maxLengthExceeded = (Boolean)request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_E XCEEDED); if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())){ .. -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Friday, August 11, 2006 9:16 PM To: Struts Users Mailing List Subject: Getting maxFileSize from Controller in a JSP Is there a way to reference the controller for a module from within a JSP? Specifically, I'd like to ask the controller what the max file size is set to. There's a method on the ControllerConfig class to get the max file size and the Javadocs say it's a JavaBean so I suspect it might available from within a JSP, I just don't know the name (controller?) of the bean to reference in the JSP. Anyone know? thanks, -- adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting maxFileSize from Controller in a JSP
Adam Gordon wrote: Is there a way to reference the controller for a module from within a JSP? Specifically, I'd like to ask the controller what the max file size is set to. There's a method on the ControllerConfig class to get the max file size and the Javadocs say it's a JavaBean so I suspect it might available from within a JSP, I just don't know the name (controller?) of the bean to reference in the JSP. There's a module config that's stored as a request attribute. THe key is in the Globals class, I think it's MODULE_KEY. It has a reference to a controller config. Little utility method to find what's in request attributes: public static void debugRequestAttributes(HttpServletRequest request) { Enumeration attributeNames = request.getAttributeNames(); while (attributeNames.hasMoreElements()) { String a = attributeNames.nextElement(); log.debug(a + ": " + request.getAttribute(a)); } } -Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting maxFileSize from Controller in a JSP
Is there a way to reference the controller for a module from within a JSP? Specifically, I'd like to ask the controller what the max file size is set to. There's a method on the ControllerConfig class to get the max file size and the Javadocs say it's a JavaBean so I suspect it might available from within a JSP, I just don't know the name (controller?) of the bean to reference in the JSP. Anyone know? thanks, -- adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]