Rainer,

A more elegant way? I think a mental re-org would help here.

"Papa Strut" (Craig) has spoken many times on this matter before (check ou the 
archives to check that I'm not fibbing! :-) and has reminded us that the ActionForm's 
are a mere transport mechanism to/from the pages. Everything in HTML is a string, so 
the logical datatype to transport that information is a String datatype in Java.

When receiving data from a HTTP POST or GET, you *will* get strings, so you have no 
choice here (blame Vint Cerf if you're unhappy), so no matter what language or MVC 
framework you use, you're gonna get Strings. Relax and accept this (or re-write HTTP).

When sending data to a JSP via an ActionForm, the information is going to be displayed 
either as a string or as an HTML page element which is described using strings. This 
is the way it is ... relax and accept this (or offer to re-write the JSP spec).

So, if I haven't already mentioned Strings, now might be a good time to mention 
Strings. Learn to love Strings. Yes, the data that we want to work with is sometimes 
not a String, but HTTP is a text based protocol, so it works with Strings. Learn to 
love converting to and from Strings, because you're gonna do a fair bunch of it around 
here. Think of the String class as the Struts equivalent of "Duct Tape(tm)" ... it 
holds everything together.

Hope this explains, even if it doesn't help.

Simon "Long Tall Piece of String" Chappell

-----------------------------------------------------------------
Simon P. Chappell                     [EMAIL PROTECTED]
Java Programming Specialist                      www.landsend.com
Lands' End, Inc.                                   (608) 935-4526


>-----Original Message-----
>From: rainer juenger [mailto:[EMAIL PROTECTED]]
>Sent: Friday, October 11, 2002 11:39 AM
>To: [EMAIL PROTECTED]
>Subject: Struts forms best practice
>
>
>Hi,
>
>I was wondering what the best data type for Struts ActionForm class is.
>According to the design I would say it should be the same as 
>the data type
>in the application.
>(e.g. float) But then the associated form already comes with a 
>"0" filed in
>the form. That's something I don't wont at all!
>As I found out, the only solution is to use String as data 
>type an convert
>it later.
>
>Is there a more elegant way?
>
>Rainer
>
>
>
>--
>To unsubscribe, e-mail:   
><mailto:struts-user->[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]>

Reply via email to