Re: Struts question <html:text>



"Scott Phelps" <root@xxxxxxx> wrote
>
> How can I make <html:text property="username" size="16"/> display the
entry
> a person put in on error, but another when the property is null or ""?
>
> I am tring to make the user login filled in by a cookie, but still keep
the
> input when the login is incorrect.

When the request first comes in, it goes to an Action. In the Action,
decide whether this is the "first time" you are displaying the form. If so,
read the cookie, and populate the form property: form.setUsername(
valueFromCookie );

Then forward to the JSP, and the framework will render the text area with
the value you specified. When the user submits the form, the framework will
populate the form bean with that value, and so on.

To decide whether this is the "first time" you can do a number of things.
If the form itself will be POSTed, then you can check whether that's true.
Or you can set a hidden form element that will only be present if the form
was actually submitted.

Also take a look at StrutsDialogs:
http://struts.sourceforge.net/strutsdialogs/index.html

--
Wendy Smoak


.