Multiple choice technology programming languages

What is the effect of executing the following JSP statement, assuming a class with name Employee exists in classes package. <%@ page import = "classes.Employee" %>

  1. The code does not compile as there is no property attribute of setProperty tag.

  2. The code does not compile as property attribute cannot take * as a value.

  3. The code sets value of all properties of employee bean to "*".

  4. The code sets the values of all properties of employee bean to matrching parameters in request object.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The jsp:setProperty tag with property="*" is a special shorthand that automatically sets all bean properties to matching request parameters. For each property in the bean, it looks for a request parameter with the same name and sets the value using appropriate type conversion. Option A is wrong - setProperty does have a property attribute. Option B is wrong - * is a valid special value. Option C is wrong - * is a wildcard, not a literal string value.