The <bean:cookie> tag defines a bean of type javax.servlet.http.Cookie (or
an array of them if the 'multiple' attribute is specified). You'll need to
access the 'value' property, as you are doing in the scriptlet code. Also,
you need to use different quote characters to avoid conflicts.

Try this:

<bean:cookie id="phonecookie" name="checkout_phone" />
<input type="text" name="phone" value='<bean:write name="phonecookie"
property="value"/>'/>

--
Martin Cooper


----- Original Message -----
From: "Allen Walker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 12:45 AM
Subject: bean:cookie tag problem


> I have having problems with the relatively trival <bean:cookie> tag. Here
> is what I have:
>
>   <bean:cookie id="phonecookie" name="checkout_phone" />
>   <input type="text" name="phone" value="<bean:write name="phonecookie"/>"
/>
>
> The value I get in the form is:
> javax.servlet.http.Cookie@72428d
>
> Very strange. I tested to see if my cookie was set properly:
>
> <%  Cookie cookies[] = request.getCookies();
>        String phonecookie = "nothing";
>        for (int i=0; i < cookies.length; i++) {
> if (cookies[i].getName().equalsIgnoreCase("checkout_phone"))
>   phonecookie = cookies[i].getValue();
>        }
> %>
>
> <input type="text" name="phone" value="<%=phonecookie%>" />
>
> And I obtained the proper value.
>
> Thanks for any help.
>
> -allen-
>


Reply via email to