|
From: Oliver H. <Ol...@ou...> - 2004-05-18 01:05:55
|
I have quite a few pages that have multiple forms in a single JSP so a
general <spring:bindFromCommand> wouldn't really work for me.=20
What I've found I'd like is something equivalent to the
Errors.setNestedPath() but for the bind tag. Perhaps=20
<spring:setNestedPath path=3D"chooseBusinessTypeCommand">
<spring:bind path=3D"type">
.. Do stuff
</spring:bind>
</spring:setNestedPath>=20
This gets really useful when you start reusing parts of your form. Then
you could do stuff like
<spring:setNestedPath path=3D"editBusinessUser">
<spring:bind path=3D"type">
.. Do stuff
</spring:bind>
<spring:setNestedPath path=3D"internalContact">
<%@ include file=3D"/include/forms/contact_form.jsp" %>
</spring:setNestedPath>
<spring:setNestedPath path=3D"externalContact">
<%@ include file=3D"/include/forms/contact_form.jsp" %>
</spring:setNestedPath>
</spring:setNestedPath>
At the moment I pass a variable around which holds the nested path but
using tags would feel much better.
> -----Original Message-----
> From: spr...@li...=20
> [mailto:spr...@li...]
> On Behalf Of Seth Ladd
> Sent: Tuesday, 18 May 2004 10:18 AM
> To: spr...@li...
> Subject: [Springframework-developer] Way to streamline=20
> spring:bind usage?
>=20
>=20
> Hello,
>=20
> I've been pooring over the source today trying to find out a=20
> way around=20
> this, but no luck. I'm hoping others could lend a hand.
>=20
> In converting all of our struts code to Spring, I'm writing a lot of=20
> <spring:bind> tags. While binding to a particular field, I=20
> have to use=20
> the commandName + fieldName with spring:bind. Typical usage is:
>=20
> <spring:bind path=3D"chooseBusinessTypeCommand.type">
> <springx:fieldLabel name=3D"chooseBusinessTypeCommand.type"/>
> <f:select name=3D"${status.expression}"=20
> value=3D"${status.value}"> <f:option value=3D"">----</f:option>=20
> <f:option value=3D"SP"><fmt:message=20
> key=3D"bizType.SP"/></f:option> <f:option=20
> value=3D"DC"><fmt:message key=3D"bizType.DC"/></f:option>=20
> </f:select> </spring:bind> </div>
>=20
> (Note that <f:select> and <f:option> are tagfiles emulating=20
> the struts=20
> <html:select> and <html:option> tags).
>=20
> My question is, is there a nice way to omit the=20
> "chooseBusinessTypeCommand" usage from the JSP file? I write=20
> that for=20
> every field in the form. Ideally the tags would read that from the=20
> handler somehow, where the commandName is initially specified.
>=20
> I could specify it once at the top of the file, but I'd=20
> really like to=20
> not specify it at all.
>=20
> I realize that keeping it this way keeps <spring:bind> more flexible,=20
> but I would guess that nearly all usage would be to bind to=20
> the form and=20
> handler's command object. Minimizing the amount of configuration and=20
> typing here would be really nice.
>=20
> Another suggestion would be to (optionally) wrap all usages of=20
> <spring:bind> in another tag that could reach somehow into=20
> the request=20
> or the handler and discover the commandName. Something like:
>=20
> <spring:bindFromCommand>
> <spring:bind path=3D"type">
> ...
> </spring:bind>
> </spring:bindFromCommand>
>=20
> Suggestions or comments?
>=20
> Thanks!
> Seth
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: SourceForge.net Broadband=20
> Sign-up now for SourceForge Broadband and get the fastest=20
> 6.0/768 connection for only $19.95/mo for the first 3 months!=20
http://ads.osdn.com/?ad_id=3D2562&alloc_id=3D6184&op=3Dclick
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|