title: Mapping a subclass property to form path in Spring MVC
body: <p>Product    </p>
  
  <pre><code>@Entity
  @Table(name = "product")
  @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
  public class Product {
      @Id
      @Column(name = "id")
      @GeneratedValue()
      private Integer id;
  @Column(name = "shortDescription")
      private String shortDescription;
  </code></pre>
  
  <p>Book</p>
  
  <pre><code>@Entity
  @DiscriminatorValue(value = "Book")
  public class Book extends Product {
      @Column(name = "isbn")
      private String isbn;    
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>@RequestMapping(value="/product/add",
              method = RequestMethod.POST)
      public String addProduct(@ModelAttribute("product")
           Product product, BindingResult result
              ){
           if(null == product.getId()){
               productService.addProduct(product);
           }else{
               productService.updateProduct(product);
           }
                  return "redirect:/";
                  }
  </code></pre>
  
  <p>jsp, where I'm trying to display this property</p>
  
  <pre><code>    &lt;head&gt;
      &lt;title&gt;Products - Acme Web Store&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
      function deleteProduct(productId){
          if(confirm('Do you want to delete this product ?')){
              var url = 'delete/'+productId;
              window.location.href = url;
          }
      }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;    
          &lt;h2&gt;Product Store - Acme Web Store&lt;/h2&gt;
          &lt;p style="color: green; font-weight: bold;"&gt;
          To add a new product please click &lt;a href="&lt;c:url var="action" value="/product/add"&gt;&lt;/c:url&gt;"&gt; &lt;img
              src="&lt;c:url value='/images/vcard_add.png' /&gt;"
              title="Add a New Product" /&gt;
          &lt;/a&gt;
      &lt;/p&gt;
      &lt;c:url var="action" value="/product/add"&gt;&lt;/c:url&gt;
      &lt;form:form method="post" action="${action}" commandName="product"
          cssClass="productForm"&gt;
          &lt;table&gt;
              &lt;c:if test="${!empty product.title}"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;form:label path="id" cssClass="productLabel"&gt;
                              &lt;spring:message code="label.productId" /&gt;
                          &lt;/form:label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="id" readonly="true" size="8"
                              disabled="true" /&gt; &lt;form:hidden path="id" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/c:if&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;form:label path="title" cssClass="productLabel"&gt;
                          &lt;spring:message code="label.productTitle" /&gt;
                      &lt;/form:label&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;form:input path="title" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;form:label path="shortDescription" cssClass="productLabel"&gt;
                          &lt;spring:message code="label.shortDescription" /&gt;
                      &lt;/form:label&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;form:input path="shortDescription" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;form:label path="isbn" cssClass="productLabel"&gt;
                              &lt;spring:message code="label.isbn" /&gt;
                          &lt;/form:label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="isbn" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;form:label path="format" cssClass="productLabel"&gt;
                              &lt;spring:message code="label.format" /&gt;
                          &lt;/form:label&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;form:input path="format" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;&lt;c:if test="${!empty product.productName}"&gt;
                          &lt;input type="submit"
                              value="&lt;spring:message code="label.editproduct"/&gt;" /&gt;
                      &lt;/c:if&gt; &lt;c:if test="${empty product.productName}"&gt;
                          &lt;input type="submit"
                              value="&lt;spring:message code="label.addproduct"/&gt;" /&gt;
                      &lt;/c:if&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;form:label path="type" cssClass="productLabel"&gt;
                          &lt;spring:message code="label.type" /&gt;
                      &lt;/form:label&gt;&lt;/td&gt;
                  &lt;td&gt;
                  &lt;form:select path="type"&gt;
                          &lt;form:option value="0" label="Select One" /&gt;
                          &lt;form:option value="1" label="Book" /&gt;
                          &lt;form:option value="2" label="Game" /&gt;
                  &lt;/form:select&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form:form&gt;
  
  
      &lt;h3&gt;List of products in Library&lt;/h3&gt;
      &lt;c:if test="${!empty productList}"&gt;
          &lt;table class="productTable"&gt;
              &lt;tr&gt;
                  &lt;th width="160"&gt;Product Title&lt;/th&gt;
                  &lt;th width="190"&gt;Product Short Description&lt;/th&gt;
                  &lt;th width="80"&gt;Product ISBN&lt;/th&gt;
                  &lt;th width="80"&gt;Product Format&lt;/th&gt;
                  &lt;th width="60"&gt;Action&lt;/th&gt;
              &lt;/tr&gt;
              &lt;c:forEach items="${productList}" var="product"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;a href="&lt;c:url value='/edit/${product.id}' /&gt;"&gt;${product.productName}&lt;/a&gt;
                      &lt;/td&gt;
                      &lt;td&gt;${product.title}&lt;/td&gt;
                      &lt;td&gt;${product.shortDescription}&lt;/td&gt;
                      &lt;td&gt;${product.isbn}&lt;/td&gt;
                      &lt;td&gt;${product.format}&lt;/td&gt;
                      &lt;td&gt;&lt;img src="&lt;c:url value='/images/vcard_delete.png' /&gt;"
                          title="Delete product"
                          onclick="javascript:deleteproduct(${product.id})" /&gt; &lt;a
                          href="&lt;c:url value='/edit/${product.id}' /&gt;"&gt; &lt;img
                              src="&lt;c:url value='/images/vcard_add.png' /&gt;"
                              title="Edit product" /&gt;
                      &lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/c:forEach&gt;
          &lt;/table&gt;
      &lt;/c:if&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I get this error: 
  <code>invalid property 'isbn' of bean class [com.mycompany.app.model.Product]: Bean property 'isbn' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?</code></p>
  
  <p>I know I'm not doing this right, there must be a way to cast Product to Book so I can get the ISBN property, how do we do this?</p>