In JSP I can reference a bean's property by using the tag ${object.property}
Is there some way to deal with properties that might not exist? I have a JSP page that needs to deal with different types. Example:
public class Person {
public String getName()
}
public class Employee extends Person {
public float getSalary()
}
In JSP I want to display a table of people with columns of name and salary. If the person is not an employee then salary should be blank. The row HTML might look like:
<tr>
<td><c:out value="${person.name}"></td>
<td><c:out value="${person.salary}"></td>
</tr>
Unfortunately if person is not an employee then it can't find salary and an error occurs. How would I solve this in JSP?
Edit: Is there an instanceof check in JSP tag language?