struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
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 
scriplets.

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

http://husted.com/struts/tips/005.htm

-- Ted Husted, Husted dot Com, Fairport NY US
-- Author, Java Web Development with Struts
-- Order it today:
-- http://husted.com/struts/book.html

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:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message