Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

query regarding jsp:setProperty

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Consider a java bean named "Person" having two properties "name" and "dog".
The value type for "name" property is String and the value type for "dog" property is Dog class.

To set the dog property of "person" in request scope can I use something like this.

<jsp:useBean id="person" class="foo.Person" scope="request">
<jsp:setProperty id="person" property="dog" value="<%= new Dog() %>" />
</jsp:useBean>

Or only allowed option for value in <jsp:setProperty> is String and primitive.
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The value can be a String or an expression.

See the syntax reference here http://java.sun.com/products/jsp/tags/11/syntaxref11.fm13.html

Kathir
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic