Author: pete.muir(a)jboss.org
Date: 2008-08-05 12:50:30 -0400 (Tue, 05 Aug 2008)
New Revision: 8583
Modified:
branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml
Log:
Backport JBSEAM-3118
Modified: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml
===================================================================
--- branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml 2008-08-05 16:47:36 UTC
(rev 8582)
+++ branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Controls.xml 2008-08-05 16:50:30 UTC
(rev 8583)
@@ -1132,23 +1132,23 @@
</term>
<listitem>
<programlisting
role="JAVA"><![CDATA[@Name("itemConverter")
- @BypassInterceptors
- @Converter
- public class ItemConverter implements Converter {
-
- @Transactional
- public Object getAsObject(FacesContext context, UIComponent cmp, String value) {
- EntityManager entityManager = (EntityManager)
Component.getInstance("entityManager");
- entityManager.joinTransaction();
- // Do the conversion
- }
-
- public String getAsString(FacesContext context, UIComponent cmp, Object value) {
- // Do the conversion
- }
-
- }]]></programlisting>
+@BypassInterceptors
+@Converter
+public class ItemConverter implements Converter {
+ @Transactional
+ public Object getAsObject(FacesContext context, UIComponent cmp, String value) {
+ EntityManager entityManager = (EntityManager)
Component.getInstance("entityManager");
+ entityManager.joinTransaction();
+ // Do the conversion
+ }
+
+ public String getAsString(FacesContext context, UIComponent cmp, Object value) {
+ // Do the conversion
+ }
+
+}]]></programlisting>
+
<programlisting role="XHTML"><![CDATA[<h:inputText
value="#{shop.item}" converter="itemConverter"
/>]]></programlisting>
<para>
@@ -1165,17 +1165,19 @@
</term>
<listitem>
<programlisting
role="JAVA"><![CDATA[@Name("itemValidator")
- @BypassInterceptors
- @Validator
- public class ItemValidator implements Validator {
+@BypassInterceptors
+(a)org.jboss.seam.annotations.faces.Validator
+public class ItemValidator implements javax.faces.validator.Validator {
- public void validate(FacesContext context, UIComponent cmp, Object value)
- throws ValidatorException {
- ItemController ItemController = (ItemController)
Component.getInstance("itemController");
- return itemController.validate(value);
- }
-
- }]]></programlisting>
+ public void validate(FacesContext context, UIComponent cmp, Object value)
+ throws ValidatorException {
+ ItemController ItemController = (ItemController)
Component.getInstance("itemController");
+ boolean valid = itemController.validate(value);
+ if (!valid) {
+ throw ValidatorException("Invalid value " + value);
+ }
+ }
+}]]></programlisting>
<programlisting role="XHTML"><![CDATA[<h:inputText
value="#{shop.item}" validator="itemValidator"
/>]]></programlisting>
<para>