Converting and validating an ISBN

How to get this to work in your own page

Insert the following snippets to get the JSF ISBNConverter to work in your JSP page. Note since this is a converter it uses the converting tag to set itself up. Note more information about the ISBNConverter can be found in the API documentation.

This demo requires you to enter an ISBN, if you do not enter an ISBN it will show you an error. If you enter some values for the ISBN it will call the validator to validate the ISBN. The input field here requires you to enter the ISBN, and if you add it with dashes it will silently ignore those. The converter will make sure it gets converted properly.

    <%@taglib prefix="isbn" uri="http://www.manorrock.com/tld/jsf/isbn"%>

    <h:inputText required="true" requiredMessage="ISBN is required" 
      value="#{isbnBean.isbn}">
        <f:validator validatorId="com.manorrock.jsf.isbn.validator.ISBNValidator"/>
        <f:converter converterId="com.manorrock.jsf.isbn.converter.ISBNConverter"/>
    </h:inputText>

    

Actual demo

Enter an ISBN: