Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

jsp:setProperty body-content

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For <jsp:setProperty> body content is empty
 
Yoshita Jain
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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 ]
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Oh the stink of it! Smell my tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic