<set-property> sets the attributes on the FormBeanConfig object itself that is created for that particular <form-bean> tag. Since foo is not a property on FormBeanConfig you see this error. You can extend FormBeanConfig and include the attribute foo in there but I am not sure what you will gain from that. I think you are looking for ActionForm and form-property.
[EMAIL PROTECTED] wrote:
<set-property> is a sub-tag,
check out the dtd - http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd
I suspect that my problem is because I am supposed to use sub-classes of FormBeanConfig, but I haven't been able to hook it up to my form yet.
-----Original Message----- From: Saul Q Yuan [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 6:28 PM To: Struts Users Mailing List Subject: Re: Using struts-config to configure properties in action form
<set-property> is not a sub-tag of <form-bean>, <form-property> is though. If you're not using dynamic form bean, you don't need to define the properties in the <form-bean> tag.
HTH,
Saul
----- Original Message ----- From: Chan, Jim To: '[EMAIL PROTECTED]' Sent: Monday, March 22, 2004 8:27 PM
Subject: Using struts-config to configure properties in action form
I am trying to configure properties in my ActionForm using the struts-config file as follows.
<form-bean name="myForm" type="com.myCompany.MyForm"> <set-property property="foo" value="bar" />
</form-bean>
public Class MyForm extends ActionForm
{
private String foo;
public void setFoo(String foo) { this.foo = foo; }
public String getFoo() { return foo; } }
However, I am getting an error as follows. Anyone know if I am missing any steps? Any help is greatly appreciated.
java.lang.NoSuchMethodException: Bean has no property named foo at
org.apache.commons.digester.SetPropertyRule.begin(SetPropertyRule.java:192) at org.apache.commons.digester.Rule.begin(Rule.java:200) at org.apache.commons.digester.Digester.startElement(Digester.java:1273) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc her.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at
org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.j ava:1006) at
org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:9 55) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470) at javax.servlet.GenericServlet.init(GenericServlet.java:256) at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93 5) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java: 3422) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3623) at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8 21) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j ava:307) at org.apache.catalina.core.StandardHost.install(StandardHost.java:788) at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559 ) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358) at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:166) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]