Getting Started With Project jMaki for the GlassFish v3 Application Server

ProcedureSubscribe to a Topic

With this task, you will get thisCities to subscribe to the /cb/setValues topic so that it populates with the cities returned from StateBean.

  1. Expand the plotCity > Web Pages nodes.

  2. Open index.jsp in a editor pane.

  3. Add a subscribe attribute to the thisCity widget and give it the topic /cb/setValues, as shown here:

    <a:widget id="thisCity"
    	name="dojo.combobox"
    	subscribe="/cb"
    	value="${StateBean.cities}" />
  4. Save the file.

  5. (Optional) Run the example by right-clicking the project node and selecting Run.

    Now you can select a state and see the thisCity combobox populate with the names of cities located in that state. With the next task, you'll make it so the application will plot a city on the map when you select the city.