You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Tomas Viberg <to...@viberg.nu> on 2002/06/18 13:15:20 UTC

Display request parameter instead of bean property?

Hello,

I've been thinking... Wouldn't it be a good idea that some form fields (text, textarea, etc.), could display the value of the request parameter instead of the bean property under some circumstances. One example when this would be nice is when the conversion of the input value to the target type fails. For instance, if I enter '1.0' in a form field mapped to a bean property of type int, the field contains '0' when it is redisplayed. In this case, I think it would be better if it displayed the (invalid) value entered by the user.

Anybody agree/disagree?

Regards,
Tomas Viberg <to...@viberg.nu>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Display request parameter instead of bean property?

Posted by Tomas Viberg <to...@viberg.nu>.
Yes, I found the discussion in the users list and will now change my behaviour :-)

/ Tomas


----- Original Message ----- 
From: "Craig R. McClanahan" <cr...@apache.org>
To: "Struts Developers List" <st...@jakarta.apache.org>
Sent: Tuesday, June 18, 2002 5:53 PM
Subject: Re: Display request parameter instead of bean property?


> 
> 
> On Tue, 18 Jun 2002, Tomas Viberg wrote:
> 
> > Date: Tue, 18 Jun 2002 13:15:20 +0200
> > From: Tomas Viberg <to...@viberg.nu>
> > Reply-To: Struts Developers List <st...@jakarta.apache.org>
> > To: struts-dev@jakarta.apache.org
> > Subject: Display request parameter instead of bean property?
> >
> > Hello,
> >
> > I've been thinking... Wouldn't it be a good idea that some form fields
> > (text, textarea, etc.), could display the value of the request parameter
> > instead of the bean property under some circumstances. One example when
> > this would be nice is when the conversion of the input value to the
> > target type fails. For instance, if I enter '1.0' in a form field mapped
> > to a bean property of type int, the field contains '0' when it is
> > redisplayed. In this case, I think it would be better if it displayed
> > the (invalid) value entered by the user.
> >
> 
> That is why your form bean properties should generally be strings, and you
> should do the conversion to int later (creating an error message if
> conversion fails).
> 
> > Anybody agree/disagree?
> >
> > Regards,
> > Tomas Viberg <to...@viberg.nu>
> >
> 
> Craig
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Display request parameter instead of bean property?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 18 Jun 2002, Tomas Viberg wrote:

> Date: Tue, 18 Jun 2002 13:15:20 +0200
> From: Tomas Viberg <to...@viberg.nu>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Display request parameter instead of bean property?
>
> Hello,
>
> I've been thinking... Wouldn't it be a good idea that some form fields
> (text, textarea, etc.), could display the value of the request parameter
> instead of the bean property under some circumstances. One example when
> this would be nice is when the conversion of the input value to the
> target type fails. For instance, if I enter '1.0' in a form field mapped
> to a bean property of type int, the field contains '0' when it is
> redisplayed. In this case, I think it would be better if it displayed
> the (invalid) value entered by the user.
>

That is why your form bean properties should generally be strings, and you
should do the conversion to int later (creating an error message if
conversion fails).

> Anybody agree/disagree?
>
> Regards,
> Tomas Viberg <to...@viberg.nu>
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Display request parameter instead of bean property?

Posted by James Mitchell <jm...@telocity.com>.
You should ask this on the users list.

There's already been detailed discussion on this topic there.

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://struts-atlanta.open-tools.org

> -----Original Message-----
> From: Tomas Viberg [mailto:tomas@viberg.nu]
> Sent: Tuesday, June 18, 2002 7:15 AM
> To: struts-dev@jakarta.apache.org
> Subject: Display request parameter instead of bean property?
> 
> 
> Hello,
> 
> I've been thinking... Wouldn't it be a good idea that some form 
> fields (text, textarea, etc.), could display the value of the 
> request parameter instead of the bean property under some 
> circumstances. One example when this would be nice is when the 
> conversion of the input value to the target type fails. For 
> instance, if I enter '1.0' in a form field mapped to a bean 
> property of type int, the field contains '0' when it is 
> redisplayed. In this case, I think it would be better if it 
> displayed the (invalid) value entered by the user.
> 
> Anybody agree/disagree?
> 
> Regards,
> Tomas Viberg <to...@viberg.nu>
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>