[ 
http://issues.apache.org/jira/browse/MYFACES-118?page=comments#action_12316550 
] 

Mike Youngstrom commented on MYFACES-118:
-----------------------------------------

Well, I worked all day on trying to duplicate the exception in a simpler test 
case and ended up by dumb luck fixing the problem instead.  Here is the patch:

Index: 
current/tomahawk/src/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
===================================================================
--- 
current/tomahawk/src/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
      (revision 224413)
+++ 
current/tomahawk/src/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
      (working copy)
@@ -133,7 +133,7 @@
             //This is where to components with the same id are in the tree,
             //so make sure that during the rendering the id is unique.
 
-            inputCalendar.setId(facesContext.getViewRoot().createUniqueId());
+            inputCalendar.setId(inputCalendar.getId()+"tempId");
 
             inputCalendar.getChildren().add(inputText);
 

I was suspicious of the createUniqueId() method of making a temporary component 
id so I changed it so it does not use that method to create a temporary id 
anymore.  It has fixed the problem in my case which leads me to believe that 
perhaps the JSF-RI must be using createUniqueId to help detect duplicate ids in 
some way or maybe to help restore the tree.  Either way it works now for me and 
I think that perhaps this solution may be better than the createUniqueId 
solution anyway.

The other issue brought up in here is the lack of duplicate id detections in 
MyFaces.  Perhaps that should be addressed in another issue?

Mike


> inputCalendar RenderAsPopup fails: Duplicate ID
> -----------------------------------------------
>
>          Key: MYFACES-118
>          URL: http://issues.apache.org/jira/browse/MYFACES-118
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.0.8 beta
>  Environment: Windows 2003, OC4J (10.1.3.0.0) - Developer Preview 3 or Tomcat 
> 5.5.7, JSF 1.1, JSP 2.0, MyFaces 1.0.8 beta
>     Reporter: Norbert Csík
>     Assignee: Bill Dudney
>      Fix For: Nightly Build
>  Attachments: go.jspx
>
> I have JSP Document with an f:view and an x:inputCalendar element. When the 
> inputCalendar's RenderAsPopup attribute is set to true the page display fails 
> with the message (myca is the id of the inputCalendar component):
> 500 Internal Server Error
> javax.servlet.jsp.JspException: Duplicate component ID '_id0:myca' found in 
> view.     at 
> com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:171)  at 
> _go_2e_jspx._jspService(go.jspx:24)  [/go.jspx]
> Rendering with RenderAsPopup set to false is okay.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to