Since UIViewRoot does not implement NamingContainer, the JSR 301/329 specs defines the
PortletNamingContainerUIViewRoot [1] which, as its name indicates, does indeed implement
NamingContainer. This is what causes a nice namespaced ID for all components in the
rendered view. The code for this typically looks something like this:
public class PortletNamingContainerUIViewRoot extends UIViewRoot implements
NamingContainer, Serializable {
private static final long serialVersionUID = 6744332823172081041L;
private String namespace;
@Override
public String getContainerClientId(FacesContext facesContext) {
if (namespace == null) {
ExternalContext externalContext = facesContext.getExternalContext();
namespace = externalContext.encodeNamespace("");
}
return namespace;
}
}
Neil
[1]
http://myfaces.apache.org/portlet-bridge/2.0/api/apidocs/javax/portlet/fa...
On May 11, 2010, at 5:18 PM, Martin Marinschek wrote:
On 5/6/10, Alexander Smirnov <asmirnov(a)exadel.com> wrote:
> Let me point out that Mojarra already takes care for state in AJAX
> requests in the server-side saving. In the case of partial request,
> ServerSideStateHelper ( see line 196 ) reuses view state and doesn't
> change content of the javax.faces.ViewState parameter, so any request
> from page should restore proper state because it has the same id as it
> was rendered in AJAX request.
> Therefore, that bug applicable for client-side state only, but updating
> state parameter for ALL forms on the page could cause problem for portal
> environment there each portlet keeps its own state that should not be
> updated by requests from others...
Interesting problem.
So we are rendering multiple forms, and in one case, the forms belong
to one application, and in another case, they are from different
applications. How can we find out which forms belong to our
application? Portal environments will namespace their content, but
there is no way for us to find out - right? Would we need to keep
track of our forms during rendering?
best regards,
Martin