You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Weining Qi <we...@info.nl> on 2001/04/18 17:19:49 UTC

what's the attribute name for a FormBean?

Hi, all,

If I want to use <bean:define> to retrieve one property of current form bean as
a JSP bean(an attribute accessible to the remainder of the current page), how
can specify the attribute name of the form bean? I have tried the name from
struts-config.xml where I define the form bean, it is still saying: "No bean
found for attribute key xxx"(the name appearing in the xml file). How do all the
html form tags know the form bean where they find "their properties"?

Finally I have to use <jsp.useBean> to introduce the form bean before the
defining.

Thanks in advance!

Weining


Re: what's the attribute name for a FormBean?

Posted by Ted Husted <hu...@apache.org>.
The form bean is created by the html:form tag, or by an Action class,
under the attribute name given in the config file. Are you looking for
it before it is created?

But, given that the flow has passed the html:form tag, or returned from
the action, and given something like 

<form-bean name="logonForm" type="org.wxxi.gavel.action.LogonForm"/>

then

<bean:define id="username" name="logonForm" property="username"/>

should expose the property logonForm.getUsername() as a scripting
variable for the page.

Weining Qi wrote:
> 
> Hi, all,
> 
> If I want to use <bean:define> to retrieve one property of current form bean as
> a JSP bean(an attribute accessible to the remainder of the current page), how
> can specify the attribute name of the form bean? I have tried the name from
> struts-config.xml where I define the form bean, it is still saying: "No bean
> found for attribute key xxx"(the name appearing in the xml file). How do all the
> html form tags know the form bean where they find "their properties"?
> 
> Finally I have to use <jsp.useBean> to introduce the form bean before the
> defining.
> 
> Thanks in advance!
> 
> Weining

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/