本文整理汇总了Java中org.springframework.web.servlet.mvc.SimpleFormController类的典型用法代码示例。如果您正苦于以下问题:Java SimpleFormController类的具体用法?Java SimpleFormController怎么用?Java SimpleFormController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleFormController类属于org.springframework.web.servlet.mvc包,在下文中一共展示了SimpleFormController类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSubmit_shouldRetireLocation
import org.springframework.web.servlet.mvc.SimpleFormController; //导入依赖的package包/类
/**
* @see LocationFormController#onSubmit(HttpServletRequest,HttpServletResponse,Object,BindException)
*/
@Test
@Verifies(value = "should retire location", method = "onSubmit(HttpServletRequest,HttpServletResponse,Object,BindException)")
public void onSubmit_shouldRetireLocation() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("POST", "");
request.setParameter("locationId", "1");
request.setParameter("retireReason", "some non-null reason");
request.setParameter("retireLocation", "true");
HttpServletResponse response = new MockHttpServletResponse();
((SimpleFormController) getLocationFormController()).handleRequest(request, response);
Location retiredLocation = Context.getLocationService().getLocation(1);
Assert.assertTrue(retiredLocation.isRetired());
}
示例2: refresh
import org.springframework.web.servlet.mvc.SimpleFormController; //导入依赖的package包/类
@Override
public void refresh() throws BeansException {
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.add("commandClass", "org.springframework.tests.sample.beans.TestBean");
pvs.add("formView", "form");
registerSingleton("/form.do", SimpleFormController.class, pvs);
registerSingleton("/locale.do", LocaleChecker.class);
addMessage("test", Locale.ENGLISH, "test message");
addMessage("test", Locale.CANADA, "Canadian & test message");
addMessage("testArgs", Locale.ENGLISH, "test {0} message {1}");
addMessage("testArgsFormat", Locale.ENGLISH, "test {0} message {1,number,#.##} X");
registerSingleton(UiApplicationContextUtils.THEME_SOURCE_BEAN_NAME, DummyThemeSource.class);
registerSingleton("handlerMapping", BeanNameUrlHandlerMapping.class);
registerSingleton("viewResolver", InternalResourceViewResolver.class);
pvs = new MutablePropertyValues();
pvs.add("location", "org/springframework/web/context/WEB-INF/sessionContext.xml");
registerSingleton("viewResolver2", XmlViewResolver.class, pvs);
super.refresh();
}
示例3: onSubmit_shouldNotFailIfNoEncounterTypesAreSelected
import org.springframework.web.servlet.mvc.SimpleFormController; //导入依赖的package包/类
/**
* @see EncounterTypeListController#onSubmit(HttpServletRequest,HttpServletResponse,Object,BindException)
*/
@Test
@Verifies(value = "should not fail if no encounter types are selected", method = "onSubmit(HttpServletRequest,HttpServletResponse,Object,BindException)")
public void onSubmit_shouldNotFailIfNoEncounterTypesAreSelected() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest("POST", "");
HttpServletResponse response = new MockHttpServletResponse();
SimpleFormController controller = (SimpleFormController) applicationContext.getBean("encounterTypeList");
// make sure an NPE isn't thrown here because no encounter types were selected
controller.handleRequest(request, response);
}