aspose file tools*
The moose likes JSP and the fly likes Doubt in jsp:setProperty tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Doubt in jsp:setProperty tag" Watch "Doubt in jsp:setProperty tag" New topic
Author

Doubt in jsp:setProperty tag

nira sri
Greenhorn

Joined: Feb 12, 2008
Posts: 5
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.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.
 
Consider Paul's rocket mass heater.
 
subject: Doubt in jsp:setProperty tag