本文整理汇总了Java中org.apache.struts.config.FormBeanConfig.setType方法的典型用法代码示例。如果您正苦于以下问题:Java FormBeanConfig.setType方法的具体用法?Java FormBeanConfig.setType怎么用?Java FormBeanConfig.setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.struts.config.FormBeanConfig
的用法示例。
在下文中一共展示了FormBeanConfig.setType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
public void setUp() throws Exception {
super.setUp();
// set the context directory to /zeprs
// to find the /WEB-INF/web.xml
this.setContextDirectory(new File("webapps/zeprs"));
this.setConfigFile("/WEB-INF/foo.xml");
ServletConfigSimulator cfgSim = new ServletConfigSimulator();
Enumeration initParams = cfgSim.getInitParameterNames();
ServletContext cntx = cfgSim.getServletContext();
DataSource dataSource = DatabaseUtils.createConnectionPool();
cntx.setAttribute("java:comp/env/jdbc/zeprsDB", dataSource);
// Construct a FormBeanConfig to be used
beanConfig = new FormBeanConfig();
beanConfig.setName("dynaForm");
beanConfig.setType("org.apache.struts.action.DynaActionForm");
// zeprsDatasource = DatabaseUtils.createConnectionPool();
}
示例2: setUp
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
public void setUp() throws Exception {
super.setUp();
// set the context directory to /zeprs
// to find the /WEB-INF/web.xml
this.setContextDirectory(new File("webapps/zeprs"));
this.setConfigFile("/WEB-INF/strutstest.xml");
ServletConfigSimulator cfgSim = new ServletConfigSimulator();
Enumeration initParams = cfgSim.getInitParameterNames();
ServletContext cntx = cfgSim.getServletContext();
// set the book into the action form
//bookEditForm = new BookEditForm();
//bookEditForm.setBook(new Book(1, "laliluna", "StrutsTestCases Tutorial", true));
// set the form data in the action form
// ActionForm form
form4 = new DynaValidatorForm();
form4.getDynaClass();
// Construct a FormBeanConfig to be used
beanConfig = new FormBeanConfig();
beanConfig.setName("dynaForm");
beanConfig.setType("org.apache.struts.action.DynaActionForm");
}
示例3: reset
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
public void reset(ActionMapping mapping, HttpServletRequest request) {
log.debug("reset");
super.reset(mapping, request);
try {
InstanciaDelegate delegate = RegistroManager.recuperarInstancia(request);
Pantalla pantalla = delegate.obtenerPantalla();
FormBeanConfig config = new FormBeanConfig();
config.setName("p_" + pantalla.getId());
config.setType(this.getClass().getName());
config.setModuleConfig(mapping.getModuleConfig());
for (int i = 0; i < pantalla.getCampos().size(); i++) {
Campo campo = (Campo) pantalla.getCampos().get(i);
config.addFormPropertyConfig(getCampoConfig(campo));
}
// Aix� nomes s'hauria de fer quan desde el back s'actualitza una pantalla - camp.
// per poder aprofitar el cache the dynaClass.
DynaActionFormClass.clear();
dynaClass = DynaActionFormClass.createDynaActionFormClass(config);
FormPropertyConfig props[] = config.findFormPropertyConfigs();
for (int i = 0; i < props.length; i++) {
this.set(props[i].getName(), props[i].initial());
}
// Preparar resources de validacion
ServletContext application = getServlet().getServletContext();
DynValidatorResources resources =
(DynValidatorResources) Resources.getValidatorResources(application, request);
resources.setPantalla(pantalla);
} catch (DelegateException e) {
log.error("Excepci�n en reset", e);
} catch (Throwable t) {
log.error("Error en reset", t);
}
}
示例4: setUp
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
protected void setUp() throws Exception {
context = new MockActionContext();
ModuleConfigImpl moduleConfig = new ModuleConfigImpl("/");
context.setModuleConfig(moduleConfig);
FormBeanConfig fooFBC = new FormBeanConfig();
fooFBC.setName("foo");
fooFBC.setType("org.apache.struts.mock.MockFormBean");
moduleConfig.addFormBeanConfig(fooFBC);
FormBeanConfig barFBC = new FormBeanConfig();
barFBC.setName("bar");
barFBC.setType("org.apache.struts.action.DynaActionForm"); // use a different type so we can verify lookups better
FormPropertyConfig fpc = new FormPropertyConfig();
fpc.setName("property");
fpc.setType("java.lang.String");
fpc.setInitial("test");
barFBC.addFormPropertyConfig(fpc);
moduleConfig.addFormBeanConfig(barFBC);
ActionConfig testActionConfig = new ActionConfig();
testActionConfig.setPath("/Test");
testActionConfig.setName("foo");
testActionConfig.setScope("request");
moduleConfig.addActionConfig(testActionConfig);
moduleConfig.freeze(); // otherwise, ActionConfigMatcher will be null and we'll get an NPE...
}
示例5: setUp
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
public void setUp() {
// Construct a FormBeanConfig to be used
beanConfig = new FormBeanConfig();
beanConfig.setName("dynaForm");
beanConfig.setType("org.apache.struts.action.DynaActionForm");
// Add relevant property definitions
for (int i = 0; i < dynaProperties.length; i++) {
beanConfig.addFormPropertyConfig(dynaProperties[i]);
}
// Construct a corresponding DynaActionFormClass
dynaClass = new DynaActionFormClass(beanConfig);
}
示例6: testProcessFormBeanConfigClass
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
/**
* Make sure processFormBeanConfigClass() returns an instance of the
* correct class if the base config is using a custom class.
*/
public void testProcessFormBeanConfigClass()
throws Exception {
CustomFormBeanConfig customBase = new CustomFormBeanConfig();
customBase.setName("customBase");
moduleConfig.addFormBeanConfig(customBase);
FormBeanConfig customSub = new FormBeanConfig();
customSub.setName("customSub");
customSub.setExtends("customBase");
customSub.setType("org.apache.struts.action.DynaActionForm");
moduleConfig.addFormBeanConfig(customSub);
FormBeanConfig result =
actionServlet.processFormBeanConfigClass(customSub, moduleConfig);
assertTrue("Incorrect class of form bean config",
result instanceof CustomFormBeanConfig);
assertEquals("Incorrect name", customSub.getName(), result.getName());
assertEquals("Incorrect type", customSub.getType(), result.getType());
assertEquals("Incorrect extends", customSub.getExtends(),
result.getExtends());
assertEquals("Incorrect 'restricted' value", customSub.isRestricted(),
result.isRestricted());
assertSame("Result was not registered in the module config", result,
moduleConfig.findFormBeanConfig("customSub"));
}
示例7: RhnMockDynaActionForm
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
/**
* Default constructor
*/
public RhnMockDynaActionForm() {
super();
actual = new HashMap();
expected = new HashMap();
expectNothing = false;
formPropertyConfigs = new HashMap();
// Setup the empty config.
FormBeanConfig beanConfig = new FormBeanConfig();
beanConfig.setType(this.getClass().getName());
DynaActionFormClass theDynaClass = DynaActionFormClass
.createDynaActionFormClass(beanConfig);
setDynamicActionFormClass(theDynaClass);
}
示例8: set
import org.apache.struts.config.FormBeanConfig; //导入方法依赖的package包/类
/**
* Stores the name with the given value.
* @param name Name to be associated.
* @param value Value to associate with name.
*/
public void set(String name, Object value) {
// Nothin to do here if we are inserting a
// null value.
if (value == null) {
return;
}
// This set of code below adds the name of this
// property to the DynaClass that is used by
// the DynaForm so we can actually treat this
// Mock Form like a DynaBean.
if (!formPropertyConfigs.containsKey(name)) {
FormBeanConfig beanConfig = new FormBeanConfig();
beanConfig.setName(getFormName());
beanConfig.setType(this.getClass().getName());
// Right now we only support Strings as dynamic members of
// the dynaclass.
FormPropertyConfig fc =
new FormPropertyConfig(name, "java.lang.String", value.toString());
formPropertyConfigs.put(name, fc);
// Get existing properties as well as new one
// and add it to the config.
Iterator i = formPropertyConfigs.values().iterator();
while (i.hasNext()) {
beanConfig.addFormPropertyConfig((FormPropertyConfig) i.next());
}
// Construct a corresponding DynaActionFormClass
DynaActionFormClass theDynaClass =
DynaActionFormClass.createDynaActionFormClass(beanConfig);
setDynamicActionFormClass(theDynaClass);
}
// Add the actual value
actual.put(name, value);
}