struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <>
Subject Re: Accessing Struts form beans from JSP's/Custom Tag Libraries
Date Mon, 02 Sep 2002 14:11:19 GMT
A form bean is just an object placed within one of the scopes. The 
attribute name is specified in the Struts configuration. (The formbean 
"name" attribute.) So you can refer to it like any other object. For 
more, see the source code for the Struts custom tags.

The searchAction should create the appropriate selectBean before 
forwarding to select.jsp (or there should be an Action in front of 
select.jsp that woudl create and populate the selectBean for you).

The custom tags are designed to take their queues from the beans. So you 
  should focus on create the appropriate bean and letting the custom 
tags do the rest. Most Struts applicastions can be written without 

A useful technique is to use coarse-grained beans so that the same 
properties are not being defined over and over again.

-- Ted Husted, Husted dot Com, Fairport NY US
-- Author, Java Web Development with Struts
-- Order it today:

Darren McGuinness wrote:

> Hi,
> How do I go about accessing a form bean associated with a JSP from my
> own custom tag?
> Also from within the JSP page -For example,
> I wish to use the <html:radio> tag but with the 'value' set to an
> attribute from a form bean which was associated with the action that
> called the JSP.
> So say i have searchAction /searchBean which forward maps to select.jsp,
> I then have a form posting to selectAction with selectBean....I
> basically want to set an attribute in the selectBean to the same value
> as one in the searchBean....
> <html:radio value=<% code here to get the value of an attribute from
> searchBean %> property="radioSelection"/>
> using struts 1.0.
> Cheers.
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message