MyFaces-API issue: getValue of UIInput
Wanted to discuss a small thing with you: UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } everyone d'accord? regards, Martin -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: MyFaces Fusion Documentation
Mario Ivankovits schrieb: Hi! I've started the documentation by creating two xdoc files in myfaces/fusion/core/src/site, now when I run mvn site from within myfaces/fusion it creates a site, but only a handful of pages in core/target/site and they do not use our stylesheet. Now: *) Shall I put the documentation into the module directory, or is it fine if I put them directly into fusion? For me its sufficient to have only one place for the documentation for the core and core15 modules. *) Anyway, what can be wrong with the site generation in fusion/core ? *) At last maven fail with directly into fusion would be fine by me, fusion is not so big that it needs a split already in the docs.
Re: MyFaces-API issue: getValue of UIInput
Hi Martin, I just tried the scenario but couldn't reproduce it. Shouldn't the second step be; 2) conversion and validation phase: -- setValue(); isLocalValueSet = true; setSubmittedValue(null); An empty string instead of null is set by setValue(), so the local value becomes , preventing the old value be displayed again. Cagatay, On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote: Wanted to discuss a small thing with you: UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } everyone d'accord? regards, Martin -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: MyFaces-API issue: getValue of UIInput
that entirely depends on the converter! If the converter sets a 'null' as the local-value (which is the only choice if the date-type is not a string), we are having a problem. regards, Martin On 3/1/07, Cagatay Civici [EMAIL PROTECTED] wrote: Hi Martin, I just tried the scenario but couldn't reproduce it. Shouldn't the second step be; 2) conversion and validation phase: -- setValue(); isLocalValueSet = true; setSubmittedValue(null); An empty string instead of null is set by setValue(), so the local value becomes , preventing the old value be displayed again. Cagatay, On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote: Wanted to discuss a small thing with you: UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } everyone d'accord? regards, Martin -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
[jira] Commented: (MYFACES-1549) MyFaces-API issue: getValue of UIInput
[ https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476879 ] Martin Marinschek commented on MYFACES-1549: I added the value in UIInput to the restoreState/saveState-process - see: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=diffrev=513253r1=513252r2=513253 regards, Martin MyFaces-API issue: getValue of UIInput -- Key: MYFACES-1549 URL: https://issues.apache.org/jira/browse/MYFACES-1549 Project: MyFaces Core Issue Type: Bug Components: JSR-127 Affects Versions: 1.1.5 Reporter: Martin Marinschek Assigned To: Martin Marinschek Fix For: 1.1.6-SNAPSHOT UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MYFACES-1549) MyFaces-API issue: getValue of UIInput
[ https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476878 ] Martin Marinschek commented on MYFACES-1549: I had to change a bit more, cause the value field is private and I couldn't access it from the UIInput. Link to commit log: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=diffrev=513252r1=513251r2=513252 regards, Martin MyFaces-API issue: getValue of UIInput -- Key: MYFACES-1549 URL: https://issues.apache.org/jira/browse/MYFACES-1549 Project: MyFaces Core Issue Type: Bug Components: JSR-127 Affects Versions: 1.1.5 Reporter: Martin Marinschek Assigned To: Martin Marinschek Fix For: 1.1.6-SNAPSHOT UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MYFACES-1549) MyFaces-API issue: getValue of UIInput
[ https://issues.apache.org/jira/browse/MYFACES-1549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Marinschek resolved MYFACES-1549. Resolution: Fixed MyFaces-API issue: getValue of UIInput -- Key: MYFACES-1549 URL: https://issues.apache.org/jira/browse/MYFACES-1549 Project: MyFaces Core Issue Type: Bug Components: JSR-127 Affects Versions: 1.1.5 Reporter: Martin Marinschek Assigned To: Martin Marinschek Fix For: 1.1.6-SNAPSHOT UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (MYFACES-1549) MyFaces-API issue: getValue of UIInput
MyFaces-API issue: getValue of UIInput -- Key: MYFACES-1549 URL: https://issues.apache.org/jira/browse/MYFACES-1549 Project: MyFaces Core Issue Type: Bug Components: JSR-127 Affects Versions: 1.1.5 Reporter: Martin Marinschek Assigned To: Martin Marinschek Fix For: 1.1.6-SNAPSHOT UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (MYFACES-1548) UIComponent State change if getValueBinding() is called.
[ https://issues.apache.org/jira/browse/MYFACES-1548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Haimberger updated MYFACES-1548: --- Status: Patch Available (was: Open) UIComponent State change if getValueBinding() is called. Key: MYFACES-1548 URL: https://issues.apache.org/jira/browse/MYFACES-1548 Project: MyFaces Core Issue Type: Bug Components: JSR-252 Affects Versions: 1.2.0-SNAPSHOT Reporter: Martin Haimberger Fix For: 1.2.0-SNAPSHOT Attachments: UIComponentBase.patch The Component State change if getValueBinding() is called and no _valueExpressionMap is present. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (MYFACES-1548) UIComponent State change if getValueBinding() is called.
[ https://issues.apache.org/jira/browse/MYFACES-1548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Haimberger updated MYFACES-1548: --- Status: Open (was: Patch Available) UIComponent State change if getValueBinding() is called. Key: MYFACES-1548 URL: https://issues.apache.org/jira/browse/MYFACES-1548 Project: MyFaces Core Issue Type: Bug Components: JSR-252 Affects Versions: 1.2.0-SNAPSHOT Reporter: Martin Haimberger Fix For: 1.2.0-SNAPSHOT Attachments: UIComponentBase.patch The Component State change if getValueBinding() is called and no _valueExpressionMap is present. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (TOBAGO-286) target and tip attributes for tc:menuitem and tc:tree nodes
[ https://issues.apache.org/jira/browse/TOBAGO-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476899 ] Guido Dubois commented on TOBAGO-286: - That's it! Thanks... target and tip attributes for tc:menuitem and tc:tree nodes --- Key: TOBAGO-286 URL: https://issues.apache.org/jira/browse/TOBAGO-286 Project: MyFaces Tobago Issue Type: Improvement Affects Versions: 1.0.9 Environment: winxp prof, tomcat 5.5.20, myfaces 1.1.4, tobago 1.0.9 - same in tobago 1.0.10 snap (15.02.2007 5:10) Reporter: Guido Dubois Assigned To: Udo Schnurpfeil Fix For: 1.0.10 The tc:menuitem and tc:tree (tree nodes) should support a target and a tip attribute to open a browser window and show a tooltip -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MYFACES-1531) Incorrect handling of FacesContext
[ https://issues.apache.org/jira/browse/MYFACES-1531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476904 ] David Moss commented on MYFACES-1531: - FWIW - I had exactly this problem, until I realised that I hadn't included listener listener-classorg.apache.myfaces.webapp.StartupServletContextListener/listener-class /listener in my web.xml Incorrect handling of FacesContext -- Key: MYFACES-1531 URL: https://issues.apache.org/jira/browse/MYFACES-1531 Project: MyFaces Core Issue Type: Bug Affects Versions: 1.1.4 Environment: WindowsXP Solaris; Tomcat 5.5.17, Liferay 4.2.0 (Portal Server) Reporter: Olaf Fricke We encountered some NPE when accessing the FacesContext in the doView-Method. I first thought about a bug in the Liferay-Portal-Server (see http://support.liferay.com/browse/LEP-1869). But then I discovered that it is a bug in MyFaces, that is triggred because Liferay pools ActionRequest and RenderRequest objects. MyFaces changes the external context value in the method org.apache.myfaces.portlet.MyFacesGenericPortlet#facesRender to switch from ActionRequest and ActionResponse to RenderRequest and RenderResponse. But that switch happens to late, so that in doView (and doEdit and doHelp as well) the FacesContext uses references to the ActionRequest and ActionResponse instead of RenderRequest and RenderResponse. And unfortunately Liferay has already recycled the RenderRequest object and thus a NPE is raised when trying to use the request. I added the following code to my portlet (indeed, to our own super class) to make the switch earlier and the NullPointerException when accessing attributes via the FacesContext will not be raised any longer. (Please note that I cannot use the FacesContext.getCurrentInstance() method in a portal environment, because each portlet owns its own context). public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException { // The following code was taken from org.apache.myfaces.portlet.MyFacesGenericPortlet#facesRender // // get the portlet session local context ServletFacesContextImpl context = (ServletFacesContextImpl) request.getPortletSession() .getAttribute(CURRENT_FACES_CONTEXT); if (context != null) { // and set a new external context that uses the render request and response context.setExternalContext(makeExternalContext(request, response)); } else { // no context available for the current portlet yet; create a new one and put it into the session context = (ServletFacesContextImpl) facesContext(request, response); request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, context); } super.render(request, response); } Later I discovered another problem concerning the FacesContext: When rendering the very first MyFaces-Portlet, no FacesContext exists for the Portlet. Therefore the method nonFacesRequest is called. Somewhere inside this method a new FacesContext is created, but that new FacesContext is never put into the session. Thus my workaround in the render method was broken again. I fixed that by extending the method nonFacesRequest as follows: protected void nonFacesRequest(RenderRequest request, RenderResponse response) throws PortletException { super.nonFacesRequest(request, response); request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, FacesContext.getCurrentInstance()); } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: MyFaces-API issue: getValue of UIInput
I think using a converter can cause this issue, here's the code from UIInput public void validate(FacesContext context) { if (context == null) throw new NullPointerException(context); Object submittedValue = getSubmittedValue(); if (submittedValue == null) return; Object convertedValue = getConvertedValue(context, submittedValue); if (!isValid()) return; validateValue(context, convertedValue); if (!isValid()) return; Object previousValue = getValue(); setValue(convertedValue); setSubmittedValue(null); if (compareValues(previousValue, convertedValue)) { queueEvent(new ValueChangeEvent(this, previousValue, convertedValue)); } } So when the converter returns null value, setValue(null) occurs and old value will be displayed in the page as you said. You don't have a converter like this right Martin?
Re: MyFaces-API issue: getValue of UIInput
Yeah, exactly. Did you read my mail from before? Plus my new issue-evaluation? regards, Martin On 3/1/07, Cagatay Civici [EMAIL PROTECTED] wrote: I think using a converter can cause this issue, here's the code from UIInput public void validate(FacesContext context) { if (context == null) throw new NullPointerException(context); Object submittedValue = getSubmittedValue(); if (submittedValue == null) return; Object convertedValue = getConvertedValue(context, submittedValue); if (!isValid()) return; validateValue(context, convertedValue); if (!isValid()) return; Object previousValue = getValue(); setValue(convertedValue); setSubmittedValue(null); if (compareValues(previousValue, convertedValue)) { queueEvent(new ValueChangeEvent(this, previousValue, convertedValue)); } } So when the converter returns null value, setValue(null) occurs and old value will be displayed in the page as you said. You don't have a converter like this right Martin? -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
[jira] Commented: (TOBAGO-308) Tree Rendering Only Root Node
[ https://issues.apache.org/jira/browse/TOBAGO-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476958 ] Udo Schnurpfeil commented on TOBAGO-308: Does the tree in the tobago-example-demo working on your system? On my system it works (1.3.07 15:45 CET). You may using the tree not correctly. How do you use it? (The complete tree is referenced by the value attribute of tc:tree) The Tree is deprecated, because the use is not typhical for JSF, but it is working. The new Tree is in the moment in the tobago-sandbox. Tree Rendering Only Root Node - Key: TOBAGO-308 URL: https://issues.apache.org/jira/browse/TOBAGO-308 Project: MyFaces Tobago Issue Type: Bug Components: Core Affects Versions: 1.0.9, 1.0.10 Reporter: Mark P. Mullally Fix For: 1.0.10 Only the root node of a tree renders because the TreeOldNode.getRendersChildren() returns true. Susequently, the TreeOldRenderer.getNodesAsJavascript() -- RenderUtil.encode(facesContext, root) method executes component.encodeChildren(faceContext) instead of the the recusive child loop, which relies on the TreeOldNodeRenderer.encodeChildren() method that is NOT OVERRIDDEN and the base implementation is a no-op. Therefore, I don't see how trees ever rendered correctly? I extended the TreeOldNode to return false from getRendersChildren() so that the TreeOldRenderer.getNodesAsJavascript() -- RenderUtil.encode() method executes the recursive child loop FIXING THE ISSUE. Again, HOW DID THIS EVER WORK? AM I MISSING SOMETHING? Also, The Old code is deprecated but no standard in favor of comments exist. What should I be using? MyFaces or Tomahawk tree? btw...I am using the Feb 28 nightly build snapshot for 1.0.10 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: MyFaces-API issue: getValue of UIInput
What's the spec say about UIInput's getValue()? If it's silent, I'd say your solution makes sense. On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote: Wanted to discuss a small thing with you: UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } everyone d'accord? regards, Martin -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
RE: MyFaces Fusion Naming
Just out of curiosity, why is this part of MyFaces as opposed to Shale. It sounds more like something that belongs there... ~~~ Kito D. Mann - Author, JavaServer Faces in Action http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info * Sign up for the JSF Central newsletter! http://oi.vresp.com/?fid=ac048d0e17 * -Original Message- From: Thomas Spiegl [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 28, 2007 6:28 PM To: MyFaces Development Subject: Re: MyFaces Fusion Naming another one ... Apache MyFaces Edge On 2/28/07, Jeff Bischoff [EMAIL PROTECTED] wrote: Glad you liked it. Yeah I figured it would be pretty common name, but at least not as bad as Spyder! (taken by both SP ETF fund and major winter sports gear company) Anyway it's a cool name, but probably too common Mario Ivankovits wrote: Hi Jeff! Apache Myfaces Spider I like it, though the first hit in google with software spider results in http://www.spider-software.de/ Ciao, Mario -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
MyFaces interview
Hello everyone, I'd like to conduct a new e-mail interview with one or two people from the MyFaces Core team. The last one was in 2004 (http://www.jsfcentral.com/articles/geiler-04-04.html), and at that time, it made sense to interview Manfred, since he is the founder and was very heavily involved at the time. Who would be a good choice this time around? ~~~ Kito D. Mann - Author, JavaServer Faces in Action http://www.jsfcentral.com/ http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info * Sign up for the JSF Central newsletter! http://oi.vresp.com/?fid=ac048d0e17 *
Re: MyFaces Fusion Naming
Hi ! Just out of curiosity, why is this part of MyFaces as opposed to Shale. It sounds more like something that belongs there... We developed it under the MyFaces umbrella during the last months, we started with a tag base way until we reached the spring based solution we have now. So, thats why it's still here. We will see what the future brings. Ciao, Mario
[jira] Created: (MYFACES-1551) UIViewRoot.getPhaseListeners() must not be generated
UIViewRoot.getPhaseListeners() must not be generated Key: MYFACES-1551 URL: https://issues.apache.org/jira/browse/MYFACES-1551 Project: MyFaces Core Issue Type: Bug Components: JSR-252 Affects Versions: 1.2.0-SNAPSHOT Reporter: Mathias Broekelmann The 1.2 RI API does not define the method UIViewRoot.getPhaseListeners(). But this method is generated into the myfaces 1.2 UIViewRoot class. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (MYFACES-1550) generated MyFaces id's produce duplicates which throw exceptions in container, rendering existing apps unusable
generated MyFaces id's produce duplicates which throw exceptions in container, rendering existing apps unusable --- Key: MYFACES-1550 URL: https://issues.apache.org/jira/browse/MYFACES-1550 Project: MyFaces Core Issue Type: Bug Affects Versions: 1.1.5 Environment: MyFaces 1.1.5, WindowsXP, Tomcat5.5.20 Reporter: Lisa Sanchez Priority: Blocker Fix For: 1.1.5 Pages that once worked (1.1.5) stopped working for some reason (within the past week). The issue seems to be with generated id's on components. You will see this where you load a page and then reload the same page through a hyperlink or rendering for the second time. There seems to be some correlation with the f:facet tag. I have a page with a t:dataTable and several columns that use the f:facet tag to provide the column header. The page loads just fine initially but if I reload, I get a blank screen and the following message in my Tomcat log file. If I remove the column header and the facet tag, I do not see the error. About a week ago there were no problems with this page so it is something new that has been introduced and should be fixed. --- Mar 1, 2007 2:29:16 PM com.sun.facelets.FaceletViewHandler handleRenderException SEVERE: Error Rendering View[/web/Summary.xhtml] java.lang.IllegalStateException: Client-id : _id32 is duplicated in the faces tr ee. Component : _id30:_id31:_id32, path: {Component-Path : [Class: javax.faces.c omponent.UIViewRoot,ViewId: /web/Summary.xhtml][Class: org.ap ache.myfaces.custom.document.Document,Id: _id12][Class: javax.faces.component.ht ml.HtmlForm,Id: _id30][Class: org.apache.myfaces.component.html.ext.HtmlDataTabl e,Id: _id31][Class: javax.faces.component.UIColumn,Id: _id32][Class: javax.faces .component.html.HtmlOutputText,Id: _id32]} at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplic ateIds(JspStateManagerImpl.java:329) at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplic ateIds(JspStateManagerImpl.java:341) at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplic ateIds(JspStateManagerImpl.java:338) at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplic ateIds(JspStateManagerImpl.java:338) at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplic ateIds(JspStateManagerImpl.java:341) at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplic ateIds(JspStateManagerImpl.java:341) at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerialized View(JspStateManagerImpl.java:286) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.jav a:601) at com.presence.util.bb.customjsf.PtViewHandler.renderView(PtViewHandler .java:107) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderRes ponseExecutor.java:41) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java: 132) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:173) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.do FilterInternal(OpenSessionInViewFilter.java:173) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR equestFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:173) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(Extensions Filter.java:190) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p rocessConnection(Http11BaseProtocol.java:664)
Re: @PreDestroy, Servlet API,
OK, I think your interpretation of the spec makes sense and there's one particular aspect we should discuss a little further. The container doesn't know which classes are managed beans so it wouldn't know when to intercept the instantiation process to perform injection. What would you all think about MyFaces providing an interface that containers could implement to perform injection on a managed bean when MyFaces brings that bean into service? This would allow MyFaces to maintain control of the timing while allowing the container to scan for annotations and handle injection when prompted to do so. Best wishes, Paul On 2/26/07, Dennis Byrne [EMAIL PROTECTED] wrote: I know the specs can be vague sometimes, but I don't interpret the first paragraph of section 5.4 as meaning the JSF implementation is responsible for @EJB, @Resources, etc. The JSF spec specifically mentions the container to inject references. If Geronimo can intercept the instantiation of these classes in the classloader (something I know nothing about right now), I think we are all good here. Wouldn't MyFaces then be observing the requirements (in plain java) around @PostConstruct after Geronimo had injected the resources? I think the JSF impl is only responsible for @PostConstruct and @Predestroy. This makes sense because scoped (request, session, application) are the only candidates for this, and it would be more awkward to do that from the container. I say all of this in an open manner, so anyone feel free to discuss. You're point about javax.annotation being in the Servlet 2.5 is taken. I totally missed that. Dennis Byrne On 2/26/07, Paul McMahan [EMAIL PROTECTED] wrote: Actually by dependency injection I'm specifically referring to the portion of the JSF spec that discusses injecting resources where certain annotations are found in a managed bean. So, while scanning for the @PreConstruct and @PostDestroy annotations MyFaces would also scan for @EJB, @Resource, @WebServiceRef, etc and then time the invocation of @PreConstruct and @PostDestroy to support the injection. Tomcat provides an example of how this can be done. The following class scans for annotations when a web app starts: http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebAnnotationSet.java And then this class handles the injection and calling the PostConstruct and PreDestroy methods when an servlet, filter, or listener is brought into service: http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/DefaultAnnotationProcessor.java Would it make sense for MyFaces to follow a similar approach for managed beans? Also, I'm curious why you're hoping to avoid importing classes from javax.annotation classes since servlet 2.5 containers are required to support them. Is this so that MyFaces 1.2 can support servlet 2.4 containers? Best wishes, Paul On 2/26/07, Dennis Byrne [EMAIL PROTECTED] wrote: I ended up going with Servlet/Request/Context attribute listeners for @PreDestroy. This did not involve importing javax.annotation.PreDestroy, so people w/out application servers don't have to worry about ClassDefNotFoundErrors. This also keeps us compatible with the reference implementation in terms of timing, although I really wish they'd change the wording in the spec. Dennis Byrne On 2/26/07, Paul McMahan [EMAIL PROTECTED] wrote: Sorry if I'm behind on this discussion but what are the current thoughts on how dependency injection will be implemented for managed beans? The reason I'm curious is because PreDestroy and PostConstruct annotations are used to deal with injected resources, so from a timing perspective it would be important to process all these annotations accordingly. Best wishes, Paul On 2/24/07, Dennis Byrne [EMAIL PROTECTED] wrote: I'm weighing options about invoking @PreDestroy methods (@PostConstruct is done BTW). I haven't made up my mind yet but here's where I'm at on this. As far as *when* this happens, the request is easy, in FacesServelet.service(). Session and app scope are more difficult decisions. A new HttpSessionActivationListener.attributeRemoved and a new ServletContextAttributeListener.attributeRemoved () seem like nice solutions, but this doesn't meet the spec requirements for 5.4.1. The methods have to be invoked *before* the bean is pulled from scope and the servlet API does not provide a ServletContextAttributeListener.attribute_WILL_BE_Removed() or a HttpSessionActivationListener.attribute_WILL_BE_Removed (). Also, I say *new* ServletContextAttributeListener and because StartupServletContextListener (already in code base) implements ServletContextListener, not ServletContextAttributeListener. The other side of the problem is *how* to invoke each @PreDestroy method, much easier. Iterating
Re: MyFaces Fusion Naming
Might be significant that two people have asked this question so far :-) On 3/1/07, Mario Ivankovits [EMAIL PROTECTED] wrote: Hi ! Just out of curiosity, why is this part of MyFaces as opposed to Shale. It sounds more like something that belongs there... We developed it under the MyFaces umbrella during the last months, we started with a tag base way until we reached the spring based solution we have now. So, thats why it's still here. We will see what the future brings. Ciao, Mario
Re: MyFaces-API issue: getValue of UIInput
In this case, I'd strongly recommend that you run this by the spec folks. If nothing else, we should get a clarification for the next revision. On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote: I didn't find anything in the spec. JavaDoc of getValue in UIOutput says: Gets the value of this UIComponent. First, consult the local value property of this component. If non-null return it. If non-null, see if we have a ValueBinding for the value property. If so, return the result of evaluating the property, otherwise return null. This description is obviously wrong (two times If non-null..), but if you correct this obvious mistake, it speaks against my solution. But then, reading the spec on a more general level it says: 3.1.4 Value Binding Expressions Properties and attributes of standard concrete component classes may be value binding enabled. This means that, rather than specifying a literal value as the parameter to a property or attribute setter, the caller instead associates a ValueBinding (see Section 5.3.3 ValueBinding) whose getValue() method must be called (by the property getter) to return the actual property value to be returned if no value has been set via the corresponding property setter. If a property or attribute value has been set, that value must be returned by the property getter (shadowing any associated value binding expression for this property). and this would clearly indicate I'm on the right track. Properly reading this would mean we are wrong-doers for every component attribute of every component, even if the chance is rather small that the issue arises for normal attributes (it might definitely happen though). regards, Martin On 3/1/07, Mike Kienenberger [EMAIL PROTECTED] wrote: What's the spec say about UIInput's getValue()? If it's silent, I'd say your solution makes sense. On 3/1/07, Martin Marinschek [EMAIL PROTECTED] wrote: Wanted to discuss a small thing with you: UIOutput currently has the following code: public Object getValue() { if (_value != null) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } UIInput has the following code: public void setValue(Object value) { setLocalValueSet(true); super.setValue(value); } My problem (pseudo code): 1) user enters an empty string in an input-component: 2) conversion and validation phase: -- setValue(null); isLocalValueSet = true; setSubmittedValue(null); 3) validation fails in some component on the page -- update model phase is skipped 4) renderer calls getValue(); -- getValue() evaluates the value-binding, as the local-value is 'null', and I get the default-value of the bean shown again proposed solution: UIInput overwrites getValue of UIOutput: public Object getValue() { if (isLocalValueSet()) return _value; ValueBinding vb = getValueBinding(value); return vb != null ? (Object)vb.getValue(getFacesContext()) : null; } everyone d'accord? regards, Martin -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: MyFaces Fusion Naming
and may be thats because shale has chosen a different approach? On 3/2/07, Mario Ivankovits [EMAIL PROTECTED] wrote: Hi ! Just out of curiosity, why is this part of MyFaces as opposed to Shale. It sounds more like something that belongs there... We developed it under the MyFaces umbrella during the last months, we started with a tag base way until we reached the spring based solution we have now. So, thats why it's still here. We will see what the future brings. Ciao, Mario -- Arash Rajaeeyan