Skip to content

Commit 156cc83

Browse files
committed
Added documentation for the new @URLMappings annotation
1 parent fe5f93c commit 156cc83

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎docs/src/main/docbook/en-US/config/Annotations.xml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@ public class CategoryBean {
113113
114114
/* Getters & Setters */
115115
}
116+
]]></programlisting>
117+
118+
<para>
119+
Sometimes you may want to declare multiple URL mappings on a single class. Unfortunately
120+
Java does not allow to add the same annotation to a class more than once. PrettyFaces
121+
offers a simple container annotation called <code>@URLMapping</code> that can be used
122+
in this case.
123+
</para>
124+
125+
<programlisting><![CDATA[@Named("bean")
126+
@RequestScoped
127+
@URLMappings(mappings={
128+
@URLMapping(id = "categoryBean", pattern = "/store/#{ bean.category }/", viewId = "/faces/shop/store.jsf"),
129+
@URLMapping(id = "categoryBean2", pattern = "/shop/#{ bean.category }/", viewId = "/faces/shop/store.jsf")
130+
})
131+
public class CategoryBean {
132+
133+
private String category;
134+
135+
/* Getters & Setters */
136+
}
116137
]]></programlisting>
117138

118139
</section>
@@ -163,6 +184,11 @@ public class CategoryBean {
163184
to the class containing the page action. Please refer to the chapter
164185
<link linkend="config.annotations.resolving">Bean name resolving</link> for details.
165186
</note>
187+
188+
<note>
189+
If the class the annotated method belongs to declares multiple URL mappings using the
190+
<code>@URLMappings</code> annotation, the action will be used for each of the mappings.
191+
</note>
166192

167193
<para>
168194
The annotation supports all attributes that are available in the
@@ -241,6 +267,12 @@ public class LanguageBean {
241267
<link linkend="config.annotations.resolving">Bean name resolving</link> for details.
242268
</note>
243269

270+
<note>
271+
If the class the annotated field belongs to declares multiple URL mappings using the
272+
<code>@URLMappings</code> annotation, the query parameter will be used for each of
273+
the mappings.
274+
</note>
275+
244276

245277
<!-- ========================================================== -->
246278
<!-- Parameters Validation -->

0 commit comments

Comments
 (0)