<p>In JSP I can reference a bean's property by using the tag
${object.property}</p>

<p>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:</p>

<pre><code>public class Person {
    public String getName()
}
public class Employee extends Person {
    public float getSalary()
}
</code></pre>

<p>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:</p>

<pre><code>&lt;tr&gt;
    &lt;td&gt;&lt;c:out value="${person.name}"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;c:out value="${person.salary}"&gt;&lt;/td&gt;
&lt;/tr&gt;
</code></pre>

<p>Unfortunately if person is not an employee then it can't find salary and an error occurs. How would I solve this in JSP?</p>

<p>Edit: Is there an <strong>instanceof</strong> check in JSP tag language?</p>

You could always have a type field.
```
```
public class Person {
    public String getType() { return "Person"; }
    public String getName()
}
public class Employee extends Person {
    public String getType() { return "Employee"; }
    public float getSalary()
}
```
```
Your JSP would look like
```
```
<tr>
    <td><c:out value="${person.name}"></td>
    <td><c:if test="'Employee' eq person.type"><c:out value="${person.salary}"></c:if></td>
</tr>
```
```
Of course the Class class already has this...
```
```
<tr>
    <td><c:out value="${person.name}"></td>
    <td><c:if test="'Employee' eq person.class.simpleName"><c:out value="${person.salary}"></c:if></td>
</tr>
```
```
You could also have `isEmployee()' method.