At 10:27 PM 7/20/99 -0700, James Todd wrote:
>what about:
>
> adding an "equalsChoiceIgnoreCase(String s)" method to your
> bean (or a bean wrapper if you don't want to ?pollute?
> existing bean code)
>
> using the following jsp scriptlet:
>
> <% out.println((mybean.equalsChoiceIgnoreCase("Apparel")) ?
> "checked" : ""); %>
>
> i may be off a smidgen syntactically but i believe the
> idea has been conveyed.
>
> hope this helps,
Thanks. That is definitly an improvement. However, what I'm
really looking for is a way to avoid scriplets altogether,
i.e., just use some <jsp:xxx> tag to do the trick. I understand
JSP 1.1 may help in this regard, though I really haven't looked
into that yet. Anyway, your code is much better than mine :-)
Thanks again.
>
>- james
>
>Bill O'Keefe wrote:
>>
>> I am using a bean to initialize the form fields of a JSP.
>> I understand how to use <jsp:getProperty...> to initialize text fields,
>> or to just include a string within the page. However I'm a bit unclear
>> on the best way to initialize radio buttons and check boxes. The only
thing
>> I've come up with is the following (somewhat ugly) solution:
>>
>> <jsp:useBean id="mbean" class="..." scope="session"/>
>> ...
>> <input type="radio" name="choice" value="apparel"
>> <% if (mbean.getChoice() != null &&
>> mbean.getChoice().equals("apparel"))
>> out.println("checked"); %>
>> >Apparel
>>
>> <input type="radio" name="choice" value="computers"
>> <% if (mbean.getChoice() != null &&
>> mbean.getChoice().equals("computers"))
>> out.println("checked"); %>
>> >Computers
>> ...
>>
>> Is there a more elegant way to accomplish this? Thanks.
-- Bill
--
Bill O'Keefe [EMAIL PROTECTED]
Open Market, Inc. http://www.openmarket.com/
One Wayside Road TEL: 781.359.7296
Burlington, MA 01803 FAX: 781.359.8200
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".