当前位置: 首页>>代码示例>>Java>>正文


Java SimpleFormController类代码示例

本文整理汇总了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());
}
 
开发者ID:openmrs,项目名称:openmrs-module-legacyui,代码行数:19,代码来源:LocationFormControllerTest.java

示例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();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:26,代码来源:SimpleWebApplicationContext.java

示例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);
}
 
开发者ID:openmrs,项目名称:openmrs-module-legacyui,代码行数:15,代码来源:EncounterTypeListControllerTest.java


注:本文中的org.springframework.web.servlet.mvc.SimpleFormController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。