You can import a Nucleus component with dsp:importbean, which is modeled after Java class imports:

<dsp:importbean bean="Nucleus-path" [var="attr-name" [scope="scope-spec"] ]

After a component is imported, references to it can omit its path and use its name only.

For example, the following tag imports the component /samples/Student_01 and creates the EL variable student:

<dsp:importbean bean="/samples/Student_01" var="student"/>

This tag accomplishes two tasks:

  • Imports the Student_01 component into the pageContext so non-EL references to Student_01 can exclude its full Nucleus path and just use the shorthand name (Student_01). For example:

    My favorite subject is<dsp:select bean="Student_01.subject">
    <dsp:option value="math">Math</dsp:option>
      <dsp:option value="music">Music</dsp:option>
      <dsp:option value="physicalEducation">Phys Ed</dsp:option>
      <dsp:option value="history">History</dsp:option>

  • Makes the Student_01 component available to EL through the variable student. For example:

    My name is <c:out value="${}"/>

By default, the student variable is set to page scope, which makes it accessible to any EL-enabled resources on the same page. You can define a larger scope for the student variable by setting the scope attribute to request, session, or application.

Note: dsp:importbean can import any JavaBean or Dynamic Bean component into a page; however, this tag can only set standard JavaBeans to an EL variable and make them accessible to EL. To make Dynamic Beans visible to EL expressions, use dsp:tomap.

Copyright © 1997, 2014 Oracle and/or its affiliates. All rights reserved. Legal Notices