Skip to content

Commit f6f039f

Browse files
author
Mihai Soloi
committed
updated the other adoc files to include the composition tag pointing to the template.xhtml file
1 parent 5e2294b commit f6f039f

File tree

5 files changed

+152
-136
lines changed

5 files changed

+152
-136
lines changed

docs/chapters/batch.adoc

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -346,32 +346,34 @@ Replace `<ui:define>` section with `content' name such that it looks like:
346346
+
347347
[source, xml]
348348
----
349-
<ui:define name="content">
350-
<h1>Movie Sales</h1>
351-
<h:form>
352-
<h:dataTable value="#{salesBean.salesData}" var="s" border="1">
353-
<h:column>
354-
<f:facet name="header">
355-
<h:outputText value="Show ID" />
356-
</f:facet>
357-
#{s.id}
358-
</h:column>
359-
<h:column>
360-
<f:facet name="header">
361-
<h:outputText value="Sales" />
362-
</f:facet>
363-
#{s.amount}
364-
</h:column>
365-
</h:dataTable>
366-
<h:commandButton
367-
value="Run Job"
368-
action="sales"
369-
actionListener="#{salesBean.runJob()}"/>
370-
<h:commandButton
371-
value="Refresh"
372-
action="sales" />
373-
</h:form>
374-
</ui:define>
349+
<ui:composition template="../WEB-INF/template.xhtml">
350+
<ui:define name="content">
351+
<h1>Movie Sales</h1>
352+
<h:form>
353+
<h:dataTable value="#{salesBean.salesData}" var="s" border="1">
354+
<h:column>
355+
<f:facet name="header">
356+
<h:outputText value="Show ID" />
357+
</f:facet>
358+
#{s.id}
359+
</h:column>
360+
<h:column>
361+
<f:facet name="header">
362+
<h:outputText value="Sales" />
363+
</f:facet>
364+
#{s.amount}
365+
</h:column>
366+
</h:dataTable>
367+
<h:commandButton
368+
value="Run Job"
369+
action="sales"
370+
actionListener="#{salesBean.runJob()}"/>
371+
<h:commandButton
372+
value="Refresh"
373+
action="sales" />
374+
</h:form>
375+
</ui:define>
376+
</ui:composition>
375377
----
376378
+
377379
This code displays the show identifier and sales from that show in a

docs/chapters/jaxrs.adoc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,18 @@ Replace `<ui:define>` section with `content' name such that it looks like:
118118
+
119119
[source, xml]
120120
----
121-
<ui:define name="content">
122-
<h:form prependId="false">
123-
<h:selectOneRadio value="#{movieBackingBean.movieId}" layout="pageDirection">
124-
<c:forEach items="#{movieClientBean.movies}" var="m">
125-
<f:selectItem itemValue="#{m.id}" itemLabel="#{m.name}"/>
126-
</c:forEach>
127-
</h:selectOneRadio>
128-
<h:commandButton value="Details" action="movie" />
129-
</h:form>
130-
</ui:define>
121+
<ui:composition template="../WEB-INF/template.xhtml">
122+
<ui:define name="content">
123+
<h:form prependId="false">
124+
<h:selectOneRadio value="#{movieBackingBean.movieId}" layout="pageDirection">
125+
<c:forEach items="#{movieClientBean.movies}" var="m">
126+
<f:selectItem itemValue="#{m.id}" itemLabel="#{m.name}"/>
127+
</c:forEach>
128+
</h:selectOneRadio>
129+
<h:commandButton value="Details" action="movie" />
130+
</h:form>
131+
</ui:define>
132+
</ui:composition>
131133
----
132134
+
133135
This code fragment invokes `getMovies` method from `MovieClientBean`,

docs/chapters/jms.adoc

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -222,24 +222,26 @@ Replace the `<ui:define>` section with `content' name such that it looks like:
222222
+
223223
[source, xml]
224224
----
225-
<ui:define name="content">
226-
<h1>Points</h1>
227-
<h:form>
228-
Queue size:
229-
<h:outputText value="#{receivePointsBean.queueSize}"/><p/>
230-
<h:inputText value="#{sendPointsBean.message}"/>
231-
<h:commandButton
232-
value="Send Message"
233-
action="points"
234-
actionListener="#{sendPointsBean.sendMessage()}"/>
235-
</h:form>
236-
<h:form>
237-
<h:commandButton
238-
value="Receive Message"
239-
action="points"
240-
actionListener="#{receivePointsBean.receiveMessage()}"/>
241-
</h:form>
242-
</ui:define>
225+
<ui:composition template="../WEB-INF/template.xhtml">
226+
<ui:define name="content">
227+
<h1>Points</h1>
228+
<h:form>
229+
Queue size:
230+
<h:outputText value="#{receivePointsBean.queueSize}"/><p/>
231+
<h:inputText value="#{sendPointsBean.message}"/>
232+
<h:commandButton
233+
value="Send Message"
234+
action="points"
235+
actionListener="#{sendPointsBean.sendMessage()}"/>
236+
</h:form>
237+
<h:form>
238+
<h:commandButton
239+
value="Receive Message"
240+
action="points"
241+
actionListener="#{receivePointsBean.receiveMessage()}"/>
242+
</h:form>
243+
</ui:define>
244+
</ui:composition>
243245
----
244246
+
245247
Click on the yellow bulb to resolve namespace prefix/URI mapping for `h:`

docs/chapters/jsf.adoc

Lines changed: 67 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,24 @@ Replace `<ui:define>` section with `content' name such that it looks like:
5151
+
5252
[source, xml]
5353
----
54-
<ui:define name="content">
55-
<h2>Pick a movie</h2>
56-
<h:form prependId="false">
57-
<h:selectOneRadio
58-
value="#{booking.movieId}"
59-
layout="pageDirection"
60-
required="true">
61-
<f:selectItems
62-
value="#{movieFacadeREST.all}"
63-
var="m"
64-
itemValue="#{m.id}"
65-
itemLabel="#{m.name}"/>
66-
</h:selectOneRadio>
67-
<h:commandButton id="shows" value="Pick a time" action="showtimes" />
68-
</h:form>
69-
</ui:define>
54+
<ui:composition template="../WEB-INF/template.xhtml">
55+
<ui:define name="content">
56+
<h2>Pick a movie</h2>
57+
<h:form prependId="false">
58+
<h:selectOneRadio
59+
value="#{booking.movieId}"
60+
layout="pageDirection"
61+
required="true">
62+
<f:selectItems
63+
value="#{movieFacadeREST.all}"
64+
var="m"
65+
itemValue="#{m.id}"
66+
itemLabel="#{m.name}"/>
67+
</h:selectOneRadio>
68+
<h:commandButton id="shows" value="Pick a time" action="showtimes" />
69+
</h:form>
70+
</ui:define>
71+
</ui:composition>
7072
----
7173
+
7274
The code builds an HTML form that displays the list of movies as radio
@@ -139,18 +141,20 @@ Replace `<ui:define>` section with `content' name such that it looks like:
139141
+
140142
[source, xml]
141143
----
142-
<ui:define name="content">
143-
<h2>Show Timings for <font color="red">#{booking.movieName}</font></h2>
144-
<h:form>
145-
<h:selectOneRadio value="#{booking.startTime}" layout="pageDirection" required="true">
146-
<c:forEach items="#{timeslotFacadeREST.all}" var="s">
147-
<f:selectItem itemValue="#{s.id},#{s.startTime}" itemLabel="#{s.startTime}"/>
148-
</c:forEach>
149-
</h:selectOneRadio>
150-
<h:commandButton value="Confirm" action="confirm" />
151-
<h:commandButton id="back" value="Back" action="booking" immediate="true"/>
152-
</h:form>
153-
</ui:define>
144+
<ui:composition template="../WEB-INF/template.xhtml">
145+
<ui:define name="content">
146+
<h2>Show Timings for <font color="red">#{booking.movieName}</font></h2>
147+
<h:form>
148+
<h:selectOneRadio value="#{booking.startTime}" layout="pageDirection" required="true">
149+
<c:forEach items="#{timeslotFacadeREST.all}" var="s">
150+
<f:selectItem itemValue="#{s.id},#{s.startTime}" itemLabel="#{s.startTime}"/>
151+
</c:forEach>
152+
</h:selectOneRadio>
153+
<h:commandButton value="Confirm" action="confirm" />
154+
<h:commandButton id="back" value="Back" action="booking" immediate="true"/>
155+
</h:form>
156+
</ui:define>
157+
</ui:composition>
154158
----
155159
+
156160
This code builds an HTML form that displays the chosen movie name and
@@ -246,28 +250,30 @@ Replace `<ui:define>' section with `content' name such that it looks like:
246250
+
247251
[source, xml]
248252
----
249-
<ui:define name="content">
250-
<c:choose>
251-
<c:when test="#{booking.theater == 'none'}">
252-
<h2>No theater found, choose a different time</h2>
253-
<h:form>
254-
Movie name: #{booking.movieName}<p/>
255-
Starts at: #{booking.startTime}<p/>
256-
<h:commandButton id="back" value="Back" action="showtimes"/>
257-
</h:form>
258-
</c:when>
259-
<c:otherwise>
260-
<h2>Confirm ?</h2>
261-
<h:form>
262-
Movie name: #{booking.movieName}<p/>
263-
Starts at: #{booking.startTime}<p/>
264-
Theater: #{booking.theater}<p/>
265-
<h:commandButton id="next" value="Book" action="print"/>
266-
<h:commandButton id="back" value="Back" action="showtimes"/>
267-
</h:form>
268-
</c:otherwise>
269-
</c:choose>
270-
</ui:define>
253+
<ui:composition template="../WEB-INF/template.xhtml">
254+
<ui:define name="content">
255+
<c:choose>
256+
<c:when test="#{booking.theater == 'none'}">
257+
<h2>No theater found, choose a different time</h2>
258+
<h:form>
259+
Movie name: #{booking.movieName}<p/>
260+
Starts at: #{booking.startTime}<p/>
261+
<h:commandButton id="back" value="Back" action="showtimes"/>
262+
</h:form>
263+
</c:when>
264+
<c:otherwise>
265+
<h2>Confirm ?</h2>
266+
<h:form>
267+
Movie name: #{booking.movieName}<p/>
268+
Starts at: #{booking.startTime}<p/>
269+
Theater: #{booking.theater}<p/>
270+
<h:commandButton id="next" value="Book" action="print"/>
271+
<h:commandButton id="back" value="Back" action="showtimes"/>
272+
</h:form>
273+
</c:otherwise>
274+
</c:choose>
275+
</ui:define>
276+
</ui:composition>
271277
----
272278
+
273279
The code displays the selected movie, show timing, and theater if
@@ -292,15 +298,17 @@ Replace `<ui:define>` section with `content' name such that it looks like:
292298
+
293299
[source, xml]
294300
----
295-
<ui:define name="content">
296-
<h2>Reservation Confirmed</h2>
297-
<h:form>
298-
Movie name: #{booking.movieName}<p/>
299-
Starts at: #{booking.startTime}<p/>
300-
Theater: #{booking.theater}<p/>
301-
<h:commandButton id="home" value="home" action="goHome" /><p/>
302-
</h:form>
303-
</ui:define>
301+
<ui:composition template="../WEB-INF/template.xhtml">
302+
<ui:define name="content">
303+
<h2>Reservation Confirmed</h2>
304+
<h:form>
305+
Movie name: #{booking.movieName}<p/>
306+
Starts at: #{booking.startTime}<p/>
307+
Theater: #{booking.theater}<p/>
308+
<h:commandButton id="home" value="home" action="goHome" /><p/>
309+
</h:form>
310+
</ui:define>
311+
</ui:composition>
304312
----
305313
+
306314
This code displays the movie name, show timings, and the selected

docs/chapters/json.adoc

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -199,29 +199,31 @@ Replace `<ui:define>` section with `content' name such that it looks like:
199199
+
200200
[source, xml]
201201
----
202-
<ui:define name="content">
203-
<h1>Add a New Movie</h1>
204-
<h:form>
205-
<table cellpadding="5" cellspacing="5">
206-
<tr>
207-
<th align="left">Movie Id:</th>
208-
<td><h:inputText value="#{movieBackingBean.movieId}"/></td>
209-
</tr>
210-
<tr>
211-
<th align="left">Movie Name:</th>
212-
<td><h:inputText value="#{movieBackingBean.movieName}"/> </td>
213-
</tr>
214-
<tr>
215-
<th align="left">Movie Actors:</th>
216-
<td><h:inputText value="#{movieBackingBean.actors}"/></td>
217-
</tr>
218-
</table>
219-
<h:commandButton
220-
value="Add"
221-
action="movies"
222-
actionListener="#{movieClientBean.addMovie()}"/>
223-
</h:form>
224-
</ui:define>
202+
<ui:composition template="../WEB-INF/template.xhtml">
203+
<ui:define name="content">
204+
<h1>Add a New Movie</h1>
205+
<h:form>
206+
<table cellpadding="5" cellspacing="5">
207+
<tr>
208+
<th align="left">Movie Id:</th>
209+
<td><h:inputText value="#{movieBackingBean.movieId}"/></td>
210+
</tr>
211+
<tr>
212+
<th align="left">Movie Name:</th>
213+
<td><h:inputText value="#{movieBackingBean.movieName}"/> </td>
214+
</tr>
215+
<tr>
216+
<th align="left">Movie Actors:</th>
217+
<td><h:inputText value="#{movieBackingBean.actors}"/></td>
218+
</tr>
219+
</table>
220+
<h:commandButton
221+
value="Add"
222+
action="movies"
223+
actionListener="#{movieClientBean.addMovie()}"/>
224+
</h:form>
225+
</ui:define>
226+
</ui:composition>
225227
----
226228
+
227229
This code creates a form to accept input of `id`, `name`, and `actors` of a

0 commit comments

Comments
 (0)