Re: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
yes of course I know! But how can I be sure that this String is a Integer ? I mean I can simply convert this String to an Integer, but I doubt this would help, cause a String can get converted to an Integer. (Like A is 65 I think) So how can I be sure that the user typed 65 and not A ? Marcus [EMAIL PROTECTED] schrieb: Are you kidding? Dude, everything typed in an HTML form is a string. You have to do some validation. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
Check out the static methods of the java.lang.Character class. isDigit() should solve your dilemma. Mark -Original Message- From: Marcus Biel [mailto:Marcus.Biel;bmw.de] Sent: Thursday, October 31, 2002 7:04 AM yes of course I know! But how can I be sure that this String is a Integer ? I mean I can simply convert this String to an Integer, but I doubt this would help, cause a String can get converted to an Integer. (Like A is 65 I think) So how can I be sure that the user typed 65 and not A ? Marcus [EMAIL PROTECTED] schrieb: Are you kidding? Dude, everything typed in an HTML form is a string. You have to do some validation. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
What is a 'good-practice' method of validating a numeric string? Ive been lazy and am doing a Integer.parseInt() in a try catch but its probably far from the best way... (Have been meaning to check out the java.text.NumberFormat stuff but always had more interes... uh... important things to do first and havent had time yet...) -Original Message- From: Galbreath, Mark [mailto:Galbreath;tessco.com] Sent: Thursday, October 31, 2002 20:13 To: 'Struts Users Mailing List' Subject: RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ? Check out the static methods of the java.lang.Character class. isDigit() should solve your dilemma. Mark -Original Message- From: Marcus Biel [mailto:Marcus.Biel;bmw.de] Sent: Thursday, October 31, 2002 7:04 AM yes of course I know! But how can I be sure that this String is a Integer ? I mean I can simply convert this String to an Integer, but I doubt this would help, cause a String can get converted to an Integer. (Like A is 65 I think) So how can I be sure that the user typed 65 and not A ? Marcus [EMAIL PROTECTED] schrieb: Are you kidding? Dude, everything typed in an HTML form is a string. You have to do some validation. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
Well, Marcus was just asking how he could differentiate between an input of A vs 65 (text vs digit). The simplest way I know is something like: char test = request( getParameter( formObject1 )).charAt( 0 ); if( Character.isDigit( test ) { doSomething(); } If you want to validate the accuracy of a number or sequence of numbers: NumberFormat nf = NumberFormat.getInstance(); Number number = nf.parse( request.getParameter( formObject1 )); if( number.floatValue() != 3.14 ) { System.out.println( No pi for you! ); } Mark -Original Message- From: Andrew Hill [mailto:andrew.david.hill;gridnode.com] Sent: Thursday, October 31, 2002 7:17 AM To: Struts Users Mailing List Subject: RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ? What is a 'good-practice' method of validating a numeric string? Ive been lazy and am doing a Integer.parseInt() in a try catch but its probably far from the best way... (Have been meaning to check out the java.text.NumberFormat stuff but always had more interes... uh... important things to do first and havent had time yet...) -Original Message- From: Galbreath, Mark [mailto:Galbreath;tessco.com] Sent: Thursday, October 31, 2002 20:13 To: 'Struts Users Mailing List' Subject: RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ? Check out the static methods of the java.lang.Character class. isDigit() should solve your dilemma. Mark -Original Message- From: Marcus Biel [mailto:Marcus.Biel;bmw.de] Sent: Thursday, October 31, 2002 7:04 AM yes of course I know! But how can I be sure that this String is a Integer ? I mean I can simply convert this String to an Integer, but I doubt this would help, cause a String can get converted to an Integer. (Like A is 65 I think) So how can I be sure that the user typed 65 and not A ? Marcus [EMAIL PROTECTED] schrieb: Are you kidding? Dude, everything typed in an HTML form is a string. You have to do some validation. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
But remember we got Strings, not Characters. Sorry I know this is dumb, but today I worked this much, I really can't get a clear mind. 8-) marcus [EMAIL PROTECTED] schrieb: Check out the static methods of the java.lang.Character class. isDigit() should solve your dilemma. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
See my response to Andrew for taking a String and getting a char out of it - posted about an hour ago. Mark -Original Message- From: Marcus Biel [mailto:Marcus.Biel;bmw.de] Sent: Thursday, October 31, 2002 8:27 AM To: [EMAIL PROTECTED] Subject: Re: MVC Design: property in ActionForm or Bean with property in A ctionForm ? But remember we got Strings, not Characters. Sorry I know this is dumb, but today I worked this much, I really can't get a clear mind. 8-) marcus [EMAIL PROTECTED] schrieb: Check out the static methods of the java.lang.Character class. isDigit() should solve your dilemma. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: MVC Design: property in ActionForm or Bean with property in A ctionForm ?
hehe, I know the feeling :-) -Original Message- From: Marcus Biel [mailto:Marcus.Biel;bmw.de] Sent: Thursday, October 31, 2002 21:27 To: [EMAIL PROTECTED] Subject: Re: MVC Design: property in ActionForm or Bean with property in A ctionForm ? But remember we got Strings, not Characters. Sorry I know this is dumb, but today I worked this much, I really can't get a clear mind. 8-) marcus [EMAIL PROTECTED] schrieb: Check out the static methods of the java.lang.Character class. isDigit() should solve your dilemma. Mark -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org