Expert Spring MVC and Web Flow
To be clear, the AbstractControllerdoes not implement the LastModifiedinterface. It is up to you to provide this functionality, ...
The org.springframework.web.servlet.mvc.BaseCommandControllerclass provides the basic feature set for supporting form submits, i ...
Binding a Form to a Bean Spring MVC encourages the use of command beans with a wide variety of property types. However, the Serv ...
} public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } The ...
We are using an org.springframework.mock.web.MockHttpServletRequestto simulate an HttpServletRequestobject. Spring provides a co ...
such as firstName, into JavaBean setters, such as setFirstName(). After bind returns, the bean is populated and ready to be used ...
public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } pu ...
Binding to Collections Along with nested classes, the DataBindersupports binding properties of objects inside collec- tions. You ...
public void testSimpleBind() { // just like /servlet?names[0].firstName=Anya&names[0].lastName=Lala request.addParameter("na ...
binder.bind(request); assertEquals("Anya", bean.getStrings().get(0)); // true! assertEquals("Lala", bean.getStrings().get(1)); / ...
Binding to Maps Binding to properties inside objects inside Maps is similar to Lists. The brackets remain, but instead of a nume ...
public void testSimpleBind() { // just like /servlet?names['nickname'].firstName=Anya \ // &names['nickname'].lastName=Lala ...
Listing 6-19.NestedSetCommandBean Class public class NestedSetCommandBean { Set<Name> names = new LinkedHashSet<Name> ...
// true! assertEquals("Anya", bean.getNames().iterator().next().getFirstName()); // true! assertEquals("Lala", bean.getNames().i ...
Table 6-1.BeanWrapper Default PropertyEditors PropertyEditor Result Description ByteArrayPropertyEditor byte[] String to a byte[ ...
Listing 6-22.MultiTypeCommandBean Class public class MultiTypeCommandBean { private int intProperty; private Integer integerProp ...
Integer Property: <input type="text" name="integerProperty" /> </p> <p> Class Property: <input type="text" ...
Non-default PropertyEditors Some types of classes can’t be created from Strings without context specific configurations. For ins ...
Listing 6-27.DateCommandBean Unit Test protected void setUp() throws Exception { bean = new DateCommandBean(); request = new Moc ...
Listing 6-28.TwoDatesCommand Class public class TwoDatesCommand { private Date firstDate; private Date secondDate; public Date g ...
«
3
4
5
6
7
8
9
10
11
12
»
Free download pdf