title: Using jsp:setProperty to set one bean in other bean
body: <p>I would like to know how to use jsp:setProperty in the following scenario.  Here is a simple example of two java classes.</p>
  
  <pre><code>public class MyExample {
    private MyName myNameExample = new MyName();
  
    public MyExample() {}
  
    public MyName getMyNameExample() {
      return myNameExample;
    }
    public void setMyNameExample(MyName setTo) {
      myNameExample = setTo;
    }
  }
  
  public class MyName {
    private String firstName;
  
    public MyName() {}
  
  
    public String getFirstName() {
      return firstName;
    }
    public String setFirstName(String setTo) {
      firstName = setTo;
    }
  }
  </code></pre>
  
  <p>I was trying to use something like:</p>
  
  <pre><code>&lt;jsp:useBean id="example" class="MyExample" scope="page"/&gt;
  &lt;jsp:setProperty name="example" property="????" value="aFirstName"/&gt;
  </code></pre>
  
  <p>The important part here is that I want to reference the MyName object from within MyExample.  Therefore, creating a bean to directly access MyName will not help me.  So I am not looking for this answer:</p>
  
  <pre><code>&lt;jsp:useBean id="name" class="MyName" scope="page"/&gt;
  &lt;jsp:setProperty name="name" property="firstName" value="aFirstName"/&gt;
  </code></pre>