Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Manfred Riem
Reporter: kwutzke
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.

Seam 3 Faces viewAction causes JSF "The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form> " in javax.faces Development mode

Created: 02/May/12 01:32 PM   Updated: 24/May/12 06:41 PM   Resolved: 24/May/12 06:41 PM
Component/s: None
Affects Version/s: 2.1.7
Fix Version/s: 2.1.9, 2.2.0-m03

Time Tracking:
Original Estimate: Not Specified
Remaining Estimate: 0 minutes
Remaining Estimate - 0 minutes
Time Spent: 2 days
Time Spent - 2 days

File Attachments: 1. Text File changebundle.txt (69 kB) 24/May/12 02:46 PM - Manfred Riem
2. Zip Archive (44 kB) 24/May/12 02:46 PM - Manfred Riem


JBoss AS 7.1.1.Final, Mojarra 2.1.7, Seam 3.1.0.Final

Participants: kwutzke and Manfred Riem

 Description  « Hide

I have a test page with a @ViewScoped bean:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=""

    <f:viewParam name="id" value="#{}" required="#{not facesContext.postback}">
      <f:convertNumber integerOnly="#{true}" />
    <s:viewAction action="#{nodeManager.init}" />


This causes a Faces message to be appended to the end of the page saying:

"The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form>"

Issue has been discussed in the Seam 3 forum and on the Seam 3 dev IRC channel:

The issue goes away when setting to Production in web.xml, so it appears to be a JSF issue.

Manfred Riem added a comment - 02/May/12 03:17 PM

Can you also reproduce the problem without Seam in the picture? That would help us diagnosing the problem a lot.

kwutzke added a comment - 02/May/12 03:28 PM

Not that I know of. I've been using JSF 2.1.7 for several weeks now on quite some complex pages and I've never had any troubles with JSF messages until I added the <s:viewAction> tag to replace the <f:event type="preRenderView">.

Manfred Riem added a comment - 02/May/12 04:31 PM

Lowering the priority of this issue since it only shows up when setting Mojarra to ProjectStage.Development.

Manfred Riem added a comment - 11/May/12 07:35 PM

Can you supply us with an example application?

kwutzke added a comment - 11/May/12 08:38 PM

For which server? I currently use JBoss AS 7, but basically all you need here is a bean like (and not even all of that):



import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NodeManager implements Serializable
	private static final Logger log = LoggerFactory.getLogger(NodeManager.class);

	private Integer pqId;

	public void construct()
	{" [1] @PostConstruct on " + getClass().getSimpleName());
	public Integer getPqId()
		return pqId;
	public void setPqId(Integer pqId)
	{" [2] Storing mandatory GET param from URL for " + getClass().getSimpleName() + ": pq=" + pqId);
		this.pqId = pqId;
	public void init()
	{" [3] Calling init() on " + getClass().getSimpleName());		

relevant pom.xml:

        <scope>provided</scope> <!-- Hibernate only -->

The SLF4J dep is only optional, remove it as needed.

Is that sufficient?

kwutzke added a comment - 16/May/12 11:59 AM

Note, the very same test page on another computer with the same environment (JBoss AS 7.1.1.Final, Mojarra 2.1.7, Seam 3.1.0.Final) spits out another message instead:

The button/link/text component needs to have a Form in its ancestry. Please add <h:form>.

Strange stuff.

Manfred Riem added a comment - 21/May/12 04:58 PM

Can you attach a working Maven project containing an example?

Manfred Riem added a comment - 24/May/12 02:46 PM

Check if a component that needs a form is embedded in one, and if it does then add a global message to the page. Note that the facets of UIViewRoot are skipped, only its children are taken into account.