Martin,
I have a similar problem too.
May I ask two general questions?
1.When should I use the formBean attribute on the <bean:struts> tag?
2. What is the relationship among ActionForm, actionformbean and actionformbeans.
I tried to find the answer myself, but couldn't. Thanks a lot, and sorry for the dummy questions.
Joyce
-----Original Message-----
From: Martin Cooper [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 26, 2001 6:49 PM
To: [EMAIL PROTECTED]
Subject: e: Access to form data.
When you use the formBean attribute on the <bean:struts> tag, you are
defining a bean which corresponds to the ActionFormBean instance for your
form bean definition (i.e. the <form-bean> entry) in struts-config.xml. You
are not defining a bean corresponding to your ActionForm bean itself.
If your form bean exists in some scope already (i.e. either Struts put it
there when processing a request or you put it there when processing an
action), then all you need is:
<bean:write name="yourFormBeanName" property="keyword"/>
where "yourFormBeanName" is the name of the attribute used to store the
bean. If Struts created the form bean for you, the attribute name is the
name you specified in the <form-bean> entry in your struts-config.xml file.
Hope this helps.
--
Martin Cooper
----- Original Message -----
From: "Christophe Saudubois" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 23, 2001 6:56 AM
Subject: Access to form data.
> Hello,
>
> I am in a jsp preceded by an action and I want to display the form of
> the action but not within form html tags.
>
> For instance :
> My Form :
>
> public class SearchForm extends ActionForm {
> public SearchForm() {}
> private String mKeyword = "";
> public String getKeyword() { return mKeyword;}
> public void setKeyword(String pKeyword) { mKeyword = pKeyword;}
> }
>
> My Jsp :
>
> <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
> <bean:struts id="form" formBean="searchForm"/>
> You searched : <bean:write name="form" property="keyword" />
>
> I've got this exception :
> javax.servlet.jsp.JspException: No getter method for property keyword of
> bean form
> at javax.servlet.jsp.JspException.<init>(JspException.java:73)
> at
> org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:132)
> at
>
root.store._0002froot_0002fstore_0002findexsearch_0002ejspindexsearch_jsp_0.
_jspService(_0002froot_0002fstore_0002findexsearch_0002ejspindexsearch_jsp_0
.java:371)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> ...
>
> The object form is really a SearchForm (getType method of the form that
> is working).
> thanks,
> Christophe Sauldubois.