• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt in jsp:setProperty tag

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using jsp:setproperty tag to set the value of my web page fields. when i use
<jsp:useBean id="name" scope="session" class="packagename.classname" />
<jsp:setProperty name="name" property="propname" value="value" />

i am able to get the property set in the value attribute in required jsppage

But if I use
<jsp:useBean id="name" scope="session" class="packagename.classname" />
<jsp:setProperty name="name" property="*" />

the getProperty is returning null value.
where am I going wrong?.
Please help me.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you use the wild card char '*' in the property attribute, the JSP engine will use introspection to find all the properties in your bean, then search the request parameters to see if any of them have matching names. When a match is found the value of that parameter is set in the bean's property.

Are you posting any form or querystring parameters to your JSP?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, this technique is, for the most part, out dated.
Unless you're learning this to support a legacy JSP app, your time might be better spent learning the features of JSP 2.0 (EL and JSTL) and how they can be used to help you to build a proper MVC structured application.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic