Re: bean:write format attribute changes bean:write default behavior
Oleg, I'm sorry, but I'm not at all clear as to what you are saying here. Could you please restate it? Will - Original Message - From: Oleg V Alexeev [EMAIL PROTECTED] To: Struts Developers List [EMAIL PROTECTED]; Deadman, Hal [EMAIL PROTECTED] Sent: Wednesday, December 05, 2001 8:50 AM Subject: Re: bean:write format attribute changes bean:write default behavior Hello Hal, You can add to application resources strings with default format strings for such types as (first string - key for resources, nested strings is list of datatypes) - org.apache.struts.taglib.bean.format.int java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Long, java.math.BigInteger org.apache.struts.taglib.bean.format.float java.lang.Float, java.lang.Double, java.math.BigDecimal org.apache.struts.taglib.bean.format.timestamp java.sql.Timestamp org.apache.struts.taglib.bean.format.date java.sql.Date org.apache.struts.taglib.bean.format.time java.sql.Time Tuesday, December 04, 2001, 5:07:56 AM, you wrote: DH I have some code that uses bean:write and the datetime:format tag from DH taglibs project. I use it like this: DH datetime:format pattern=MM/dd/bean:write name=contractinfo DH property=beginDate.time//datetime:format DH The bean:write used to print out the number of milliseconds returned by DH getBeginDate().getTime(). DH I got a nightly build and now the bean:write prints the number of DH milliseconds with commas which is breaking the datetime:format tag. DH Shouldn't the default behavior for bean:write stay the same if I am not DH using the format attribute? I just want to let everyone know that the format DH attribute as added will break some existing code that is out there. At the DH very least it should be added as a potential gotcha to the release notes for DH Struts 1.1. DH I think the format attribute is a good thing and I wouldn't mind not using DH datetime:format because my current technique is painful when the date is DH null. DH Thanks, Hal DH -- DH To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] DH For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Best regards, Olegmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: bean:write format attribute changes bean:write default behavior
This is from an off-list email between Oleg and I: From Oleg to me: Hello Hal, Default format strings can be written as - org.apache.struts.taglib.bean.format.int=## org.apache.struts.taglib.bean.format.float=##, org.apache.struts.taglib.bean.format.timestamp=hh 'o''clock' a, org.apache.struts.taglib.bean.format.date=EEE, MMM d, ''yy org.apache.struts.taglib.bean.format.time=h:mm a values for resource file entries are standart Java format strings for date, time and number values. From me to Oleg: That makes more sense. For some reason the bean:write documentation didn't make that clear to me. I think the doc should definately contain those examples. Couldn't you make the behaviour so that if the format task isn't used, and the key is not found in the resource file, no formating will take place? That would acheive backwards compatability. If someone wants automatic formating without using the format attribute of the bean:write tag then they just have to add the entries to the resource file. I often used bean:write to print out things that aren't meant to be seen such as when I print out a number for the body of a multi-box tag. That will break something if the default is to format the number with commas or periods depending on your locale. -Original Message- From: Will Jaynes [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 06, 2001 9:43 AM To: Struts Developers List; Oleg V Alexeev Subject: Re: bean:write format attribute changes bean:write default behavior Oleg, I'm sorry, but I'm not at all clear as to what you are saying here. Could you please restate it? Will - Original Message - From: Oleg V Alexeev [EMAIL PROTECTED] To: Struts Developers List [EMAIL PROTECTED]; Deadman, Hal [EMAIL PROTECTED] Sent: Wednesday, December 05, 2001 8:50 AM Subject: Re: bean:write format attribute changes bean:write default behavior Hello Hal, You can add to application resources strings with default format strings for such types as (first string - key for resources, nested strings is list of datatypes) - org.apache.struts.taglib.bean.format.int java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Long, java.math.BigInteger org.apache.struts.taglib.bean.format.float java.lang.Float, java.lang.Double, java.math.BigDecimal org.apache.struts.taglib.bean.format.timestamp java.sql.Timestamp org.apache.struts.taglib.bean.format.date java.sql.Date org.apache.struts.taglib.bean.format.time java.sql.Time Tuesday, December 04, 2001, 5:07:56 AM, you wrote: DH I have some code that uses bean:write and the datetime:format tag from DH taglibs project. I use it like this: DH datetime:format pattern=MM/dd/bean:write name=contractinfo DH property=beginDate.time//datetime:format DH The bean:write used to print out the number of milliseconds returned by DH getBeginDate().getTime(). DH I got a nightly build and now the bean:write prints the number of DH milliseconds with commas which is breaking the datetime:format tag. DH Shouldn't the default behavior for bean:write stay the same if I am not DH using the format attribute? I just want to let everyone know that the format DH attribute as added will break some existing code that is out there. At the DH very least it should be added as a potential gotcha to the release notes for DH Struts 1.1. DH I think the format attribute is a good thing and I wouldn't mind not using DH datetime:format because my current technique is painful when the date is DH null. DH Thanks, Hal DH -- DH To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] DH For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Best regards, Olegmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DO NOT REPLY [Bug 5303] New: - BaseTag when there is a web server acting as proxy in front of servlet engine
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5303. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5303 BaseTag when there is a web server acting as proxy in front of servlet engine Summary: BaseTag when there is a web server acting as proxy in front of servlet engine Product: Struts Version: 1.0 Final Platform: Other OS/Version: Linux Status: NEW Severity: Normal Priority: Other Component: Custom Tags AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi, We have a setup with a apache webserver acting as a proxy in front of a BEA WLS 6.1 - everything running on Linux. And there is a firewall between the servers so that you may not directly access the WLS from the internet. Lets call the address of the front server: www.mydomain.com and the dns of the internal machine: internal.mydomain.com. I have a Struts page /mypage.jsp with a base tag running on the WLS. The base tag gives a value: http://internal.mydomain.com/mypage.jsp (which is inaccessible from the internet) instead of: http://www.mydomain.com/mypage.jsp which would be wanted. A possible solution would be to add a property server that could be used to override the servername that is got from the request object in line 120 (buf.append(request.getServerName());) if set. Does anybody have a better solution? Regards Brynjar Glesnes -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean WriteTag.java
oalexeev01/12/06 09:59:34 Modified:src/share/org/apache/struts/taglib/bean WriteTag.java Log: Restore behavior of previous version - print values with toString() method call. Format code will be used only in situations - 1) format attribute is not empty, 2) format string according to used value type is defined in resources Revision ChangesPath 1.13 +26 -39 jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java Index: WriteTag.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- WriteTag.java 2001/11/21 18:47:05 1.12 +++ WriteTag.java 2001/12/06 17:59:34 1.13 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v 1.12 2001/11/21 18:47:05 oalexeev Exp $ - * $Revision: 1.12 $ - * $Date: 2001/11/21 18:47:05 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v 1.13 2001/12/06 17:59:34 oalexeev Exp $ + * $Revision: 1.13 $ + * $Date: 2001/12/06 17:59:34 $ * * * @@ -89,7 +89,7 @@ * output stream, optionally filtering characters that are sensitive in HTML. * * @author Craig R. McClanahan - * @version $Revision: 1.12 $ $Date: 2001/11/21 18:47:05 $ + * @version $Revision: 1.13 $ $Date: 2001/12/06 17:59:34 $ */ public class WriteTag extends TagSupport { @@ -300,37 +300,6 @@ if ( value instanceof java.lang.String ) { return (String)value; -} else if ( value instanceof java.sql.Timestamp ) { -if( formatStr==null ) -formatStr = RequestUtils.message(pageContext, this.bundle, - this.localeKey, TIMESTAMP_FORMAT_KEY ); -if( formatStr==null ) -format = DateFormat.getDateTimeInstance( -DateFormat.SHORT, DateFormat.SHORT, locale); -else -format = new SimpleDateFormat( formatStr, locale ); -} else if ( value instanceof java.sql.Date ) { -if( formatStr==null ) -formatStr = RequestUtils.message(pageContext, this.bundle, - this.localeKey, DATE_FORMAT_KEY ); -if( formatStr==null ) -format = DateFormat.getDateInstance(DateFormat.SHORT, locale); -else -format = new SimpleDateFormat( formatStr, locale ); -} else if ( value instanceof java.sql.Time ) { -if( formatStr==null ) -formatStr = RequestUtils.message(pageContext, this.bundle, - this.localeKey, TIME_FORMAT_KEY ); -if( formatStr==null ) -format = DateFormat.getTimeInstance(DateFormat.SHORT, locale); -else -format = new SimpleDateFormat( formatStr, locale ); -} else if ( value instanceof java.util.Date ) { -if( formatStr==null ) -format = DateFormat.getDateTimeInstance( -DateFormat.SHORT, DateFormat.SHORT, locale); -else -format = new SimpleDateFormat( formatStr, locale ); } else if ( value instanceof Number ) { if( formatStr==null ) { if( ( value instanceof Byte )|| @@ -357,11 +326,29 @@ throw e; } } -} else { -return value.toString(); -} +} else if ( value instanceof java.util.Date ) { +if( formatStr==null ) { +if ( value instanceof java.sql.Timestamp ) { +formatStr = RequestUtils.message(pageContext, this.bundle, + this.localeKey, TIMESTAMP_FORMAT_KEY ); +} else if ( value instanceof java.sql.Date ) { +formatStr = RequestUtils.message(pageContext, this.bundle, + this.localeKey, DATE_FORMAT_KEY ); +} else if ( value instanceof java.sql.Time ) { +formatStr = RequestUtils.message(pageContext, this.bundle, + this.localeKey, TIME_FORMAT_KEY ); +} +}
Struts Validator (dumb?) question
Hello All, I'm trying to use the Struts validator but it doesn't seem to be working in my - relatively common - case. I have a modify.jsp page that is displayed upon calling /modifyAction?command=init (using the DispatchAction). No validation must be performed at this point. The user then enters some data and submits the form to /modifyAction?command=update and at this point I clearly want the validation to be performed. I also have a search page that can be called with /modifyAction?command=search (no validation, of course). How can I do this? I've tried the following: - myForm extends ValidatorForm and form name=myForm ... in validation.xml. This doesn't work as the form is validated on the init method (the blank modify.jsp is displayed the first time with an error message saying field required as the validation is performed on the form) - myForm extends ValidatorActionForm and form name=/modifyAction ... in validation.xml This doesn't work because when I call the search page with /modifyAction?command=search, the validation is triggered (it matches /modifyAction) and doesn't allow me to go to the search page until the data is valid (which doesn't really make sense since I want to select something). Do you have any suggestions? Is there a way I can do the above with the Struts validator? Am I structuring my actions in the wrong way? I think I need a DispatchValidatorForm... :) Thank you for any help. Andrej