Description
In core 1.2 to 1.2.2, any use of jsp:include causes the ids of components in the included file to have a random string appended to them.
This results in some ugly ids. However more significantly, the id of a component is not predictable even when an id attribute is explicitly assigned.
In addition, this breaks the tomahawk forceId feature, because although the namespace prefix is omitted the rest of the id changes making "forceId" useless.
The cause is class UIComponentClassicTagBase, where checkIfItIsInAnIterator() returns true if the current component is in an included or forwarded page. Later, the createUniqueId method adds a suffix to the user-specified if member isInAnIterator is true.
Unfortunately, documentation on why things are implemented as they are is lacking.
Checking for iteration is needed to support
<c:forEach ..>
<h:inputText id="name"/>
</c:forEach>
Checking for includedOrForwarded might be to allow:
<jsp:include page="subPage.jsp" />
<jsp:include page="subPage.jsp" />
However this is a very rare usage; support for this should not hurt everyone.
And Sun Mojarra does not mess with the ids like this...testing shows
that the ids of components are the same regardless of whether they are
inline or in an included file.
Maybe the "isInIterator" check could look to see whether the same file is being included twice, eg by keeping a list of the files included so far, and returning true only if the same string is encountered twice? That would allow multiple inclusions, but not mess with ids for a single inclusion.
Attachments
Attachments
Issue Links
- is duplicated by
-
MYFACES-2186 After using <jsp:include>, component ids are appended with j_id_1
- Closed
-
MYFACES-1097 Duplicated id generation for jsf_tree, jsf_state and jsf_viewid
- Closed
-
MYFACES-1905 Component ID changes after submit if encoding='multipart/form-data' and part of page has been included.
- Closed
-
MYFACES-2127 duplicated component id with any jsp:include (or other inclusion) of jsf pages
- Closed
-
MYFACES-2175 autogenerated client id is generating duplicat ids. Client-id : <<autogenerated id>> is duplicated in the faces tree.
- Closed
-
MYFACES-2252 Automatic ID generation in nested subview tags
- Closed