|
From: Seth L. <se...@eh...> - 2004-05-18 00:16:40
|
Hello,
I've been pooring over the source today trying to find out a way around
this, but no luck. I'm hoping others could lend a hand.
In converting all of our struts code to Spring, I'm writing a lot of
<spring:bind> tags. While binding to a particular field, I have to use
the commandName + fieldName with spring:bind. Typical usage is:
<spring:bind path="chooseBusinessTypeCommand.type">
<springx:fieldLabel name="chooseBusinessTypeCommand.type"/>
<f:select name="${status.expression}" value="${status.value}">
<f:option value="">----</f:option>
<f:option value="SP"><fmt:message key="bizType.SP"/></f:option>
<f:option value="DC"><fmt:message key="bizType.DC"/></f:option>
</f:select>
</spring:bind>
</div>
(Note that <f:select> and <f:option> are tagfiles emulating the struts
<html:select> and <html:option> tags).
My question is, is there a nice way to omit the
"chooseBusinessTypeCommand" usage from the JSP file? I write that for
every field in the form. Ideally the tags would read that from the
handler somehow, where the commandName is initially specified.
I could specify it once at the top of the file, but I'd really like to
not specify it at all.
I realize that keeping it this way keeps <spring:bind> more flexible,
but I would guess that nearly all usage would be to bind to the form and
handler's command object. Minimizing the amount of configuration and
typing here would be really nice.
Another suggestion would be to (optionally) wrap all usages of
<spring:bind> in another tag that could reach somehow into the request
or the handler and discover the commandName. Something like:
<spring:bindFromCommand>
<spring:bind path="type">
...
</spring:bind>
</spring:bindFromCommand>
Suggestions or comments?
Thanks!
Seth
|