Provides strict guidelines for JSF and PrimeFaces AJAX updates.
Install
mkdir -p .claude/skills/jsf-ajax && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12460" && unzip -o skill.zip -d .claude/skills/jsf-ajax && rm skill.zipInstalls to .claude/skills/jsf-ajax
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
JSF AJAX update rules for the HMIS project. Use when working on AJAX updates, p:commandButton update attributes, PrimeFaces AJAX callbacks, partial page rendering, or debugging AJAX update failures. Also covers JSF navigation patterns: why f:viewAction must not be used on @SessionScoped beans, and how initialization belongs in navigation methods. Critical rules to prevent silent AJAX failures and refresh/back-button state corruption.Key capabilities
- →Enforce JSF AJAX update rules
- →Prevent silent AJAX failures with plain HTML elements
- →Correctly use JSF components for AJAX updates
- →Debug AJAX update issues
- →Apply correct PrimeFaces DataTable multi-selection syntax
- →Implement correct JSF navigation patterns for `@SessionScoped` beans
How it works
The skill provides critical rules and examples for JSF AJAX updates, PrimeFaces component usage, and navigation patterns. It identifies common pitfalls and offers correct implementations.
Inputs & outputs
When to use jsf-ajax
- →Debug AJAX update failure
- →Implement partial page rendering
- →Configure commandButton updates
About this skill
JSF AJAX Update Guidelines
Critical Rules
- AJAX UPDATE RULE: NEVER use plain HTML elements (div, span) with id attributes for AJAX updates - use JSF components (
h:panelGroup,p:outputPanel) instead - RENDERED ATTRIBUTE RULE: NEVER use
renderedon plain HTML elements - JSF ignores it; useh:panelGroup layout="block"instead - COMPONENT REFERENCES: Use
p:resolveFirstComponentWithIdfor updates:update=":#{p:resolveFirstComponentWithId('componentId',view).clientId}" - NO CSS/jQuery SELECTORS: NEVER use
@(.class),@(#id),@parentinupdateorprocessattributes. Use@this,@form, explicit IDs, or:#{p:resolveFirstComponentWithId(...)}
Wrong vs Correct
<!-- WRONG - Plain HTML, AJAX silently fails -->
<div id="stockSelection">
<!-- content -->
</div>
<p:commandButton update="stockSelection" />
<!-- CORRECT - JSF component, AJAX works -->
<h:panelGroup id="stockSelection">
<div><!-- content --></div>
</h:panelGroup>
<p:commandButton update="stockSelection" />
Updating Growl/Messages
The growl component is in template.xhtml outside forms. Use absolute ID with colon prefix:
<!-- CORRECT -->
<p:commandButton action="#{bean.save}" update="myTable :growl" />
<!-- WRONG - Do NOT use CSS selectors -->
<p:commandButton update="@(.ui-growl)" />
JSF Components for AJAX Updates
h:panelGroup- Lightweight wrapper, no HTML outputp:outputPanel- PrimeFaces panel, renders as<span>or<div>h:div- Renders as HTML<div>h:form- For updating entire form sectionsp:panel- Full-featured panel with header/footer
Debugging
- Check browser console for JavaScript errors
- Verify target element is a JSF component (not plain HTML)
- Use browser dev tools to confirm JSF-generated id
- Test with
h:panelGroupwrapper if updates fail - Check component hierarchy - nested components affect id resolution
For complete reference, read developer_docs/jsf/ajax-update-guidelines.md.
PrimeFaces DataTable Multi-Selection (Current Syntax)
🚨 Do NOT use selectionMode="multiple" on <p:column> — that is the PrimeFaces 7 and earlier pattern. The current PrimeFaces requires selectionMode on the dataTable and selectionBox="true" on the column.
Wrong (old PrimeFaces, no checkboxes render in current version)
<p:dataTable value="#{bean.items}" var="i"
selection="#{bean.selected}" rowKey="#{i.id}">
<p:column selectionMode="multiple" /> <!-- WRONG -->
...
</p:dataTable>
Correct (current PrimeFaces)
<p:dataTable value="#{bean.items}" var="i"
selection="#{bean.selected}" rowKey="#{i.id}"
selectionMode="multiple">
<p:column selectionBox="true" style="width: 3rem; text-align: center;" />
...
</p:dataTable>
Also: bind selection to an array (MyDTO[] selected), not a List. Always include rowKey.
For complete reference (single-selection, controller pattern, selectAllFilteredOnly, troubleshooting), read developer_docs/jsf/primefaces-datatable-selection.md.
Navigation Pattern: Never Use f:viewAction on @SessionScoped Beans
🚨 Most controllers in this project are @SessionScoped. Never use f:viewAction or f:event type="preRenderView" to initialize state on @SessionScoped beans.
f:viewAction fires on every GET — including browser refresh and back-button — silently resetting in-progress state. All initialization belongs in the navigation method that redirects to the page.
Correct pattern
// Navigation method — initialize here
public String navigateToFundTransferBill() {
resetClassVariables();
prepareToAddNewFundTransferBill();
currentBillPayments = new ArrayList<>();
return "/cashier/fund_transfer_bill?faces-redirect=true";
}
<!-- XHTML — no f:metadata needed -->
<ui:define name="subcontent">
<h:form>...</h:form>
</ui:define>
The two legitimate uses of f:viewAction
-
URL parameter ingestion — page is reached via external URL with
f:viewParamquery params (lab result links, mobile API, patient portal). No navigation method exists; the URL is the entry point. Signal:f:metadatacontainsf:viewParamelements. -
@ViewScopedbeans — bean is created fresh on each page load, so there is no prior navigation method. (Rare in this project — most controllers are@SessionScoped.)
If you see f:viewAction without any f:viewParam, it is almost certainly wrong.
For complete reference, read developer_docs/jsf/navigation-patterns.md.
When not to use it
- →When working with `f:viewAction` on `@SessionScoped` beans for initialization
- →When using `selectionMode="multiple"` on `<p:column>` in PrimeFaces
Limitations
- →Rules are specific to HMIS project JSF AJAX updates
- →PrimeFaces DataTable multi-selection syntax is for current PrimeFaces versions
- →Navigation patterns are primarily for `@SessionScoped` beans
How it compares
This skill provides specific, project-tailored guidelines for JSF and PrimeFaces, addressing common issues that lead to silent failures or state corruption, unlike generic JSF documentation.
Compared to similar skills
jsf-ajax side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| jsf-ajax (this skill) | 0 | 2mo | No flags | Intermediate |
| android-java | 0 | 4mo | No flags | Intermediate |
| azure-messaging-webpubsub-java | 1 | 3mo | Review | Intermediate |
| code-checklist | 0 | 4mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
android-java
alinaqi
Android Java development with MVVM, ViewBinding, and Espresso testing
azure-messaging-webpubsub-java
microsoft
Build real-time web applications with Azure Web PubSub SDK for Java. Use when implementing WebSocket-based messaging, live updates, chat applications, or server-to-client push notifications.
code-checklist
comeredon
Critical code requirements checklist derived from actual build failures. Use before committing code or when troubleshooting compilation errors.
java-decompile
quarkusio
Use when you need to view the source code of a Java class from project dependencies, understand a library's API implementation, find method signatures, or explore how a dependency works internally. Accepts fully qualified or simple class names.
paw-webapp-layer
keodubo
Use when creating, changing, auditing, or reviewing PAW Forkd webapp controllers, forms, validators, JSP/JSTL views, i18n bundles, Spring Security routes, CSS/JS, uploads, redirects, MVC tests, REST resources, or SPA static-hosting work across TP1 and TP final.
halo-theme-dev
halo-dev
>