On Thu, 11 Jul 2002, Jesper Pedersen wrote:

> Date: Thu, 11 Jul 2002 10:34:47 +0200
> From: Jesper Pedersen <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RFF: type attribute in <html:text>
>
> Hi.
>
> First of all: sorry if this request for feature is going to the wrong place.
>

The best place for enhancement requests is the bug tracking system:

  http://nagoya.apache.org/bugzilla/

with a "Severity" setting of "Enhancement".

> Now then...
>
> Request for Feature: type attribute in <html:text>
> --------------------------------------------------
> Often I find myself having
>
>  private Integer myInt;
>  public Integer getMyInt() {return myInt;}
>  public void setMyInt(Integer myInt) { this.myInt = myInt; }
>
> in my ActionForm.
>
> The input for myInt comes from a JSP page using the <html:text> tag.
> But since <html:text> is using String as the data type I've to assign the
> value to
>
>  private String myIntString;
>
> and do the conversion in validate().
>
> It would be great if one could specify:
>
>  <html:text property="myInt" type="java.lang.Integer"/>
>
> since Integer can take a String in the constructor. If a
> NumberFormatException is thrown a stack-trace is ok to present to the user
> IMO.
>

I sure don't think this is ok.

In a conventional GUI program, what you get back in this scenario is an
error message and your text box, displaying the incorrrect input that the
user entered so he or she can fix it.  That is exactly the way that web
applications should operate as well.

> Yes, I know that one should use the validate(ActionMapping mapping,
> ServletRequest request) for this kind of job -- but in simple cases this
> would be a great feature to have (and no I wouldn't use this feature in
> production; only for development).
>
> Comment ? (or am I totally off here?)
>

I strongly suggest that you use string properties, and do the required
conversions later.

> Cheers,
>  Jesper
>
> P.S. I'm not on the list, so if possible Cc: me, please
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to