Accessing form beans
Hi there, yet another question... Is there an easy way to just display some form bean properties? Let's say I've got a form defined as html:form action=/foo html:text property=bar / /html:form Now I just want to display an additional value from the form bean as configured in the struts-config.xml file. As there's no html:write I have to use bean:write which on the other hand requires a name. To get things working I have to change the first line to html:form type=com.yoyodyne.FooAction type=FooForm action=/foo Is there a more elegant and less redundant way? ...Michael... -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Accessing form beans
If /foo is mapped to FooForm bean, you can use bean:write name=FooForm property=xxx / without changes to your html:form. bean:write will look in scopes for an object called FooForm. This has no effect with using html:form or not - assuming FooForm is in session or request scope ! If you've got problem with this, perhaps you don't have such an existing bean in scope. (look at the scope you setted in struts-config.xml). html:form with a type attribute will create one if there's none. html: tags can work without such a bean, just displaying no initial data. Nico Hi there, yet another question... Is there an easy way to just display some form bean properties? Let's say I've got a form defined as html:form action=/foo html:text property=bar / /html:form Now I just want to display an additional value from the form bean as configured in the struts-config.xml file. As there's no html:write I have to use bean:write which on the other hand requires a name. To get things working I have to change the first line to html:form type=com.yoyodyne.FooAction type=FooForm action=/foo Is there a more elegant and less redundant way? ...Michael... -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Accessing form beans
Nicolas De Loof wrote: If /foo is mapped to FooForm bean, you can use bean:write name=FooForm property=xxx / without changes to your html:form. bean:write will look in scopes for an object called FooForm. This has no effect with using html:form or not - assuming FooForm is in session or request scope ! If you've got problem with this, perhaps you don't have such an existing bean in scope. (look at the scope you setted in struts-config.xml). html:form with a type attribute will create one if there's none. html: tags can work without such a bean, just displaying no initial data. Okay, thanks, that works. At least that saves me from putting too much in the html:form tag, although I still have to repeat the information from the struts-config in the bean:write tag. Well, you can't have everything... ...Michael... -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Accessing form beans
If your bean is defined and named in struts-config, is in session/application scope, and associated with the action for the instant JSP, you can simply: bean:write name=fooForm property=bar / Mark -Original Message- From: Michael Dingler [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 30, 2002 9:30 AM To: [EMAIL PROTECTED] Subject: Accessing form beans Hi there, yet another question... Is there an easy way to just display some form bean properties? Let's say I've got a form defined as html:form action=/foo html:text property=bar / /html:form Now I just want to display an additional value from the form bean as configured in the struts-config.xml file. As there's no html:write I have to use bean:write which on the other hand requires a name. To get things working I have to change the first line to html:form type=com.yoyodyne.FooAction type=FooForm action=/foo Is there a more elegant and less redundant way? ...Michael... -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]