problem in file upload
Hi All, I am using file upload interceptor to upload a file. I am returning XML response (using result type as stream) to the caller in case of success or failure. Its all fine, if everything works as expected. When I try to upload a file which is bigger then the max allowed size, the file upload interceptor returns input and the control does not come to the execute method of my action class. In this case I can redirect the result to some JSP, to some other action etc, but how do I return a xml response with the error description and some error code. Please help me out. Regards, Rajeev Sharma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 s:a URL tag problems
hi try it s:url id=viewURL namespace=/account action=view / s:a href=%{viewURL} View Your Account /s:a My english is not good hope this can help you gordian On Wed, Apr 9, 2008 at 6:00 PM, ancatdubher [EMAIL PROTECTED] wrote: Hi, I use the Struts 2 tag to generate my URLs. For example to generate the URL /account/view.action, I do: s:url id=viewURL namespace=account action=view / s:a href=%{viewURL} View Your Account /s:a But each click on this URL inserts an extra namespace prefix into the generated URL. I mean, after clicking 5 times on the View Your Account link, my address bar reads: http://localhost/mysite/account/account/account/account/account/view.action This still takes me to the correct page, but... What am I missing? Thanks, Ancat. -- View this message in context: http://www.nabble.com/Struts-2-%3Cs%3Aa%3E-URL-tag-problems-tp16583543p16583543.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2 s:a URL tag problems
Hi, I use the Struts 2 tag to generate my URLs. For example to generate the URL /account/view.action, I do: s:url id=viewURL namespace=account action=view / s:a href=%{viewURL} View Your Account /s:a But each click on this URL inserts an extra namespace prefix into the generated URL. I mean, after clicking 5 times on the View Your Account link, my address bar reads: http://localhost/mysite/account/account/account/account/account/view.action This still takes me to the correct page, but... What am I missing? Thanks, Ancat. -- View this message in context: http://www.nabble.com/Struts-2-%3Cs%3Aa%3E-URL-tag-problems-tp16583543p16583543.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to set dynamic name for html:radio
hi... i am using html:radio tag lib in struts 1.3.5, I am in a requirement that we need to give the names of the html form components dynamically...(ie) if i say html:radio name=feedbackForm property=ratting indexed=true value=1 / html:radio name=feedbackForm property=ratting indexed=true value=2 / above code goes inside an interation the html outputs as !--input type=radio name=feedbackForm[0].ratting value=1/--! !--input type=radio name=feedbackForm[0].ratting value=2/--! where the names of the html form components are the indexed property of the feedbackForm where us i need set some other name say... overalrating for both the components is there any way to achive so...? thanks in advance... Balaji.M -- View this message in context: http://www.nabble.com/how-to-set-dynamic-name-for-html%3Aradio-tp16584936p16584936.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: date conversion
Also, consider to inject the format in your IoC container (Guice, Spring, etc). Zoran Avtarovski wrote: We had the same issue and went with writing a new converter (shown below). And then created a xwork-conversion.properties file pointing to it. Z. private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(dd/MM/); @Overridepublic Object convertFromString(Map context, String[] values, Class toType) throws TypeConversionException {try {return DATE_FORMAT.parse( values[0]);} catch (ParseException e) { e.printStackTrace();throw new TypeConversionException(xwork.default.invalid.fieldvalue);} return null;} @Overridepublic String convertToString(Map context, Object object) {Calendar cal = Calendar.getInstance(); cal.setTime((Date) object);try { return DATE_FORMAT.format(object);} catch (Exception e) { throw new TypeConversionException(xwork.default.invalid.fieldvalue); }} Can you patch a whole class? What would be useful is parameterizable type converters, to specify the date format in this case. (they're not parameterizable, are they?) Dave Newton on 08/04/08 22:13, wrote: --- Adam Hardy [EMAIL PROTECTED] wrote: One area where S1 actually had the upper hand :( Submit a patch :) Dave Dave Newton on 08/04/08 18:36, wrote: The built-in type converter uses uses the SHORT format for the Locale associated with the current request according to the type conversion docs, so yes, you'll need to do your own if you're using a different input format. Looking through the XWork conversion code it's hard for me to tell what it's *actually* doing, though :/ Dave --- Brad A Cupit [EMAIL PROTECTED] wrote: JSTL has the fmt:formatDate tag. If you want to do it in Java, rather than your JSP, you can use SimpleDateFormat. Be aware that SimpleDataFormat is not thread safe, so don't assign it to a static field or use it in a singleton. If you use it as an instance field on an Action you'll be safe, since Actions are created per request. If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang has FastDateFormat: http://commons.apache.org/lang/ Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 12:11 PM To: Struts Users Mailing List Subject: date conversion Hi quick question, I can't find any specific mention of what I want so I assume I have to code my own Converter. I need a date in the ISO format -MM-DD There is no converter that I can configure in the struts package, is there? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Alberto A. Flores http://www.linkedin.com/in/aflores - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in file upload
Rajeev Sharma wrote: When I try to upload a file which is bigger then the max allowed size, the file upload interceptor returns input and the control does not come to the execute method of my action class. In this case I can redirect the result to some JSP, to some other action etc, but how do I return a xml response with the error description and some error code. Hi Rajeev, It sounds like you just want an action to return an XML result (for an input result). A very simple way to do that is return a JSP with contentType=text/xml. in struts.xml: result name=inputfailed.jsp/result in the failed.jsp: %@ page contentType=text/xml;charset=ISO-8859-1 % ?xml version=1.0 encoding=ISO-8859-1? messageToo big!/message You can use properties in your XML as you would with a JSP result. There's also an XSLT result type available or you could use a Bean-XML serializer like XStream. Hope that helps, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with struts in JSP
This line: s:if test=${marca.claseDeMarca != null} should read: s:if test=%{marca.claseDeMarca != null} The first from instructs the container to evaluate the expression as EL. The second form instructs the tag to evaluate the expression as OGNL. You must be using struts 2.0.10 as the first form is no longer permitted within struts tags. Assuming your deployments are identical, the only reason the first form could yield a different result is if the containers are different in their evaluation of the EL. De Landa Gil Agustin wrote: Hello I have a very strange problem. I have an application that we developed in JAVA and the application works ok in Windows. We recentl deployed the same application in Linux REDHAT and the application seemed to worked fine, until the user reported to us a problem. After doing research it happens that in Linux RedHat instructions like this: s:if test=${marca.claseDeMarca != null} All of our jsp pages do not work at all, while in Windows they work ok. Looks like a Struts problem to us. This makes the appplication in linux to work incorrectly as the test always evaluates to FALSE and in windows the test evaluates to TRUE. We use Oracle Database and the tomcat version we have is JAKARTA-TOMCAT-5.0.28 Any help will be appreciated. Agustin. Agustín de Landa Gil Grupo Industrial Saltillo Tel: (844) 411-7114 Ext. 7114 Fax: (844) 411 7105 [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] == NOTICE: This e-mail transmission, and any other documents, like files or previous-mail messages attached to it, may contain confidential or privileged information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender, permanently delete it and destroy any copies of it that were printed out. Grupo Industrial Saltillo is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Thank you. Visit us at www.gis.com.mxfile:///C:\Documents%20and%20Settings\agustin.delanda\Datos%20de%20programa\Microsoft\Signatures\www.gis.com.mx http://www.gis.com.mx/ AVISO: Este correo electrónico, y cualquier otro documento, como archivos o mensajes previos adjuntos, pueden contener información de tipo privilegiada y/o confidencial. Si usted no es el destinatario, o la persona responsable para entregarlo al destinatario, se le notifica que cualquier revelación, copiado, distribución o uso de cualquier información contenida o adjunta a este mensaje esta ESTRICTAMENTE PROHIBIDA. Si usted recibió este correo electrónico por error, por favor, notifique inmediatamente al remitente, elimínelo permanentemente y destruya cualquier copia que haya sido impresa. Grupo Industrial Saltillo no es responsable por la correcta transmision de la informacion contenida en este medio, o de cualquier retraso del mismo con respecto a la entrega al destinatario. Gracias. Visite nuestra página en www.gis.com.mxfile:///C:\Documents%20and%20Settings\agustin.delanda\Datos%20de%20programa\Microsoft\Signatures\www.gis.com.mx http://www.gis.com.mx/ == No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.9/1364 - Release Date: 7/04/2008 6:38 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: date conversion
the static SimpleDateFormat (assuming this code is in an S2 Action that is instantiated per request) is not thread safe. http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy nchronization Brad Cupit Louisiana State University - UIS -Original Message- From: Zoran Avtarovski [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 7:30 PM To: Struts Users Mailing List Subject: Re: date conversion We had the same issue and went with writing a new converter (shown below). And then created a xwork-conversion.properties file pointing to it. Z. private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(dd/MM/); @Overridepublic Object convertFromString(Map context, String[] values, Class toType) throws TypeConversionException {try {return DATE_FORMAT.parse( values[0]);} catch (ParseException e) { e.printStackTrace();throw new TypeConversionException(xwork.default.invalid.fieldvalue); } return null;} @Overridepublic String convertToString(Map context, Object object) {Calendar cal = Calendar.getInstance(); cal.setTime((Date) object);try { return DATE_FORMAT.format(object);} catch (Exception e) { throw new TypeConversionException(xwork.default.invalid.fieldvalue); }} Can you patch a whole class? What would be useful is parameterizable type converters, to specify the date format in this case. (they're not parameterizable, are they?) Dave Newton on 08/04/08 22:13, wrote: --- Adam Hardy [EMAIL PROTECTED] wrote: One area where S1 actually had the upper hand :( Submit a patch :) Dave Dave Newton on 08/04/08 18:36, wrote: The built-in type converter uses uses the SHORT format for the Locale associated with the current request according to the type conversion docs, so yes, you'll need to do your own if you're using a different input format. Looking through the XWork conversion code it's hard for me to tell what it's *actually* doing, though :/ Dave --- Brad A Cupit [EMAIL PROTECTED] wrote: JSTL has the fmt:formatDate tag. If you want to do it in Java, rather than your JSP, you can use SimpleDateFormat. Be aware that SimpleDataFormat is not thread safe, so don't assign it to a static field or use it in a singleton. If you use it as an instance field on an Action you'll be safe, since Actions are created per request. If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang has FastDateFormat: http://commons.apache.org/lang/ Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 12:11 PM To: Struts Users Mailing List Subject: date conversion Hi quick question, I can't find any specific mention of what I want so I assume I have to code my own Converter. I need a date in the ISO format -MM-DD There is no converter that I can configure in the struts package, is there? - 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: date conversion
Consider placing the SimpleDateFormat as a local variable (within the method) to avoid non-thread safe operations (guaranteed by the jvm spec). Brad A Cupit wrote: the static SimpleDateFormat (assuming this code is in an S2 Action that is instantiated per request) is not thread safe. http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy nchronization Brad Cupit Louisiana State University - UIS -Original Message- From: Zoran Avtarovski [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 7:30 PM To: Struts Users Mailing List Subject: Re: date conversion We had the same issue and went with writing a new converter (shown below). And then created a xwork-conversion.properties file pointing to it. Z. private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(dd/MM/); @Overridepublic Object convertFromString(Map context, String[] values, Class toType) throws TypeConversionException {try {return DATE_FORMAT.parse( values[0]);} catch (ParseException e) { e.printStackTrace();throw new TypeConversionException(xwork.default.invalid.fieldvalue); } return null;} @Overridepublic String convertToString(Map context, Object object) {Calendar cal = Calendar.getInstance(); cal.setTime((Date) object);try { return DATE_FORMAT.format(object);} catch (Exception e) { throw new TypeConversionException(xwork.default.invalid.fieldvalue); }} Can you patch a whole class? What would be useful is parameterizable type converters, to specify the date format in this case. (they're not parameterizable, are they?) Dave Newton on 08/04/08 22:13, wrote: --- Adam Hardy [EMAIL PROTECTED] wrote: One area where S1 actually had the upper hand :( Submit a patch :) Dave Dave Newton on 08/04/08 18:36, wrote: The built-in type converter uses uses the SHORT format for the Locale associated with the current request according to the type conversion docs, so yes, you'll need to do your own if you're using a different input format. Looking through the XWork conversion code it's hard for me to tell what it's *actually* doing, though :/ Dave --- Brad A Cupit [EMAIL PROTECTED] wrote: JSTL has the fmt:formatDate tag. If you want to do it in Java, rather than your JSP, you can use SimpleDateFormat. Be aware that SimpleDataFormat is not thread safe, so don't assign it to a static field or use it in a singleton. If you use it as an instance field on an Action you'll be safe, since Actions are created per request. If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang has FastDateFormat: http://commons.apache.org/lang/ Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 12:11 PM To: Struts Users Mailing List Subject: date conversion Hi quick question, I can't find any specific mention of what I want so I assume I have to code my own Converter. I need a date in the ISO format -MM-DD There is no converter that I can configure in the struts package, is there? - 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] -- Alberto A. Flores http://www.linkedin.com/in/aflores - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: date conversion
Consider placing the SimpleDateFormat as a local variable exactly right or, consider using a ThreadLocal or, consider using commons-lang's FastDateFormat http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/ FastDateFormat.html Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Alberto A. Flores [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 09, 2008 7:48 AM To: Struts Users Mailing List Subject: Re: date conversion Consider placing the SimpleDateFormat as a local variable (within the method) to avoid non-thread safe operations (guaranteed by the jvm spec). Brad A Cupit wrote: the static SimpleDateFormat (assuming this code is in an S2 Action that is instantiated per request) is not thread safe. http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy nchronization Brad Cupit Louisiana State University - UIS -Original Message- From: Zoran Avtarovski [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 7:30 PM To: Struts Users Mailing List Subject: Re: date conversion We had the same issue and went with writing a new converter (shown below). And then created a xwork-conversion.properties file pointing to it. Z. private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(dd/MM/); @Overridepublic Object convertFromString(Map context, String[] values, Class toType) throws TypeConversionException {try {return DATE_FORMAT.parse( values[0]);} catch (ParseException e) { e.printStackTrace();throw new TypeConversionException(xwork.default.invalid.fieldvalue); } return null;} @Overridepublic String convertToString(Map context, Object object) {Calendar cal = Calendar.getInstance(); cal.setTime((Date) object);try { return DATE_FORMAT.format(object);} catch (Exception e) { throw new TypeConversionException(xwork.default.invalid.fieldvalue); }} Can you patch a whole class? What would be useful is parameterizable type converters, to specify the date format in this case. (they're not parameterizable, are they?) Dave Newton on 08/04/08 22:13, wrote: --- Adam Hardy [EMAIL PROTECTED] wrote: One area where S1 actually had the upper hand :( Submit a patch :) Dave Dave Newton on 08/04/08 18:36, wrote: The built-in type converter uses uses the SHORT format for the Locale associated with the current request according to the type conversion docs, so yes, you'll need to do your own if you're using a different input format. Looking through the XWork conversion code it's hard for me to tell what it's *actually* doing, though :/ Dave --- Brad A Cupit [EMAIL PROTECTED] wrote: JSTL has the fmt:formatDate tag. If you want to do it in Java, rather than your JSP, you can use SimpleDateFormat. Be aware that SimpleDataFormat is not thread safe, so don't assign it to a static field or use it in a singleton. If you use it as an instance field on an Action you'll be safe, since Actions are created per request. If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang has FastDateFormat: http://commons.apache.org/lang/ Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 12:11 PM To: Struts Users Mailing List Subject: date conversion Hi quick question, I can't find any specific mention of what I want so I assume I have to code my own Converter. I need a date in the ISO format -MM-DD There is no converter that I can configure in the struts package, is there? - 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] -- Alberto A. Flores http://www.linkedin.com/in/aflores - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts.xml
Hi, Can anyone point me to where the seperate sections of the struts.xml file is described ? I am specifically looking at what the valid values in the result type=???/ element are ? Many thanks Ian - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. -
Re: struts.xml
All this is linked right from the Core Developers Guide at http://struts.apache.org/2.x/docs/guides.html. Click the result types link and there you go. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Ian Meikle [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 9 Apr 2008 16:33:40 +0200 To: Struts Users Mailing List user@struts.apache.org Subject: struts.xml Hi, Can anyone point me to where the seperate sections of the struts.xml file is described ? I am specifically looking at what the valid values in the result type=???/ element are ? Many thanks Ian -- -- - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. -- -- - This email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts.xml
Well this give me some info, but for example it does not explain what all the valid values of the type attribute are and what each value means. Is this documented anywhere ? Regards Ian - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - Randy Burgess [EMAIL PROTECTED] 09.04.2008 16:37 Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: struts.xml All this is linked right from the Core Developers Guide at http://struts.apache.org/2.x/docs/guides.html. Click the result types link and there you go. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Ian Meikle [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 9 Apr 2008 16:33:40 +0200 To: Struts Users Mailing List user@struts.apache.org Subject: struts.xml Hi, Can anyone point me to where the seperate sections of the struts.xml file is described ? I am specifically looking at what the valid values in the result type=???/ element are ? Many thanks Ian -- -- - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. -- -- - This email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts.xml
Well this give me some info, but for example it does not explain what all the valid values of the type attribute are and what each value means. Is this documented anywhere ? Look into the struts2-core.jar and find struts-default.xml, that will give more information, then you can look here: http://struts.apache.org/2.x/docs/result-types.html Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in file upload
Hi Jeromy, Thanks for the help. I tried to do the same thing with an xml file. Instead of using failed.jsp, I returned an xml file failed.xml with some hard coded error message and error code. What if the file upload interceptor returned input for some other reason? I would be returning the error code and message which says the file is too large. How would I create the error message and code dynamically depending on the actual error? Rajeev On Wed, 2008-04-09 at 22:22 +1000, Jeromy Evans wrote: Rajeev Sharma wrote: When I try to upload a file which is bigger then the max allowed size, the file upload interceptor returns input and the control does not come to the execute method of my action class. In this case I can redirect the result to some JSP, to some other action etc, but how do I return a xml response with the error description and some error code. Hi Rajeev, It sounds like you just want an action to return an XML result (for an input result). A very simple way to do that is return a JSP with contentType=text/xml. in struts.xml: result name=inputfailed.jsp/result in the failed.jsp: %@ page contentType=text/xml;charset=ISO-8859-1 % ?xml version=1.0 encoding=ISO-8859-1? messageToo big!/message You can use properties in your XML as you would with a JSP result. There's also an XSLT result type available or you could use a Bean-XML serializer like XStream. Hope that helps, Jeromy Evans - 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: struts.xml
ResultTypes are illustrated here http://struts.apache.org/2.x/docs/result-types.html Is there anything specific you were looking for? Tak/ Martin- - Original Message - From: Ian Meikle [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, April 09, 2008 1:40 PM Subject: Re: struts.xml Hi Lukasz, Thanks very much for that. This has given me the info I needed. Regards Ian CSC Solutions Norge AS Registered Office: Sandsliåsen 57, 5254 Sandsli, Norway Registered in Norway No: 958 958 455 - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - Lukasz Lenart [EMAIL PROTECTED] 09.04.2008 17:15 Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: struts.xml Well this give me some info, but for example it does not explain what all the valid values of the type attribute are and what each value means. Is this documented anywhere ? Look into the struts2-core.jar and find struts-default.xml, that will give more information, then you can look here: http://struts.apache.org/2.x/docs/result-types.html Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - 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: problem in file upload
If you dont mind using freemarker you can always use exception-interceptor.html http://struts.apache.org/2.x/docs/exception-interceptor.html M-- - Original Message - From: Rajeev Sharma [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, April 09, 2008 1:59 PM Subject: Re: problem in file upload Hi Jeromy, Thanks for the help. I tried to do the same thing with an xml file. Instead of using failed.jsp, I returned an xml file failed.xml with some hard coded error message and error code. What if the file upload interceptor returned input for some other reason? I would be returning the error code and message which says the file is too large. How would I create the error message and code dynamically depending on the actual error? Rajeev On Wed, 2008-04-09 at 22:22 +1000, Jeromy Evans wrote: Rajeev Sharma wrote: When I try to upload a file which is bigger then the max allowed size, the file upload interceptor returns input and the control does not come to the execute method of my action class. In this case I can redirect the result to some JSP, to some other action etc, but how do I return a xml response with the error description and some error code. Hi Rajeev, It sounds like you just want an action to return an XML result (for an input result). A very simple way to do that is return a JSP with contentType=text/xml. in struts.xml: result name=inputfailed.jsp/result in the failed.jsp: %@ page contentType=text/xml;charset=ISO-8859-1 % ?xml version=1.0 encoding=ISO-8859-1? messageToo big!/message You can use properties in your XML as you would with a JSP result. There's also an XSLT result type available or you could use a Bean-XML serializer like XStream. Hope that helps, Jeromy Evans - 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: date conversion
the synchronized is not needed Adam Hardy wrote: Actually I use it in a static method on a utility class, and call SimpleDateFormat inside a synchronized block. Brad A Cupit on 09/04/08 13:51, wrote: Consider placing the SimpleDateFormat as a local variable exactly right or, consider using a ThreadLocal or, consider using commons-lang's FastDateFormat http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/ FastDateFormat.html Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Alberto A. Flores [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 09, 2008 7:48 AM To: Struts Users Mailing List Subject: Re: date conversion Consider placing the SimpleDateFormat as a local variable (within the method) to avoid non-thread safe operations (guaranteed by the jvm spec). Brad A Cupit wrote: the static SimpleDateFormat (assuming this code is in an S2 Action that is instantiated per request) is not thread safe. http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy nchronization Brad Cupit Louisiana State University - UIS -Original Message- From: Zoran Avtarovski [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 7:30 PM To: Struts Users Mailing List Subject: Re: date conversion We had the same issue and went with writing a new converter (shown below). And then created a xwork-conversion.properties file pointing to it. Z. private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(dd/MM/); @Overridepublic Object convertFromString(Map context, String[] values, Class toType) throws TypeConversionException {try {return DATE_FORMAT.parse( values[0]);} catch (ParseException e) { e.printStackTrace();throw new TypeConversionException(xwork.default.invalid.fieldvalue); } return null;} @Overridepublic String convertToString(Map context, Object object) {Calendar cal = Calendar.getInstance(); cal.setTime((Date) object);try { return DATE_FORMAT.format(object);} catch (Exception e) { throw new TypeConversionException(xwork.default.invalid.fieldvalue); }} Can you patch a whole class? What would be useful is parameterizable type converters, to specify the date format in this case. (they're not parameterizable, are they?) Dave Newton on 08/04/08 22:13, wrote: --- Adam Hardy [EMAIL PROTECTED] wrote: One area where S1 actually had the upper hand :( Submit a patch :) Dave Dave Newton on 08/04/08 18:36, wrote: The built-in type converter uses uses the SHORT format for the Locale associated with the current request according to the type conversion docs, so yes, you'll need to do your own if you're using a different input format. Looking through the XWork conversion code it's hard for me to tell what it's *actually* doing, though :/ Dave --- Brad A Cupit [EMAIL PROTECTED] wrote: JSTL has the fmt:formatDate tag. If you want to do it in Java, rather than your JSP, you can use SimpleDateFormat. Be aware that SimpleDataFormat is not thread safe, so don't assign it to a static field or use it in a singleton. If you use it as an instance field on an Action you'll be safe, since Actions are created per request. If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang has FastDateFormat: http://commons.apache.org/lang/ Brad Cupit Louisiana State University - UIS e-mail: [EMAIL PROTECTED] office: 225.578.4774 -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 08, 2008 12:11 PM To: Struts Users Mailing List Subject: date conversion Hi quick question, I can't find any specific mention of what I want so I assume I have to code my own Converter. I need a date in the ISO format -MM-DD There is no converter that I can configure in the struts package, is there? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Alberto A. Flores http://www.linkedin.com/in/aflores - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need help getting started with remote tabs
Is there a complete working example for the tabbedPanel tag? I found this example in the tag reference document. How do I set up the result for AjaxTest.action? I loaded the dynamic contents in that action and directed it to the jsp that displays that content. The action was invoked, but the tab shows up empty. I tried to include the jsp inside the s:div tag and still nothing. s:tabbedpanel id=test beforeSelectTabNotifyTopics=/beforeSelect s:div id=three label=remote theme=ajax href=/AjaxTest.action One Tab /s:div s:div id=three label=remote theme=ajax href=/AjaxTest.action Another tab /s:div /s:tabbedpanel Thanks a lot for your help, Jane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2: How to put validation.xml and Action.java in separate folders
For Struts 2: Does anyone know if it is possible to put the validation.xml for an Action in a folder other than where the action resides? If I have a 100 java classes in my action package, I would like their *-validation.xmls to be in a separate folder such that all .java's are together and all .xml's are together. I couldn't find any configuration in struts2 to achieve this. Any help is appreciated. Thanks. -- View this message in context: http://www.nabble.com/Struts2%3A-How-to-put-validation.xml-and-Action.java-in-separate-folders-tp16596604p16596604.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Local Host Error
I hope you have long legs because you're trying to climb 2 very steep mountains simultaneously 1st) subscribe to tomcat-users list..the folks that answer your question eat/live and breathe TC 24/7 http://tomcat.apache.org/lists.html#tomcat-users then of course you'll want to look at getting your TC Version up and running and fully operational http://tomcat.apache.org/ A rather nice explanation located here http://www.coreservlets.com/Apache-Tomcat-Tutorial/ 2) getting Struts Webapp up and running If this is the first time for both you have a rather steep climb ahead http://exadel.com/tutorial/struts/5.2/guess/strutsintro.html All kinds of wonderful doc/tutorials and distros available from the official Struts site located at http://struts.apache.org/2.x/ suggestions gentlemen? M- - Original Message - From: Hartford Cory-C23423 [EMAIL PROTECTED] To: user@struts.apache.org Sent: Wednesday, April 09, 2008 5:14 PM Subject: Local Host Error Hello. To preface I am very new to using Apache. I am attempting to experiment locally, however I cannot connect to local host nor the 127.0.0.1 directly. I am looking to try and get the IT works! Apache screen to display, but to no avail thus far. I have verified that my host config file in windows\system32\drivers\hosts shows the correct ip. I am using Window 2000 and do have Norton antivirus; however, no client firewall. Thanks for the help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Commons Validator Issue with Collections
Neither Commons Validator nor Struts knows how to process XML requests like that out of the box. Assuming Struts 1, the answer is that you will have to write your own logic to populate the form bean from the XML request, after which validation can be performed the same as you would with a regular request. L. Ghaznavi, Syed wrote: It's a question regarding commons validator api, wherein i am trying to validate an input request form (xml-request) which contains a collection of items...like OrdersInputRequest Order OrderId222/OderId OrderDate04/04/2004/OrderDate /Order Order OrderId223/OderId OrderDate04/04/2004/OrderDate /Order /OrderInputRequest What would be the valid format for the commons-validator form to validate this input request? Since there can be any number of Orders (java.util.ArrayList) in the request and all the items have the same validation. I looked at the examples on the project but couldn't find any solution... * formset form name=OrdersRequestValidationForm field property=OrderId type=Integer depends=required /field field property=OrderDate type=String depends=required /field /form /formset * Any assistance on this is appreciated.. Thanks! --Syed Ghaznavi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preparable Question
manishbel wrote: Hello, I am trying to use the Preparable but having some problems while the page is being rendered. I will try my best to explain the problem, please ask if you need more information as i might not be able to accurately explain the problem as i am pretty new to struts2. Scenario: User should be able to create the EmailDistributionList and create email Addresses under it. My first attempt is to be able to create the Group Itself . So i introduced an action which implements Preparable interface. The Action provides 1.) List of currently avaialable groups- displayed as dropdown on the screen. 2.) has a group id based on which it tries to decide whether to load data from the databse or not. e.g. if the user lands for the first time on the page there would be no id in the rquest hence the id would not have any data in it. it is similar to the CRUD example on struts website. Creation and saving of the group went ok, the problem occured when i load the data from the databse and try to display it on the screen. i have defined just one action in struts.xml to accomplish this. when the user arrives for the first time through the menu item which is of course a get request , the user is provided with list of available groups and a blank description field (since it does not have any id in the request). When the user changes selection in the drop down i do a post to the same action which binds the id to group id field in the action. It works ok as far as it has the id in the request and loads the data from the databse and stuff. but as soon as it reaches the screen and when it tries to extract data out of the domain it wipes out the fields from the group domain, e.g. If the Group had id name and description, and i try to display the description on the page like s:textarea name=group.description/ the page shows nothing in it even though the id was passed to the action and logger statements show that the group has the description on the server side. I used s:debug/ tag to see more information but even in that information it shows that the description is blank. I am trying to solve this problem for a long time but have been unsuccessful in resolving it, your help would be greatly appreciated. Firstly, this doesn't appear to have anything to do with the Preparale interface, it would seem to be a problem with data rendering (since you say the group is retrieved correctly). Start with the basics: - Does you action have a getGroup() getter defined? - Does it correctly return the group loaded from the database? - Does the group returned by getGroup() actually contain data? I'd suggest adding some logging in your getGroup() method to confirm that it's really returning the data you think it should be. If that checks out, there's likely a problem in your JSP somewhere. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2: How to put validation.xml and Action.java in separate folders
goelshek wrote: For Struts 2: Does anyone know if it is possible to put the validation.xml for an Action in a folder other than where the action resides? If I have a 100 java classes in my action package, I would like their *-validation.xmls to be in a separate folder such that all .java's are together and all .xml's are together. I couldn't find any configuration in struts2 to achieve this. You can put the .xml files in a separate folder from the .java files, sure, as long as your build process copies them to the right place on the classpath. I don't think there's a way to have them in a different folder than the .class files though. Sounds like you'd be better off breaking out your actions into sub-packages anyway. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2: How to put validation.xml and Action.java in separate folders
as your build process copies them to the right place on the classpath. I don't think there's a way to have them in a different folder than the .class files though I don't really have a formal build process for now. So what's in my /WEB-INF/src folder is going to be in my /WEB-INF/classes folder with the .class files instead of the .java files. So yes, I do want to be able to have .xml and .class files (not just .java files) in separate folders; my bad on that one, I should have been more explicit. Sounds like you'd be better off breaking out your actions into sub-packages anyway. I agree. 100 was an exaggerated number, just to make a point of what I am looking for. Laurie Harper wrote: goelshek wrote: For Struts 2: Does anyone know if it is possible to put the validation.xml for an Action in a folder other than where the action resides? If I have a 100 java classes in my action package, I would like their *-validation.xmls to be in a separate folder such that all .java's are together and all .xml's are together. I couldn't find any configuration in struts2 to achieve this. You can put the .xml files in a separate folder from the .java files, sure, as long as your build process copies them to the right place on the classpath. I don't think there's a way to have them in a different folder than the .class files though. Sounds like you'd be better off breaking out your actions into sub-packages anyway. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts2%3A-How-to-put-validation.xml-and-Action.java-in-separate-folders-tp16596604p16598238.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
Hi Matt, is it only the @s.text tag that isn't working? eg. is @s.property working? I've suspected there's a problem with the text tag and i18n tag not finding some resource bundles in the S2.1.1 branch but haven't had a chance to investigate. There's several related issues in JIRA and I recall something specifically about package-level properties. I may have an opportunity to investigate later today. Does it find resources in your action-properties or global properties? cheers, Jeromy Evans mraible wrote: I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins. FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in my decorator. In src/main/resources/com/company/app/package.properties, I have: webapp.name=Foo webapp.tagline=Bar In my decorators/default.ftl, I have: [EMAIL PROTECTED] name=webapp.name/] And it renders: webapp.name Any idea why my Struts FreeMarker tag isn't being processed? I have the following in my web.xml: filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Most popular classes to be used in Struts
Hi, What are the most popular classes to be used in Struts? Thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
S2 Textfield tag date formatting
I'm trying to use a textfield tag for date input. I need to format this in the form dd/MM/ HH:mm:ss The teaxtfield tag formats the date to a Locale based format DateFormat.SHORT via XWorkBasicConverter. For my locale this turns out to be dd/MM/yy. This is not the format I want. s:textfield cssClass=field key=filter.dateTimeStart name=filter.dateTimeStart/ DateTimePicker wont allow you to apply a style class to the input field so it wont format. Bug has been reported in Struts JIRA (WW-1778) and a fix made. Need to wait for Struts 2.1 before this will work so I can't use this. Using the value parameter and a date tag won't work because this overwrites the value entered. If the user enters a value that can't be converted to a date it isn't re-displayed, the field is displayed empty. s:textfield cssClass=field key=filter.dateTimeStart name=filter.dateTimeStart s:param name=value s:date name=filter.dateTimeStart format=dd/MM/ HH:mm:ss / /s:param /s:textfield In the S2 guide for Type Conversion ( http://struts.apache.org/2.x/docs/type-conversion.html) it has a note saying not to use Type Conversion for dates. Does anyone know of a way to do this? Thanks in advance.
Re: i18n Tags in FreeMarker Decorator for SiteMesh
I tried [EMAIL PROTECTED] value=text('key')/] and that doesn't seem to work either. I don't have a struts.xml or struts.properties in my project. I tried putting the i18n bundle in all packages using it at the Action level (ActionName.properties), but that didn't work either. Creating a src/main/resources/struts.properties with the following in it is the only thing that seems to work. struts.custom.i18n.resources=messages And then putting my keys in src/main/resources/messages.properties. AFAICT, i18n bundles at the action/package level seems to be completely broken in 2.1.1. Matt Jeromy Evans - Blue Sky Minds wrote: Hi Matt, is it only the @s.text tag that isn't working? eg. is @s.property working? I've suspected there's a problem with the text tag and i18n tag not finding some resource bundles in the S2.1.1 branch but haven't had a chance to investigate. There's several related issues in JIRA and I recall something specifically about package-level properties. I may have an opportunity to investigate later today. Does it find resources in your action-properties or global properties? cheers, Jeromy Evans mraible wrote: I'm using 2.1.1-SNAPSHOT of the sitemesh and rest plugins. FreeMarker/SiteMesh is working fine. However, I'm unable to use i18n tags in my decorator. In src/main/resources/com/company/app/package.properties, I have: webapp.name=Foo webapp.tagline=Bar In my decorators/default.ftl, I have: [EMAIL PROTECTED] name=webapp.name/] And it renders: webapp.name Any idea why my Struts FreeMarker tag isn't being processed? I have the following in my web.xml: filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/i18n-Tags-in-FreeMarker-Decorator-for-SiteMesh-tp16599500p16601141.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i18n Tags in FreeMarker Decorator for SiteMesh
mraible wrote: I tried [EMAIL PROTECTED] value=text('key')/] I've already found that in 2.0.x this OGNL expression executed getText(String) but in 2.1.x it only matches the method text(String). I'm not sure when that changed in the OGNL implementation, but the new form seems correct as it's method call not a property. I've already replaced one occurrence of text('key') with getText('key') in the code but there's probably others. That's one of the consequences of allowing loosely typed expressions to creep into code. I'll definitely look further into this today as its been affecting me for a while too. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to open a page in new window with s:a or s:url tag?
I am using Struts 2. I want to open the page in the new window when I click on an icon. I am using s:a tag and giving action by s:url tag. i.e., s:url id='abc' action='xyz',/s:url s:a href='%{abc}'/s:a This way it is opening an action in same page. I want it in the new window like in HTML tag we can do it by link . What is the way in struts 2 for this..? -- View this message in context: http://www.nabble.com/How-to-open-a-page-in-new-window-with-%3Cs%3Aa%3E-or-%3Cs%3Aurl%3E-tag--tp16601857p16601857.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using jsp tag in Value attribute of textfield tag in Struts2
Hi Is there a way to include value for textfield tag in struts2 , Im trying the following : tds:textfield name=firstName label=*First Name size=15 value=%=freshUser.getFirstName() %//td But I get tld error.. Please let me know how I could use jsp tag in the textfield tag, or let me know an alternative... Thanks in Advance, Tauri. -- View this message in context: http://www.nabble.com/Using-jsp-tag-in-Value-attribute-of-textfield-tag-in-Struts2-tp16602523p16602523.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]