[jsr-314-open-mirror] [jsr-314-open] javax.faces.ViewState + ppr case

Neil Griffin neil.griffin at portletfaces.org
Tue May 11 18:01:39 EDT 2010


Hi Martin,

Yes, I think that approach is fine, because the chances of a user-specified id, or a JSF-generated id starting with the same value as externalContext.encodeNamespace("") is close to zero IMHO.

Best Regards,

Neil

On May 11, 2010, at 5:53 PM, Martin Marinschek wrote:

> Hi Neil,
> 
> On 5/11/10, Neil Griffin <neil.griffin at portletfaces.org> wrote:
>> 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;
>> 	}
> 
> yes, ok, I knew that. I just don't see how to exploit it, cause the
> hidden input with id javax.faces.ViewId will _not_ be namespaced. We
> could determine the namespace and only update the
> javax.faces.ViewId-elements within forms where the id starts with our
> namespace?
> 
> best regards,
> 
> Martin





More information about the jsr-314-open-mirror mailing list