However, how do I refer to my placed formBean from a struts tag?
One way to do it would be:

<c:set var="foo" value="${myFormInSession.fname}"/>

now "foo" is a variable within your JSP page with the value "fname" from your form.

How does it know the difference from my formBean and the default formBean created from ApplicationResources? FormBeans are created on demand according to the mapping of the requested resource. This means that if the request mapping was "myPath.do" with scope="request", then a new Form will be instantiated, otherwise the form will be looked in the HttpSession object. If none is there, a new one will be instantiated and placed there as an attribute. I guess I never heard of "applicationResources" creating forms (such file typically contains resource bundles)

 Can I refer to it as:
<html:text property="fname" value="${myFormBeanName.fname}"/>
This should be valid code, however keep in mind that this is only because the "myFormBeanName" bean (Form) is in scope (session). If it wouldn't, this would have thrown an NPE. I believe the correct expression should be:

  <html:text name="myFormBeanName" property="fname" />

From the documentation (http://struts.apache.org/1.x/struts-taglib/tagreference.html#text):

"The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized."

The default value of the <html:text ...> tag is to load the current value of the "fname" from the Form object mapped to the surrounding <html:form>. Using it this way (as you wrote will always force to use the Form object in session.

--

Alberto A. Flores
http://www.linkedin.com/in/aflores


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to