mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-03 04:19:47 +01:00
pruned presentation model system from trunk to move to dev branch as its a 3.1 feature now
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1692 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
-50
@@ -76,7 +76,6 @@ import org.springframework.mock.web.MockHttpServletRequest;
|
|||||||
import org.springframework.mock.web.MockHttpServletResponse;
|
import org.springframework.mock.web.MockHttpServletResponse;
|
||||||
import org.springframework.mock.web.MockServletConfig;
|
import org.springframework.mock.web.MockServletConfig;
|
||||||
import org.springframework.mock.web.MockServletContext;
|
import org.springframework.mock.web.MockServletContext;
|
||||||
import org.springframework.model.ui.config.BindingLifecycle;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ExtendedModelMap;
|
import org.springframework.ui.ExtendedModelMap;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@@ -1733,54 +1732,5 @@ public class ServletAnnotationControllerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testBindingLifecycle() throws Exception {
|
|
||||||
initServlet(BindingLifecycleController.class);
|
|
||||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/test");
|
|
||||||
request.addParameter("bar", "test");
|
|
||||||
request.addParameter("baz", "12");
|
|
||||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
|
||||||
servlet.service(request, response);
|
|
||||||
assertEquals("bar=test, baz=12", response.getContentAsString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public static class BindingLifecycleController {
|
|
||||||
|
|
||||||
@RequestMapping("/test")
|
|
||||||
public void bind(BindingLifecycle<Foo> fooLifecycle, Writer writer) throws IOException {
|
|
||||||
fooLifecycle.execute();
|
|
||||||
Foo foo = fooLifecycle.getModel();
|
|
||||||
assertEquals("test", foo.getBar());
|
|
||||||
assertEquals(new Integer(12), foo.getBaz());
|
|
||||||
writer.write("bar=" + foo.getBar() + ", baz=" + foo.getBaz());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Foo {
|
|
||||||
|
|
||||||
private String bar;
|
|
||||||
|
|
||||||
private Integer baz;
|
|
||||||
|
|
||||||
public String getBar() {
|
|
||||||
return bar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBar(String bar) {
|
|
||||||
this.bar = bar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getBaz() {
|
|
||||||
return baz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBaz(Integer baz) {
|
|
||||||
this.baz = baz;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user