Wendy Smoak wrote:
From: "Néstor Boscán" <[EMAIL PROTECTED]>
How can I use <html:multibox /> or <html:checkbox /> with values that are
stored in the request or page context?. I would like to do something like
<html:multibox value="<%= request.getAttribute (\"value\") %>"/> without
using the <% %> tags. Is there a way to use the JSTL Expression Language or
tell the <html:multibox /> tag to get the value from an attributo?.

You can... but the typical way to handle this is to put those values into your form bean. Do this in the Action, then forward to the JSP and let the framework render the correct values in the HTML form elements.

If you use the 'value' attribute directly in the tags, you lose the ability to re-display the user's incorrect input if the form fails validation.

LOL, I just knew if I didn't say something to that effect you'd jump in Wendy ;-) Sorry, I should have mentioned the (non-obvious) reason I didn't: in the specific case where you're populating the 'value' attribute from a request parameter, you don't loose anything. The user's input *is* what you're redisplaying.

The caveat with that is, of course, if you redirect back to the original page (rather than forwarding, as by default) you'd loose the request data. Storing it into a form bean, and putting that bean in session scope, is the solution in that case.

L.
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to