|
From: <tho...@tr...> - 2006-07-25 14:50:14
|
Is there a convenient way to assign a fixed value from a hidden form
element and have it bound to the command object? I'm using the new <form>
tags.
the <form:hidden> tag does not have a value attribute.
Tried to mix in a <spring:bind> tag but this resulted in the preperty
being set to null on the command object even though it originally had a
value pre-assigned when the command object was created.
Can we mix and match <form:> and <spring:bind> tags?
Here is a simplified version of what I'm using:
<h4>New Login Account</h4>
<form:form commandName="command" action="new_user.htm">
<table>
<tr>
<td class="prompt">Login ID:</td><td class="value">
<form:input path="user.userName"/>
</td>
</tr>
<tr class="even">
<td class="prompt">Password:</td><td class="value">
<form:password path="user.password"/>
</td>
<td>Retype Password:</td><td class="value">
<form:password path="user.retypePassword"/>
</td>
</tr>
</table>
<table>
<tr>
<td class="submit"><input name="_eventId_submit" type="submit"
value="NEXT"/></td>
</tr>
</table>
<spring:bind path="command.step">
<input type="hidden" name="_step" value="STEP1"/>
</spring:bind>
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
</form:form>
The "command.step" is the property that I want to be able to set to a
fixed value from the form, like STEP1 in the example.
Thomas
|
|
From: Matt S. <mat...@sp...> - 2006-07-25 14:55:38
|
Couldn't you just use
<input type="hidden" name="myName" value="myValue"/> ?
You wouldn't get much benefit out of using the <form> tag library for a
constant value like that anyway.
Matt
tho...@tr... wrote:
> Is there a convenient way to assign a fixed value from a hidden form
> element and have it bound to the command object? I'm using the new <form>
> tags.
>
> the <form:hidden> tag does not have a value attribute.
>
> Tried to mix in a <spring:bind> tag but this resulted in the preperty
> being set to null on the command object even though it originally had a
> value pre-assigned when the command object was created.
>
> Can we mix and match <form:> and <spring:bind> tags?
>
> Here is a simplified version of what I'm using:
>
> <h4>New Login Account</h4>
>
> <form:form commandName="command" action="new_user.htm">
> <table>
> <tr>
> <td class="prompt">Login ID:</td><td class="value">
> <form:input path="user.userName"/>
> </td>
> </tr>
> <tr class="even">
> <td class="prompt">Password:</td><td class="value">
> <form:password path="user.password"/>
> </td>
> <td>Retype Password:</td><td class="value">
> <form:password path="user.retypePassword"/>
> </td>
> </tr>
> </table>
>
> <table>
> <tr>
> <td class="submit"><input name="_eventId_submit" type="submit"
> value="NEXT"/></td>
> </tr>
> </table>
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
> <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
>
> </form:form>
>
> The "command.step" is the property that I want to be able to set to a
> fixed value from the form, like STEP1 in the example.
>
> Thomas
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|
|
From: Brendan G. <bre...@gm...> - 2006-07-25 15:00:23
|
Hi Thomas,
I don't see why:
<spring:bind path="command.step">
<input type="hidden" name="${status.expression}" value="STEP1"/>
</spring:bind>
wouldn't work or am I misunderstanding your question?
Brendan
On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>
> Is there a convenient way to assign a fixed value from a hidden form
> element and have it bound to the command object? I'm using the new <form>
> tags.
>
> the <form:hidden> tag does not have a value attribute.
>
> Tried to mix in a <spring:bind> tag but this resulted in the preperty
> being set to null on the command object even though it originally had a
> value pre-assigned when the command object was created.
>
> Can we mix and match <form:> and <spring:bind> tags?
>
> Here is a simplified version of what I'm using:
>
> <h4>New Login Account</h4>
>
> <form:form commandName="command" action="new_user.htm">
> <table>
> <tr>
> <td class="prompt">Login ID:</td><td class="value">
> <form:input path="user.userName"/>
> </td>
> </tr>
> <tr class="even">
> <td class="prompt">Password:</td><td class="value">
> <form:password path="user.password"/>
> </td>
> <td>Retype Password:</td><td class="value">
> <form:password path="user.retypePassword"/>
> </td>
> </tr>
> </table>
>
> <table>
> <tr>
> <td class="submit"><input name="_eventId_submit" type="submit"
> value="NEXT"/></td>
> </tr>
> </table>
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
> <input type="hidden" name="_flowExecutionKey"
> value="${flowExecutionKey}"/>
>
> </form:form>
>
> The "command.step" is the property that I want to be able to set to a
> fixed value from the form, like STEP1 in the example.
>
> Thomas
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: <tho...@tr...> - 2006-07-25 15:06:27
|
Brendan,
That's what I thought too, but the command.step property ends up being
null when accessed from the validation code.
Thomas
> Hi Thomas,
>
> I don't see why:
>
> <spring:bind path="command.step">
> <input type="hidden" name="${status.expression}" value="STEP1"/>
> </spring:bind>
>
> wouldn't work or am I misunderstanding your question?
>
> Brendan
>
> On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>>
>> Is there a convenient way to assign a fixed value from a hidden form
>> element and have it bound to the command object? I'm using the new
>> <form>
>> tags.
>>
>> the <form:hidden> tag does not have a value attribute.
>>
>> Tried to mix in a <spring:bind> tag but this resulted in the preperty
>> being set to null on the command object even though it originally had a
>> value pre-assigned when the command object was created.
>>
>> Can we mix and match <form:> and <spring:bind> tags?
>>
>> Here is a simplified version of what I'm using:
>>
>> <h4>New Login Account</h4>
>>
>> <form:form commandName="command" action="new_user.htm">
>> <table>
>> <tr>
>> <td class="prompt">Login ID:</td><td class="value">
>> <form:input path="user.userName"/>
>> </td>
>> </tr>
>> <tr class="even">
>> <td class="prompt">Password:</td><td class="value">
>> <form:password path="user.password"/>
>> </td>
>> <td>Retype Password:</td><td class="value">
>> <form:password path="user.retypePassword"/>
>> </td>
>> </tr>
>> </table>
>>
>> <table>
>> <tr>
>> <td class="submit"><input name="_eventId_submit" type="submit"
>> value="NEXT"/></td>
>> </tr>
>> </table>
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="_step" value="STEP1"/>
>> </spring:bind>
>> <input type="hidden" name="_flowExecutionKey"
>> value="${flowExecutionKey}"/>
>>
>> </form:form>
>>
>> The "command.step" is the property that I want to be able to set to a
>> fixed value from the form, like STEP1 in the example.
>>
>> Thomas
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Matt S. <mat...@sp...> - 2006-07-25 15:12:18
|
I think you can also do
<input type="hidden" name="command.step" value="<c:out
value='${command.step}'/>"/>
tho...@tr... wrote:
> Brendan,
>
> That's what I thought too, but the command.step property ends up being
> null when accessed from the validation code.
>
> Thomas
>
>> Hi Thomas,
>>
>> I don't see why:
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="${status.expression}" value="STEP1"/>
>> </spring:bind>
>>
>> wouldn't work or am I misunderstanding your question?
>>
>> Brendan
>>
>> On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>>> Is there a convenient way to assign a fixed value from a hidden form
>>> element and have it bound to the command object? I'm using the new
>>> <form>
>>> tags.
>>>
>>> the <form:hidden> tag does not have a value attribute.
>>>
>>> Tried to mix in a <spring:bind> tag but this resulted in the preperty
>>> being set to null on the command object even though it originally had a
>>> value pre-assigned when the command object was created.
>>>
>>> Can we mix and match <form:> and <spring:bind> tags?
>>>
>>> Here is a simplified version of what I'm using:
>>>
>>> <h4>New Login Account</h4>
>>>
>>> <form:form commandName="command" action="new_user.htm">
>>> <table>
>>> <tr>
>>> <td class="prompt">Login ID:</td><td class="value">
>>> <form:input path="user.userName"/>
>>> </td>
>>> </tr>
>>> <tr class="even">
>>> <td class="prompt">Password:</td><td class="value">
>>> <form:password path="user.password"/>
>>> </td>
>>> <td>Retype Password:</td><td class="value">
>>> <form:password path="user.retypePassword"/>
>>> </td>
>>> </tr>
>>> </table>
>>>
>>> <table>
>>> <tr>
>>> <td class="submit"><input name="_eventId_submit" type="submit"
>>> value="NEXT"/></td>
>>> </tr>
>>> </table>
>>>
>>> <spring:bind path="command.step">
>>> <input type="hidden" name="_step" value="STEP1"/>
>>> </spring:bind>
>>> <input type="hidden" name="_flowExecutionKey"
>>> value="${flowExecutionKey}"/>
>>>
>>> </form:form>
>>>
>>> The "command.step" is the property that I want to be able to set to a
>>> fixed value from the form, like STEP1 in the example.
>>>
>>> Thomas
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>>> your
>>> opinions on IT & business topics through brief surveys -- and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> Springframework-developer mailing list
>>> Spr...@li...
>>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|
|
From: Brendan G. <bre...@gm...> - 2006-07-25 15:20:19
|
Thomas,
Can you please try this and let us know what the result is:
<input type="hidden" name="step" value="STEP1" />
We do this sort of thing all over the place and it works fine. I'm assuming
here that step is a property on your command object of course.
Also, you did import the spring tags right? (Just asking as that's the sort
of thing I forget to do all the time ;-)
Thanks
Brendan
On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
>
> I think you can also do
>
> <input type="hidden" name="command.step" value="<c:out
> value='${command.step}'/>"/>
>
> tho...@tr... wrote:
> > Brendan,
> >
> > That's what I thought too, but the command.step property ends up being
> > null when accessed from the validation code.
> >
> > Thomas
> >
> >> Hi Thomas,
> >>
> >> I don't see why:
> >>
> >> <spring:bind path="command.step">
> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
> >> </spring:bind>
> >>
> >> wouldn't work or am I misunderstanding your question?
> >>
> >> Brendan
> >>
> >> On 7/25/06, tho...@tr... <tho...@tr...> wrote:
> >>> Is there a convenient way to assign a fixed value from a hidden form
> >>> element and have it bound to the command object? I'm using the new
> >>> <form>
> >>> tags.
> >>>
> >>> the <form:hidden> tag does not have a value attribute.
> >>>
> >>> Tried to mix in a <spring:bind> tag but this resulted in the preperty
> >>> being set to null on the command object even though it originally had
> a
> >>> value pre-assigned when the command object was created.
> >>>
> >>> Can we mix and match <form:> and <spring:bind> tags?
> >>>
> >>> Here is a simplified version of what I'm using:
> >>>
> >>> <h4>New Login Account</h4>
> >>>
> >>> <form:form commandName="command" action="new_user.htm">
> >>> <table>
> >>> <tr>
> >>> <td class="prompt">Login ID:</td><td class="value">
> >>> <form:input path="user.userName"/>
> >>> </td>
> >>> </tr>
> >>> <tr class="even">
> >>> <td class="prompt">Password:</td><td class="value">
> >>> <form:password path="user.password"/>
> >>> </td>
> >>> <td>Retype Password:</td><td class="value">
> >>> <form:password path="user.retypePassword"/>
> >>> </td>
> >>> </tr>
> >>> </table>
> >>>
> >>> <table>
> >>> <tr>
> >>> <td class="submit"><input name="_eventId_submit" type="submit"
> >>> value="NEXT"/></td>
> >>> </tr>
> >>> </table>
> >>>
> >>> <spring:bind path="command.step">
> >>> <input type="hidden" name="_step" value="STEP1"/>
> >>> </spring:bind>
> >>> <input type="hidden" name="_flowExecutionKey"
> >>> value="${flowExecutionKey}"/>
> >>>
> >>> </form:form>
> >>>
> >>> The "command.step" is the property that I want to be able to set to a
> >>> fixed value from the form, like STEP1 in the example.
> >>>
> >>> Thomas
> >>>
> >>>
> >>>
> -------------------------------------------------------------------------
> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> share
> >>> your
> >>> opinions on IT & business topics through brief surveys -- and earn
> cash
> >>>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >>> _______________________________________________
> >>> Springframework-developer mailing list
> >>> Spr...@li...
> >>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>>
> >>
> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and earn cash
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >
> >
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: <tho...@tr...> - 2006-07-25 19:33:11
|
Brendan,
Thanks for your help - I think I figured it out.
If you look at my original example I had
<spring:bind path="command.step">
<input type="hidden" name="_step" value="STEP1"/>
</spring:bind>
The name="_step" did not match the property name so it did not get bound
even though the path explicitly names the property. It seemed to me that
the path should rule here, but maybe that's not how it's supposed to work.
Once I changed it to
<spring:bind path="command.step">
<input type="hidden" name="step" value="STEP1"/>
</spring:bind>
it works fine and so does
<input type="hidden" name="step" value="STEP1" />
They both get bound properly.
Thanks,
Thomas
> Thomas,
>
> Can you please try this and let us know what the result is:
>
> <input type="hidden" name="step" value="STEP1" />
>
> We do this sort of thing all over the place and it works fine. I'm
> assuming
> here that step is a property on your command object of course.
>
> Also, you did import the spring tags right? (Just asking as that's the
> sort
> of thing I forget to do all the time ;-)
>
> Thanks
> Brendan
>
> On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
>>
>> I think you can also do
>>
>> <input type="hidden" name="command.step" value="<c:out
>> value='${command.step}'/>"/>
>>
>> tho...@tr... wrote:
>> > Brendan,
>> >
>> > That's what I thought too, but the command.step property ends up being
>> > null when accessed from the validation code.
>> >
>> > Thomas
>> >
>> >> Hi Thomas,
>> >>
>> >> I don't see why:
>> >>
>> >> <spring:bind path="command.step">
>> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
>> >> </spring:bind>
>> >>
>> >> wouldn't work or am I misunderstanding your question?
>> >>
>> >> Brendan
>> >>
>> >> On 7/25/06, tho...@tr... <tho...@tr...>
>> wrote:
>> >>> Is there a convenient way to assign a fixed value from a hidden form
>> >>> element and have it bound to the command object? I'm using the new
>> >>> <form>
>> >>> tags.
>> >>>
>> >>> the <form:hidden> tag does not have a value attribute.
>> >>>
>> >>> Tried to mix in a <spring:bind> tag but this resulted in the
>> preperty
>> >>> being set to null on the command object even though it originally
>> had
>> a
>> >>> value pre-assigned when the command object was created.
>> >>>
>> >>> Can we mix and match <form:> and <spring:bind> tags?
>> >>>
>> >>> Here is a simplified version of what I'm using:
>> >>>
>> >>> <h4>New Login Account</h4>
>> >>>
>> >>> <form:form commandName="command" action="new_user.htm">
>> >>> <table>
>> >>> <tr>
>> >>> <td class="prompt">Login ID:</td><td class="value">
>> >>> <form:input path="user.userName"/>
>> >>> </td>
>> >>> </tr>
>> >>> <tr class="even">
>> >>> <td class="prompt">Password:</td><td class="value">
>> >>> <form:password path="user.password"/>
>> >>> </td>
>> >>> <td>Retype Password:</td><td class="value">
>> >>> <form:password path="user.retypePassword"/>
>> >>> </td>
>> >>> </tr>
>> >>> </table>
>> >>>
>> >>> <table>
>> >>> <tr>
>> >>> <td class="submit"><input name="_eventId_submit"
>> type="submit"
>> >>> value="NEXT"/></td>
>> >>> </tr>
>> >>> </table>
>> >>>
>> >>> <spring:bind path="command.step">
>> >>> <input type="hidden" name="_step" value="STEP1"/>
>> >>> </spring:bind>
>> >>> <input type="hidden" name="_flowExecutionKey"
>> >>> value="${flowExecutionKey}"/>
>> >>>
>> >>> </form:form>
>> >>>
>> >>> The "command.step" is the property that I want to be able to set to
>> a
>> >>> fixed value from the form, like STEP1 in the example.
>> >>>
>> >>> Thomas
>> >>>
>> >>>
>> >>>
>> -------------------------------------------------------------------------
>> >>> Take Surveys. Earn Cash. Influence the Future of IT
>> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> >>> your
>> >>> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >>>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> >>> _______________________________________________
>> >>> Springframework-developer mailing list
>> >>> Spr...@li...
>> >>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>> >>>
>> >>
>> -------------------------------------------------------------------------
>> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> >> your
>> >> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >>
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
>> >> Springframework-developer mailing list
>> >> Spr...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>> >>
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance to
>> share
>> your
>> > opinions on IT & business topics through brief surveys -- and earn
>> cash
>> >
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Brendan G. <bre...@gm...> - 2006-07-25 21:52:49
|
Oops, I was going to mention that, but assumed that the $(status.expression}
would fix it. In spring using an _propertyName for a checkbox usually sets
the value to false. I just looked at WebDataBinder and it looks like it was
actually being caused by the underscore. Here is the snippet of code from
WebDataBinder that was setting it to null:
protected void checkFieldMarkers(MutablePropertyValues mpvs) {
if (getFieldMarkerPrefix() != null) {
String fieldMarkerPrefix = getFieldMarkerPrefix();
PropertyValue[] pvArray = mpvs.getPropertyValues();
for (int i = 0; i < pvArray.length; i++) {
PropertyValue pv = pvArray[i];
if (pv.getName().startsWith(fieldMarkerPrefix)) {
String field = pv.getName().substring(
fieldMarkerPrefix.length());
if (getBeanWrapper().isWritableProperty(field) &&
!mpvs.contains(field)) {
Class fieldType =
getBeanWrapper().getPropertyType(field);
--> WILL DROP THROUGH TO HERE
mpvs.addPropertyValue(field, getEmptyValue(field,
fieldType));
}
}
}
}
}
/**
* Determine an empty value for the specified field.
* <p>Default implementation returns <code>Boolean.FALSE</code>
* for boolean fields and an empty array of array types.
* Else, <code>null</code> is used as default.
* @param field the name of the field
* @param fieldType the type of the field
* @return the empty value (for most fields: null)
*/
protected Object getEmptyValue(String field, Class fieldType) {
if (fieldType != null && boolean.class.equals(fieldType) ||
Boolean.class.equals(fieldType)) {
// Special handling of boolean property.
return Boolean.FALSE;
}
else if (fieldType != null && fieldType.isArray()) {
// Special handling of array property.
return Array.newInstance(fieldType.getComponentType(), 0);
}
else {
// Default value: try null.
<-- THIS WILL PROBABLY BE CALLED
return null;
}
}
}
here is a quick and dirty test case to prove it:
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.ServletRequestDataBinder;
public class WebDataBinderTests extends TestCase {
private TestBean testBean;
private MockHttpServletRequest request;
private ServletRequestDataBinder binder;
protected void setUp() {
testBean= new TestBean();
request = new MockHttpServletRequest();
binder = new ServletRequestDataBinder(testBean, "command");
}
public void testBindWithUnderscore() {
request.addParameter("_step", "STEP1");
binder.bind(request);
assertNull(testBean.getStep());
}
public void testBindWithoutUnderscore() {
request.addParameter("step", "STEP1");
binder.bind(request);
assertNotNull(testBean.getStep());
}
private class TestBean {
private String step;
/**
* @return the step
*/
public String getStep() {
return step;
}
/**
* @param step the step to set
*/
public void setStep(String step) {
this.step = step;
}
}
}
On 7/25/06, tho...@tr... <tho...@tr...> wrote:
>
> Brendan,
>
> Thanks for your help - I think I figured it out.
>
> If you look at my original example I had
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
>
> The name="_step" did not match the property name so it did not get bound
> even though the path explicitly names the property. It seemed to me that
> the path should rule here, but maybe that's not how it's supposed to work.
>
> Once I changed it to
>
> <spring:bind path="command.step">
> <input type="hidden" name="step" value="STEP1"/>
> </spring:bind>
>
> it works fine and so does
>
> <input type="hidden" name="step" value="STEP1" />
>
> They both get bound properly.
>
> Thanks,
> Thomas
>
>
> > Thomas,
> >
> > Can you please try this and let us know what the result is:
> >
> > <input type="hidden" name="step" value="STEP1" />
> >
> > We do this sort of thing all over the place and it works fine. I'm
> > assuming
> > here that step is a property on your command object of course.
> >
> > Also, you did import the spring tags right? (Just asking as that's the
> > sort
> > of thing I forget to do all the time ;-)
> >
> > Thanks
> > Brendan
> >
> > On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
> >>
> >> I think you can also do
> >>
> >> <input type="hidden" name="command.step" value="<c:out
> >> value='${command.step}'/>"/>
> >>
> >> tho...@tr... wrote:
> >> > Brendan,
> >> >
> >> > That's what I thought too, but the command.step property ends up
> being
> >> > null when accessed from the validation code.
> >> >
> >> > Thomas
> >> >
> >> >> Hi Thomas,
> >> >>
> >> >> I don't see why:
> >> >>
> >> >> <spring:bind path="command.step">
> >> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
> >> >> </spring:bind>
> >> >>
> >> >> wouldn't work or am I misunderstanding your question?
> >> >>
> >> >> Brendan
> >> >>
> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
> >> wrote:
> >> >>> Is there a convenient way to assign a fixed value from a hidden
> form
> >> >>> element and have it bound to the command object? I'm using the new
> >> >>> <form>
> >> >>> tags.
> >> >>>
> >> >>> the <form:hidden> tag does not have a value attribute.
> >> >>>
> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
> >> preperty
> >> >>> being set to null on the command object even though it originally
> >> had
> >> a
> >> >>> value pre-assigned when the command object was created.
> >> >>>
> >> >>> Can we mix and match <form:> and <spring:bind> tags?
> >> >>>
> >> >>> Here is a simplified version of what I'm using:
> >> >>>
> >> >>> <h4>New Login Account</h4>
> >> >>>
> >> >>> <form:form commandName="command" action="new_user.htm">
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="prompt">Login ID:</td><td class="value">
> >> >>> <form:input path="user.userName"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> <tr class="even">
> >> >>> <td class="prompt">Password:</td><td class="value">
> >> >>> <form:password path="user.password"/>
> >> >>> </td>
> >> >>> <td>Retype Password:</td><td class="value">
> >> >>> <form:password path="user.retypePassword"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="submit"><input name="_eventId_submit"
> >> type="submit"
> >> >>> value="NEXT"/></td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <spring:bind path="command.step">
> >> >>> <input type="hidden" name="_step" value="STEP1"/>
> >> >>> </spring:bind>
> >> >>> <input type="hidden" name="_flowExecutionKey"
> >> >>> value="${flowExecutionKey}"/>
> >> >>>
> >> >>> </form:form>
> >> >>>
> >> >>> The "command.step" is the property that I want to be able to set to
> >> a
> >> >>> fixed value from the form, like STEP1 in the example.
> >> >>>
> >> >>> Thomas
> >> >>>
> >> >>>
> >> >>>
> >>
> -------------------------------------------------------------------------
> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >>> your
> >> >>> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> >>> _______________________________________________
> >> >>> Springframework-developer mailing list
> >> >>> Spr...@li...
> >> >>>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>>
> >> >>
> >>
> -------------------------------------------------------------------------
> >> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> >> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >> your
> >> >> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> >> >> Springframework-developer mailing list
> >> >> Spr...@li...
> >> >>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>
> >> >
> >> >
> >> >
> >>
> -------------------------------------------------------------------------
> >> > Take Surveys. Earn Cash. Influence the Future of IT
> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> your
> >> > opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >>
> >>
> >>
> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and earn cash
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Colin Y. <col...@gm...> - 2006-07-25 21:58:22
|
The spring bind tags are only ever used when rendering the view, not when
submitting the data. Basically the spring bind tags just result in HTML
which is what the browser resubmits.
That being said, if you are using the spring:bind tag then there is a very
useful status object which you can use to get the correct name and value:
<spring:bind path="command.step">
<input type="hidden" name="${status.expression}" value="${status.value
}"/>
</spring:bind>
On 25/07/06, tho...@tr... <tho...@tr...> wrote:
>
> Brendan,
>
> Thanks for your help - I think I figured it out.
>
> If you look at my original example I had
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
>
> The name="_step" did not match the property name so it did not get bound
> even though the path explicitly names the property. It seemed to me that
> the path should rule here, but maybe that's not how it's supposed to work.
>
> Once I changed it to
>
> <spring:bind path="command.step">
> <input type="hidden" name="step" value="STEP1"/>
> </spring:bind>
>
> it works fine and so does
>
> <input type="hidden" name="step" value="STEP1" />
>
> They both get bound properly.
>
> Thanks,
> Thomas
>
>
> > Thomas,
> >
> > Can you please try this and let us know what the result is:
> >
> > <input type="hidden" name="step" value="STEP1" />
> >
> > We do this sort of thing all over the place and it works fine. I'm
> > assuming
> > here that step is a property on your command object of course.
> >
> > Also, you did import the spring tags right? (Just asking as that's the
> > sort
> > of thing I forget to do all the time ;-)
> >
> > Thanks
> > Brendan
> >
> > On 7/25/06, Matt Sgarlata <mat...@sp...> wrote:
> >>
> >> I think you can also do
> >>
> >> <input type="hidden" name="command.step" value="<c:out
> >> value='${command.step}'/>"/>
> >>
> >> tho...@tr... wrote:
> >> > Brendan,
> >> >
> >> > That's what I thought too, but the command.step property ends up
> being
> >> > null when accessed from the validation code.
> >> >
> >> > Thomas
> >> >
> >> >> Hi Thomas,
> >> >>
> >> >> I don't see why:
> >> >>
> >> >> <spring:bind path="command.step">
> >> >> <input type="hidden" name="${status.expression}" value="STEP1"/>
> >> >> </spring:bind>
> >> >>
> >> >> wouldn't work or am I misunderstanding your question?
> >> >>
> >> >> Brendan
> >> >>
> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
> >> wrote:
> >> >>> Is there a convenient way to assign a fixed value from a hidden
> form
> >> >>> element and have it bound to the command object? I'm using the new
> >> >>> <form>
> >> >>> tags.
> >> >>>
> >> >>> the <form:hidden> tag does not have a value attribute.
> >> >>>
> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
> >> preperty
> >> >>> being set to null on the command object even though it originally
> >> had
> >> a
> >> >>> value pre-assigned when the command object was created.
> >> >>>
> >> >>> Can we mix and match <form:> and <spring:bind> tags?
> >> >>>
> >> >>> Here is a simplified version of what I'm using:
> >> >>>
> >> >>> <h4>New Login Account</h4>
> >> >>>
> >> >>> <form:form commandName="command" action="new_user.htm">
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="prompt">Login ID:</td><td class="value">
> >> >>> <form:input path="user.userName"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> <tr class="even">
> >> >>> <td class="prompt">Password:</td><td class="value">
> >> >>> <form:password path="user.password"/>
> >> >>> </td>
> >> >>> <td>Retype Password:</td><td class="value">
> >> >>> <form:password path="user.retypePassword"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="submit"><input name="_eventId_submit"
> >> type="submit"
> >> >>> value="NEXT"/></td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <spring:bind path="command.step">
> >> >>> <input type="hidden" name="_step" value="STEP1"/>
> >> >>> </spring:bind>
> >> >>> <input type="hidden" name="_flowExecutionKey"
> >> >>> value="${flowExecutionKey}"/>
> >> >>>
> >> >>> </form:form>
> >> >>>
> >> >>> The "command.step" is the property that I want to be able to set to
> >> a
> >> >>> fixed value from the form, like STEP1 in the example.
> >> >>>
> >> >>> Thomas
> >> >>>
> >> >>>
> >> >>>
> >>
> -------------------------------------------------------------------------
> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >> >>> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >>> your
> >> >>> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> >>> _______________________________________________
> >> >>> Springframework-developer mailing list
> >> >>> Spr...@li...
> >> >>>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>>
> >> >>
> >>
> -------------------------------------------------------------------------
> >> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> >> Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> >> your
> >> >> opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >>
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> >> >> Springframework-developer mailing list
> >> >> Spr...@li...
> >> >>
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >> >>
> >> >
> >> >
> >> >
> >>
> -------------------------------------------------------------------------
> >> > Take Surveys. Earn Cash. Influence the Future of IT
> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> your
> >> > opinions on IT & business topics through brief surveys -- and earn
> >> cash
> >> >
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >>
> >>
> >>
> -------------------------------------------------------------------------
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and earn cash
> >>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|
|
From: Thomas R. <tho...@tr...> - 2006-07-26 03:44:59
|
Colin,
Right, once I actually started thinking about what was happening
behind the scenes it became obvious that my first approach was
broken. I have used the ${status.expression} in the past but after
using the new <form> tags I got spoiled by just specifying the
path. I like really like the new tags, they are much cleaner in my
opinion. For my use for a hidden field with a static value there is
no need to use a tag library as long as I match the name to the
property.
Thanks,
Thomas
On Jul 25, 2006, at 4:39 PM, Colin Yates wrote:
> The spring bind tags are only ever used when rendering the view,
> not when submitting the data. Basically the spring bind tags just
> result in HTML which is what the browser resubmits.
>
> That being said, if you are using the spring:bind tag then there is
> a very useful status object which you can use to get the correct
> name and value:
>
> <spring:bind path="command.step">
> <input type="hidden" name="${status.expression}" value="$
> {status.value}"/>
> </spring:bind>
>
>
> On 25/07/06, tho...@tr... <tho...@tr...>
> wrote:
> Brendan,
>
> Thanks for your help - I think I figured it out.
>
> If you look at my original example I had
>
> <spring:bind path="command.step">
> <input type="hidden" name="_step" value="STEP1"/>
> </spring:bind>
>
> The name="_step" did not match the property name so it did not get
> bound
> even though the path explicitly names the property. It seemed to
> me that
> the path should rule here, but maybe that's not how it's supposed
> to work.
>
> Once I changed it to
>
> <spring:bind path="command.step">
> <input type="hidden" name="step" value="STEP1"/>
> </spring:bind>
>
> it works fine and so does
>
> <input type="hidden" name="step" value="STEP1" />
>
> They both get bound properly.
>
> Thanks,
> Thomas
>
>
> > Thomas,
> >
> > Can you please try this and let us know what the result is:
> >
> > <input type="hidden" name="step" value="STEP1" />
> >
> > We do this sort of thing all over the place and it works fine. I'm
> > assuming
> > here that step is a property on your command object of course.
> >
> > Also, you did import the spring tags right? (Just asking as
> that's the
> > sort
> > of thing I forget to do all the time ;-)
> >
> > Thanks
> > Brendan
> >
> > On 7/25/06, Matt Sgarlata < mat...@sp...>
> wrote:
> >>
> >> I think you can also do
> >>
> >> <input type="hidden" name="command.step " value="<c:out
> >> value='${command.step}'/>"/>
> >>
> >> tho...@tr... wrote:
> >> > Brendan,
> >> >
> >> > That's what I thought too, but the command.step property ends
> up being
> >> > null when accessed from the validation code.
> >> >
> >> > Thomas
> >> >
> >> >> Hi Thomas,
> >> >>
> >> >> I don't see why:
> >> >>
> >> >> <spring:bind path="command.step">
> >> >> <input type="hidden" name="${ status.expression}"
> value="STEP1"/>
> >> >> </spring:bind>
> >> >>
> >> >> wouldn't work or am I misunderstanding your question?
> >> >>
> >> >> Brendan
> >> >>
> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
> >> wrote:
> >> >>> Is there a convenient way to assign a fixed value from a
> hidden form
> >> >>> element and have it bound to the command object? I'm using
> the new
> >> >>> <form>
> >> >>> tags.
> >> >>>
> >> >>> the <form:hidden> tag does not have a value attribute.
> >> >>>
> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
> >> preperty
> >> >>> being set to null on the command object even though it
> originally
> >> had
> >> a
> >> >>> value pre-assigned when the command object was created.
> >> >>>
> >> >>> Can we mix and match <form:> and <spring:bind> tags?
> >> >>>
> >> >>> Here is a simplified version of what I'm using:
> >> >>>
> >> >>> <h4>New Login Account</h4>
> >> >>>
> >> >>> <form:form commandName="command" action="new_user.htm">
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="prompt">Login ID:</td><td class="value">
> >> >>> <form:input path=" user.userName"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> <tr class="even">
> >> >>> <td class="prompt">Password:</td><td class="value">
> >> >>> <form:password path="user.password"/>
> >> >>> </td>
> >> >>> <td>Retype Password:</td><td class="value">
> >> >>> <form:password path="user.retypePassword"/>
> >> >>> </td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <table>
> >> >>> <tr>
> >> >>> <td class="submit"><input name="_eventId_submit"
> >> type="submit"
> >> >>> value="NEXT"/></td>
> >> >>> </tr>
> >> >>> </table>
> >> >>>
> >> >>> <spring:bind path=" command.step">
> >> >>> <input type="hidden" name="_step" value="STEP1"/>
> >> >>> </spring:bind>
> >> >>> <input type="hidden" name="_flowExecutionKey"
> >> >>> value="${flowExecutionKey}"/>
> >> >>>
> >> >>> </form:form>
> >> >>>
> >> >>> The "command.step" is the property that I want to be able to
> set to
> >> a
> >> >>> fixed value from the form, like STEP1 in the example.
> >> >>>
> >> >>> Thomas
> >> >>>
> >> >>>
> >> >>>
> >>
> ----------------------------------------------------------------------
> ---
> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
> >> >>> Join SourceForge.net's Techsay panel and you'll get the
> chance to
> >> share
> >> >>> your
> >> >>> opinions on IT & business topics through brief surveys --
> and earn
> >> cash
> >> >>>
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> >> >>> _______________________________________________
> >> >>> Springframework-developer mailing list
> >> >>> Spr...@li...
> >> >>> https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >> >>>
> >> >>
> >>
> ----------------------------------------------------------------------
> ---
> >> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> >> Join SourceForge.net's Techsay panel and you'll get the
> chance to
> >> share
> >> >> your
> >> >> opinions on IT & business topics through brief surveys -- and
> earn
> >> cash
> >> >>
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> >> >> Springframework-developer mailing list
> >> >> Spr...@li...
> >> >> https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >> >>
> >> >
> >> >
> >> >
> >>
> ----------------------------------------------------------------------
> ---
> >> > Take Surveys. Earn Cash. Influence the Future of IT
> >> > Join SourceForge.net's Techsay panel and you'll get the chance to
> >> share
> >> your
> >> > opinions on IT & business topics through brief surveys -- and
> earn
> >> cash
> >> >
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> >>
> >>
> >>
> ----------------------------------------------------------------------
> ---
> >> Take Surveys. Earn Cash. Influence the Future of IT
> >> Join SourceForge.net's Techsay panel and you'll get the chance
> to share
> >> your
> >> opinions on IT & business topics through brief surveys -- and
> earn cash
> >> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> >> _______________________________________________
> >> Springframework-developer mailing list
> >> Spr...@li...
> >> https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >>
> >
> ----------------------------------------------------------------------
> ---
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to
> share
> > your
> > opinions on IT & business topics through brief surveys -- and
> earn cash
> > http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> > Springframework-developer mailing list
> > Spr...@li...
> > https://lists.sourceforge.net/lists/listinfo/springframework-
> developer
> >
>
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Rob H. <ro...@in...> - 2006-07-28 21:34:00
|
I can always add the ability to use the form tags for this if you'd
like :)
I just think the plain HTML works pretty nicely here as well.
Rob
On 26 Jul 2006, at 03:58, Thomas Risberg wrote:
> Colin,
>
> Right, once I actually started thinking about what was happening
> behind the scenes it became obvious that my first approach was
> broken. I have used the ${status.expression} in the past but after
> using the new <form> tags I got spoiled by just specifying the
> path. I like really like the new tags, they are much cleaner in my
> opinion. For my use for a hidden field with a static value there
> is no need to use a tag library as long as I match the name to the
> property.
>
> Thanks,
> Thomas
>
>
>
> On Jul 25, 2006, at 4:39 PM, Colin Yates wrote:
>
>> The spring bind tags are only ever used when rendering the view,
>> not when submitting the data. Basically the spring bind tags just
>> result in HTML which is what the browser resubmits.
>>
>> That being said, if you are using the spring:bind tag then there
>> is a very useful status object which you can use to get the
>> correct name and value:
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="${status.expression}" value="$
>> {status.value}"/>
>> </spring:bind>
>>
>>
>> On 25/07/06, tho...@tr... <tho...@tr...>
>> wrote:
>> Brendan,
>>
>> Thanks for your help - I think I figured it out.
>>
>> If you look at my original example I had
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="_step" value="STEP1"/>
>> </spring:bind>
>>
>> The name="_step" did not match the property name so it did not get
>> bound
>> even though the path explicitly names the property. It seemed to
>> me that
>> the path should rule here, but maybe that's not how it's supposed
>> to work.
>>
>> Once I changed it to
>>
>> <spring:bind path="command.step">
>> <input type="hidden" name="step" value="STEP1"/>
>> </spring:bind>
>>
>> it works fine and so does
>>
>> <input type="hidden" name="step" value="STEP1" />
>>
>> They both get bound properly.
>>
>> Thanks,
>> Thomas
>>
>>
>> > Thomas,
>> >
>> > Can you please try this and let us know what the result is:
>> >
>> > <input type="hidden" name="step" value="STEP1" />
>> >
>> > We do this sort of thing all over the place and it works fine. I'm
>> > assuming
>> > here that step is a property on your command object of course.
>> >
>> > Also, you did import the spring tags right? (Just asking as
>> that's the
>> > sort
>> > of thing I forget to do all the time ;-)
>> >
>> > Thanks
>> > Brendan
>> >
>> > On 7/25/06, Matt Sgarlata < mat...@sp...>
>> wrote:
>> >>
>> >> I think you can also do
>> >>
>> >> <input type="hidden" name="command.step " value="<c:out
>> >> value='${command.step}'/>"/>
>> >>
>> >> tho...@tr... wrote:
>> >> > Brendan,
>> >> >
>> >> > That's what I thought too, but the command.step property ends
>> up being
>> >> > null when accessed from the validation code.
>> >> >
>> >> > Thomas
>> >> >
>> >> >> Hi Thomas,
>> >> >>
>> >> >> I don't see why:
>> >> >>
>> >> >> <spring:bind path="command.step">
>> >> >> <input type="hidden" name="${ status.expression}"
>> value="STEP1"/>
>> >> >> </spring:bind>
>> >> >>
>> >> >> wouldn't work or am I misunderstanding your question?
>> >> >>
>> >> >> Brendan
>> >> >>
>> >> >> On 7/25/06, tho...@tr... <tho...@tr...>
>> >> wrote:
>> >> >>> Is there a convenient way to assign a fixed value from a
>> hidden form
>> >> >>> element and have it bound to the command object? I'm using
>> the new
>> >> >>> <form>
>> >> >>> tags.
>> >> >>>
>> >> >>> the <form:hidden> tag does not have a value attribute.
>> >> >>>
>> >> >>> Tried to mix in a <spring:bind> tag but this resulted in the
>> >> preperty
>> >> >>> being set to null on the command object even though it
>> originally
>> >> had
>> >> a
>> >> >>> value pre-assigned when the command object was created.
>> >> >>>
>> >> >>> Can we mix and match <form:> and <spring:bind> tags?
>> >> >>>
>> >> >>> Here is a simplified version of what I'm using:
>> >> >>>
>> >> >>> <h4>New Login Account</h4>
>> >> >>>
>> >> >>> <form:form commandName="command" action="new_user.htm">
>> >> >>> <table>
>> >> >>> <tr>
>> >> >>> <td class="prompt">Login ID:</td><td class="value">
>> >> >>> <form:input path=" user.userName"/>
>> >> >>> </td>
>> >> >>> </tr>
>> >> >>> <tr class="even">
>> >> >>> <td class="prompt">Password:</td><td class="value">
>> >> >>> <form:password path="user.password"/>
>> >> >>> </td>
>> >> >>> <td>Retype Password:</td><td class="value">
>> >> >>> <form:password path="user.retypePassword"/>
>> >> >>> </td>
>> >> >>> </tr>
>> >> >>> </table>
>> >> >>>
>> >> >>> <table>
>> >> >>> <tr>
>> >> >>> <td class="submit"><input name="_eventId_submit"
>> >> type="submit"
>> >> >>> value="NEXT"/></td>
>> >> >>> </tr>
>> >> >>> </table>
>> >> >>>
>> >> >>> <spring:bind path=" command.step">
>> >> >>> <input type="hidden" name="_step" value="STEP1"/>
>> >> >>> </spring:bind>
>> >> >>> <input type="hidden" name="_flowExecutionKey"
>> >> >>> value="${flowExecutionKey}"/>
>> >> >>>
>> >> >>> </form:form>
>> >> >>>
>> >> >>> The "command.step" is the property that I want to be able
>> to set to
>> >> a
>> >> >>> fixed value from the form, like STEP1 in the example.
>> >> >>>
>> >> >>> Thomas
>> >> >>>
>> >> >>>
>> >> >>>
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> >>> Take Surveys. Earn Cash. Influence the Future of IT
>> >> >>> Join SourceForge.net's Techsay panel and you'll get the
>> chance to
>> >> share
>> >> >>> your
>> >> >>> opinions on IT & business topics through brief surveys --
>> and earn
>> >> cash
>> >> >>>
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> >> >>> _______________________________________________
>> >> >>> Springframework-developer mailing list
>> >> >>> Spr...@li...
>> >> >>> https://lists.sourceforge.net/lists/listinfo/
>> springframework-developer
>> >> >>>
>> >> >>
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> >> Join SourceForge.net's Techsay panel and you'll get the
>> chance to
>> >> share
>> >> >> your
>> >> >> opinions on IT & business topics through brief surveys --
>> and earn
>> >> cash
>> >> >>
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV_______________________________
>> ________________
>> >> >> Springframework-developer mailing list
>> >> >> Spr...@li...
>> >> >> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>> >> >>
>> >> >
>> >> >
>> >> >
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> > Take Surveys. Earn Cash. Influence the Future of IT
>> >> > Join SourceForge.net's Techsay panel and you'll get the
>> chance to
>> >> share
>> >> your
>> >> > opinions on IT & business topics through brief surveys -- and
>> earn
>> >> cash
>> >> >
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> >>
>> >>
>> >>
>> ---------------------------------------------------------------------
>> ----
>> >> Take Surveys. Earn Cash. Influence the Future of IT
>> >> Join SourceForge.net's Techsay panel and you'll get the chance
>> to share
>> >> your
>> >> opinions on IT & business topics through brief surveys -- and
>> earn cash
>> >> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> >> _______________________________________________
>> >> Springframework-developer mailing list
>> >> Spr...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>> >>
>> >
>> ---------------------------------------------------------------------
>> ----
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance
>> to share
>> > your
>> > opinions on IT & business topics through brief surveys -- and
>> earn cash
>> > http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV_______________________________
>> ________________
>> > Springframework-developer mailing list
>> > Spr...@li...
>> > https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>> >
>>
>>
>> ---------------------------------------------------------------------
>> ----
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>>
>> ---------------------------------------------------------------------
>> ----
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys -- and earn
>> cash
>> http://www.techsay.com/default.php?
>> page=join.php&p=sourceforge&CID=DEVDEV_______________________________
>> ________________
>> Springframework-developer mailing list
>> Spr...@li...
>> https://lists.sourceforge.net/lists/listinfo/springframework-
>> developer
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
--
Rob Harrop
VP, Technology Strategy
Interface21 - Spring Services from the Source
http://www.springframework.com
|
|
From: Thomas R. <tho...@tr...> - 2006-07-29 16:02:48
|
I don't have a problem with the plain html. It works well, but you need to have an understanding of how the Spring binding works. This is hidden by the <form:xxx> tags. From a language perspective it would be nice to have the ability to use a <form:xxx> tag on anything that gets submitted with the page including the submit button. That would make it clear what gets submitted by just looking at the jsp code. I think this would be beneficial for programmers that don't do a lot of web programming. Just a thought. Thomas On Jul 27, 2006, at 6:05 PM, Rob Harrop wrote: > I can always add the ability to use the form tags for this if you'd > like :) > > I just think the plain HTML works pretty nicely here as well. |
|
From: Colin Y. <col...@gm...> - 2006-07-29 16:56:44
|
I agree, simply because those two paragraphs could be talking about tags in general ;) Even if it was as simple as <form:static name="abc" value="efg"/> it would allow the form:xxx tags to be extensive, as well as internally consistent. They would also have the added value of taking part in any nested bind paths (assuming the others do that???) Just my 0.78 cents ;) Col On 29/07/06, Thomas Risberg <tho...@tr...> wrote: > > I don't have a problem with the plain html. It works well, but you > need to have an understanding of how the Spring binding works. This > is hidden by the <form:xxx> tags. > > From a language perspective it would be nice to have the ability to > use a <form:xxx> tag on anything that gets submitted with the page > including the submit button. That would make it clear what gets > submitted by just looking at the jsp code. I think this would be > beneficial for programmers that don't do a lot of web programming. > Just a thought. > > Thomas > > > On Jul 27, 2006, at 6:05 PM, Rob Harrop wrote: > > > I can always add the ability to use the form tags for this if you'd > > like :) > > > > I just think the plain HTML works pretty nicely here as well. > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |