[seam-commits] Seam SVN: r8581 - trunk/doc/Seam_Reference_Guide/en-US.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Aug 5 12:38:17 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-08-05 12:38:17 -0400 (Tue, 05 Aug 2008)
New Revision: 8581
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Controls.xml
Log:
JBSEAM-3118
Modified: trunk/doc/Seam_Reference_Guide/en-US/Controls.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Controls.xml 2008-08-05 16:22:46 UTC (rev 8580)
+++ trunk/doc/Seam_Reference_Guide/en-US/Controls.xml 2008-08-05 16:38:17 UTC (rev 8581)
@@ -1224,23 +1224,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>
+ at BypassInterceptors
+ at 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>
@@ -1257,17 +1257,19 @@
</term>
<listitem>
<programlisting role="JAVA"><![CDATA[@Name("itemValidator")
- @BypassInterceptors
- @Validator
- public class ItemValidator implements Validator {
+ at BypassInterceptors
+ at 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>
More information about the seam-commits
mailing list