You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by df...@syncrasystems.com on 2000/12/08 16:43:06 UTC

Request for enhancement of text tag

I would like to be able to enter a value attribute into the body of a text
tag like so:

<form:text property="foo"><bean:message key="initialText" /></form:text>

This is currently possible in the button tag.  Could the text tag be
similarly enhanced?

--Devin

Re: Request for enhancement of text tag

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
dfoulger@syncrasystems.com wrote:

> I would like to be able to enter a value attribute into the body of a text
> tag like so:
>
> <form:text property="foo"><bean:message key="initialText" /></form:text>
>

One approach would be to use the "value" attribute:

    <form:text property="foo" value="....."/>

but this would essentially create a constant value that would no longer interact
with the underlying form bean.  You'd have the same issue with initializing the
text box from the body of the tag -- when do you use that value, and when do you
use the value of the property?

For that reason, the best strategy to accomplish this would be to have your
ActionForm's constructor (and/or the reset() method) set the underlying property
to the initial value that you want it to have.  Then, the standard mechanism
displays the correct default information, and allows the user to override it if
they want to.

>
> This is currently possible in the button tag.  Could the text tag be
> similarly enhanced?
>
> --Devin

Craig McClanahan