Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Struts and the fly likes bean:define with bean:write Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:define with bean:write" Watch "bean:define with bean:write" New topic

bean:define with bean:write

chiragpatel Patel

Joined: Sep 12, 2007
Posts: 7
I want to do something like below, if i run following code it prints as it is, dont print value of userId. Then how to do.

<bean efine id="abc" value='<bean:write name="userForm" property="userId"/>' />
<bean:write name="abc"/>
Ranjit Gopinathan
Ranch Hand

Joined: Jul 03, 2007
Posts: 46
Try this

<bean: define id="abc" name="userForm" property="userId" />
<bean:write name="abc"/>

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
<bean:write name="userForm" property="userId" />

or maybe:
<cut value="${userForm.userId}" />

BTW, the original problem is that you cannot nest tags inside the attributes of other tags. You probably could have written your orignial code like this as well:
<bean:define id="abc"><bean:write name="userForm" property="userId"/></bean:define>
<bean:write name="abc"/>

- Brent
[ September 18, 2007: Message edited by: Brent Sterling ]
chiragpatel Patel

Joined: Sep 12, 2007
Posts: 7
Thanks to both of you, now let me try the code.
I agree. Here's the link:
subject: bean:define with bean:write