JBoss.org Community Documentation
Seam includes a number of JSF controls that are useful for working with Seam. These are intended to complement the built-in JSF controls, and controls from other third-party libraries. We recommend JBoss RichFaces, and Apache MyFaces Trinidad tag libraries for use with Seam. We do not recommend the use of the Tomahawk tag library.
To use these tags, define the "s
" namespace in your page
as follows (facelets only):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib">
The ui example demonstrates the use of a number of these tags.
Table 28.1. Seam JSF Control Reference
|
Description A button that supports invocation of an action with control over conversation propagation. Does not submit the form. Attributes
Usage <s:button id="cancel" value="Cancel"
You can specify both |
|
Description
Cache the rendered page fragment using JBoss Cache. Note that
Attributes
Usage <s:cache key="entry-#{blogEntry.id}" region="pageFragments"> |
|
Description
Add the conversation id to JSF link or button (e.g. Attributes None. |
|
Description Customize the conversation propagation for a command link or button (or similar JSF control). Facelets only. Attributes
Usage <h:commandButton value="Apply" action="#{personHome.update}"> |
|
Description Perform date or time conversions in the Seam timezone. Attributes None. Usage <h:outputText value="#{item.orderDate}"> |
|
Description Assigns an entity converter to the current component. This is primarily useful for radio button and dropdown controls.
The converter works with any managed entity which has an Attributes None. Configuration
You must use
Seam managed transactions
(see Section 8.2, “Seam managed transactions”) with
If your
Managed Persistence Context
isn't called
<component name="org.jboss.seam.ui.EntityConverter"> If you are using a Managed Hibernate Session then you need to set it in components.xml: <component name="org.jboss.seam.ui.EntityConverter"> If you want to use more than one entity manager with the entity converter, you can create a copy of the entity converter for each entity manager in components.xml: <component name="myEntityConverter" class="org.jboss.seam.ui.converter.EntityConverter"> <h:selectOneMenu value="#{person.continent}"> Usage <h:selectOneMenu value="#{person.continent}" required="true"> |
|
Description Assigns an enum converter to the current component. This is primarily useful for radio button and dropdown controls. Attributes None. Usage <h:selectOneMenu value="#{person.honorific}"> |
|
Description
"Decorate" a JSF input field when validation fails or when
Attributes
Usage <s:decorate template="edit.xhtml"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" |
|
Description Specify the default action to run when the form is submitted using the enter key.
Currently you can only nest it inside buttons (e.g.
You must specify an id on the action source. You can only have one default action per form. Attributes None. Usage <h:commandButton id="foo" value="Foo" action="#{manager.foo}"> |
|
Description
Render a HTML Attributes None. Usage <s:div rendered="#{selectedMember == null}"> |
|
Description
Creates a Attributes
Usage <h:selectOneRadio id="radioList" |
|
Description
Renders a file upload control. This control must be used within a form with
an encoding type of <h:form enctype="multipart/form-data">
For multipart requests, the Seam Multipart servlet filter must also be configured
in <filter> Configuration The following configuration options for multipart requests may be configured in components.xml:
Here's an example: <component class="org.jboss.seam.web.MultipartFilter"> Attributes
Usage <s:fileUpload id="picture" data="#{register.picture}" |
|
Description Outputs Seam Text , a rich text markup useful for blogs, wikis and other applications that might use rich text. See the Seam Text chapter for full usage. Attributes
Usage <s:formattedText value="#{blog.text}"/> Example ![]() |
|
Description A non-rendering component useful for enabling/disabling rendering of it's children. Attributes None. Usage <s:fragment rendered="#{auction.highBidder ne null}"> |
|
Description
An extended
All attributes for Attributes
Transformations To apply a transform to the image, you would nest a tag specifying the transform to apply. Seam currently supports these transforms:
It's easy to create your own transform - create a Usage <s:graphicImage rendered="#{auction.image ne null}" |
|
Description
"Decorate" a JSF input field with the label. The label is placed inside
the HTML Attributes
Usage <s:label styleClass="label"> |
|
Description A link that supports invocation of an action with control over conversation propagation. Does not submit the form. Attributes
Usage <s:link id="register" view="/register.xhtml"
You can specify both |
|
Description "Decorate" a JSF input field with the validation error message. Attributes None. Usage <f:facet name="afterInvalidField"> |
|
Description Generates the Javascript stubs required to use Seam Remoting. Attributes
Usage <s:remote include="customerAction,accountAction,com.acme.MyBean"/> |
|
Description
Deprecated. Use
Displays a dynamic date picker component that selects a date for the specified input field.
The body of the Attributes
Usage <div class="row"> Example ![]() CSS Styling The following list describes the CSS class names that are used to control the style of the selectDate control.
![]() |
|
Description
Creates a Attributes
Usage <h:selectOneMenu value="#{person.age}" |
|
Description
Render a HTML Attributes None. Usage <s:span styleClass="required" rendered="#{required}">*</s:span> |
|
Description
Add the task id to an output link (or similar JSF control), when the
task is available via Attributes None. |
|
Description A non-visual control, validates a JSF input field against the bound property using Hibernate Validator. Attributes None. Usage <h:inputText id="userName" required="true" |
|
Description A non-visual control, validates all child JSF input fields against their bound properties using Hibernate Validator. Attributes None. Usage <s:validateAll> |
|
Description Checks that the submitted value is valid Seam Text Attributes None. |
Seam also provides annotations to allow you to use Seam components as JSF converters and validators:
@Converter
@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
}
}
<h:inputText value="#{shop.item}" converter="itemConverter" />
Registers the Seam component as a JSF converter. Shown here is a converter which is able to access the JPA EntityManager inside a JTA transaction, when converting the value back to it's object representation.
@Validator
@Name("itemValidator")
@BypassInterceptors
@Validator
public class ItemValidator implements Validator {
public void validate(FacesContext context, UIComponent cmp, Object value)
throws ValidatorException {
ItemController ItemController = (ItemController) Component.getInstance("itemController");
return itemController.validate(value);
}
}
<h:inputText value="#{shop.item}" validator="itemValidator" />
Registers the Seam component as a JSF validator. Shown here is a validator which injects another Seam component; the injected component is used to validate the value.