You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Skip Hollowell <sk...@skipdaddy.com> on 2007/04/19 18:48:22 UTC

[S2]Accessing a Bean within a Bean in my jsp

I am not sure if this is possible, but can I access a bean within a 
bean, and grab fields from it within my jsp? 

The AccountBean named account has a Customer Bean named customer, and I 
want the first name of that Customer.
<s:property value="account.customer.firstName"/> returns null every time.

I know that the account is set (see it in the debugger), that it has a 
valid Customer object and I can access a more simple field
<s:property value="account.acctNumber"/> from the page no problem.


Any ideas?


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


s2 app reload

Posted by "Hartrich, James CTR USTRANSCOM J6" <Ja...@ustranscom.mil>.
I want to add a new namespace to the struts.xml on the fly. Is there a
way to detect this change and reload the app context? I'm trying to
avoid reloading the app in the tomcat manager.
James

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


Struts 1.3: Reset form values to previous state

Posted by "Chaudhary, Harsh" <HC...@amfam.com>.
Hi,

I am using Struts 1.3. We have several strust forms which are
pre-populated from a database.

My questions is, if I want to provide the user with a way to reset the
form to the initial values which were populated from the database. Is
there any API or method calls for that. 

Automagic...FTW.

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


Re: [S2]Accessing a Bean within a Bean in my jsp

Posted by Mark Menard <ma...@mjm.net>.
On 4/19/07 12:48 PM, "Skip Hollowell" <sk...@skipdaddy.com> wrote:

> I am not sure if this is possible, but can I access a bean within a
> bean, and grab fields from it within my jsp?

Yes, you can, and I do it all the time. Sometimes with multiple levels of
nesting (ie: order -> order line item -> order shipment join -> shipment
line item -> shipment header -> transport orders)
 
> The AccountBean named account has a Customer Bean named customer, and I
> want the first name of that Customer.
> <s:property value="account.customer.firstName"/> returns null every time.

I assume your action or model has a getAccount() method on it, and account
has a getCustomer() method, etc.?

> Any ideas?

Not really. Just make sure you've got your getX() methods all the way down
the chain. Also put lots of <s:property value="..." /> tags down the chain
and see where it breaks.

Mark

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