This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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?
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.