PDA

View Full Version : form tags vs spring:bind



buzzer
Jul 2nd, 2009, 09:30 AM
Hi all!

Could somebody hint me how for example tag
<form:input path="command.prop"/>
can be written in terms of spring:bind?
I suppose it can be
<spring:bind path="command.prop"><input type="text" name="${status.expression}" value="${status.value}"></spring:bind>
, but I am not sure this is the same.
If I am right: can
<spring:bind path="command.prop"><input type="text" name="${status.expression}""></spring:bind> (without value)
be used as one-directional bind (to server).

Thanks.

mpr
Jul 3rd, 2009, 10:35 AM
Could somebody hint me how for example tag
<form:input path="command.prop"/>
can be written in terms of spring:bind?
I suppose it can be
<spring:bind path="command.prop"><input type="text" name="${status.expression}" value="${status.value}"></spring:bind>
, but I am not sure this is the same.
It's nearly the same, only form:input also renders the id attribute (but this has no relevance in your case). You can easily check this for yourself when your look at the sourcecode of the generated html page.


If I am right: can
<spring:bind path="command.prop"><input type="text" name="${status.expression}""></spring:bind> (without value)
be used as one-directional bind (to server).If I understand you correctly, you don't want to display the current value, but just want to receive the input. In this case you are right.

Or you could simply write:

<input type="text" name="prop"> when prop is the name of your field in command.

Martin