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,
- 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".
===========================================================================
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".