wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:setProperty body-content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp:setProperty body-content" Watch "jsp:setProperty body-content" New topic
Author

jsp:setProperty body-content

Yoshita Jain
Greenhorn

Joined: Sep 15, 2007
Posts: 23
What is the <body-content> of the <jsp:setProperty> tag? Don't remember reading anywhere that its empty.

I was also wondering if we could use a embeded tag to assign the the <jsp:setProperty> value....

Something like this:

<jsp:useBean id="person" type="foo.Person" class="foo.Employee">
<jsp:setProperty name="person" property="name" value="<myTag:test/>"/>
</jsp:useBean>

where <myTag:test/> returns a String value
[ October 21, 2007: Message edited by: Yoshita Jain ]
Lalit mishra
Ranch Hand

Joined: Sep 01, 2005
Posts: 99
For <jsp:setProperty> body content is empty
Yoshita Jain
Greenhorn

Joined: Sep 15, 2007
Posts: 23
Guess the embeded thing doesn't work

'dealerAddrBean' has been previously defined and its 'cityName' set to 'New Delhi'

<jsp:useBean id="dab" class="com.bean.DealerAddrBean">
<jsp:setProperty name="dab" property="dealerName" value='<bean:write name="dealerAddrBean" property="cityName"/>'/>
</jsp:useBean>

and then I did a ${dab.dealerName} it resulted in printing
<bean:write name="dealerAddrBean" property="cityName"/>
rather than 'New Delhi', which I was expecting.

However,the following worked and set the value correctly as

'New DelhiABCDEFG'

<jsp:useBean id="dab" class="com.bean.DealerAddrBean">
<jsp:setProperty name="dab" property="dealerName" >
<bean:write name="dealerAddrBean" property="cityName"/>ABCDEFG
</jsp:setProperty>
</jsp:useBean>
[ October 21, 2007: Message edited by: Yoshita Jain ]
Jan van Mansum
Ranch Hand

Joined: Oct 19, 2007
Posts: 74
<jsp:setProperty> must be empty, so

</jsp:setProperty name="beanName" property="propName">val</jsp:setPoperty>

or

</jsp:setProperty name="beanName" property="propName">
</jsp:setPoperty>

is wrong


Be careful not to confuse with <c:set> from the JSTL, which can have a body, e.g,

<c:set var="myVar">myValue</c:set>

is correct.
[ October 22, 2007: Message edited by: Jan van Mansum ]

SCJP 1.4, SCWCD 1.4
Tarun Yadav
Ranch Hand

Joined: Sep 20, 2007
Posts: 134
Also, keep in mind that you can't 'nest' custom tags in the sense that while it's legal to have a tag as the body for another tag, you can't have a tag within another tag.

For example,


is fine but

is not ok.
Yoshita Jain
Greenhorn

Joined: Sep 15, 2007
Posts: 23
Thanks all of you...

But I'm still puzzled coz as I said.. for me..this worked

<jsp:useBean id="dab" class="com.bean.DealerAddrBean">
<jsp:setProperty name="dab" property="dealerName" >
<bean:write name="dealerAddrBean" property="cityName"/>ABCDEFG
</jsp:setProperty>
</jsp:useBean>

and for ${dab.dealerName} it gave me the output 'New DelhiABCDEFG'

And yeah Tarun, 'nested' is incorrect for what I was referring to.. mebbe 'embeded makes more sense..and embeded tags are disallowed.

Thanks,

Yoshita
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:setProperty body-content