struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: How to refer the form bean out of the form tag or as static
Date Thu, 29 Mar 2001 17:13:57 GMT


On Thu, 29 Mar 2001, Suriyanarayanan, Senthil Kumar wrote:

> How do I decouple the LogonForm bean name from the jsp file. Is there any
> way to identify the form name on the jsp page which has been tied to the
> form?
> 

The <html:form> tag in recent nightly builds actually does this trick.  It
uses the action path you specify to look up the corresponding mapping and
infers both the attribute name and the scope of the corresponding form
bean.  In the example app, on the "registration.jsp" page:

	<html:form action="/saveRegistration">
		...
	</html:form>

therefore figures out that the associated form bean is "registrationBean",
in "request" scope.  Note, however, that this only affects the HTML tags
for input fields -- tags like <bean:write> are general purpose and can
create output from *any* bean, so it is not a good idea to make inferences
about which bean you are referring to.


> Thanks
> Senthil Kumar.S
> 

Craig


> -----Original Message-----
> From: Martin Cooper [mailto:martin.cooper@tumbleweed.com]
> Sent: Wednesday, March 28, 2001 7:01 PM
> To: struts-dev@jakarta.apache.org
> Subject: Re: How to refer the form bean out of the form tag or as static
> text
> 
> 
> I think what you are looking for is <bean:write>. So you might do this:
> 
> <bean:write name="LogonForm" property="message"/>
> 
> See the documentation for more information:
> 
> http://jakarta.apache.org/struts/api/org/apache/struts/taglib/bean/package-s
> ummary.html#doc.Output
> 
> --
> Martin Cooper
> 
> 
> ----- Original Message -----
> From: "Suriyanarayanan, Senthil Kumar"
> <senthilkumar.suriyanarayanan@capitalone.com>
> To: <struts-dev@jakarta.apache.org>
> Sent: Wednesday, March 28, 2001 3:42 PM
> Subject: How to refer the form bean out of the form tag or as static text
> 
> 
> > Hello,
> > I would like to know how to refer a form bean out of the form tag
> > or inside the form tag which
> > are not tied up to any specific html input field. Say for example like
> > static text.
> >
> > For example the following jsp fragment..
> > <html:form action="logon.do">
> > UserId: <html:text property="userId" size="15" maxlength="15"  />
> > Password: <html:password property="password" size="16"
> > maxlength="16" redisplay="false"/>
> > <html:submit/>
> > </html:form>
> >
> > uses a form bean of name LogonForm (from the stuts-config.xml). The form
> > bean also has other properties
> > like MESSAGE and so on. I would like to know how to refer or display the
> > MESSAGE property of the form bean.
> >
> >
> > Thanks in advance
> > Senthil Kumar.S
> >
> > **************************************************************************
> > The Information transmitted herewith is sensitive information intended
> only
> > for use to the individual or entity to which it is addressed. If the
> reader
> > of this message is not the intended recipient, you are hereby notified
> that
> > any review, retransmission, dissemination, distribution, copying or other
> > use of, or taking of any action in reliance upon, this information is
> > strictly prohibited. If you have received this communication in error,
> > please contact the sender and delete the material from your computer.
> 
>  
> **************************************************************************
> The Information transmitted herewith is sensitive information intended only
> for use to the individual or entity to which it is addressed. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any review, retransmission, dissemination, distribution, copying or other
> use of, or taking of any action in reliance upon, this information is
> strictly prohibited. If you have received this communication in error,
> please contact the sender and delete the material from your computer.
> 



Mime
View raw message