You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Venkat Rao <ve...@cadenasoft.com> on 2006/07/25 14:19:34 UTC

Dynamic rendering of input components not possible?

I am iterating over a list of Graphics entity objects, and am
displaying information about each in input controls, by calling the
object specific methods, as in the following code

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">

    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
        <h:outputLabel for="radiusTF">Enter Radius:</h:outputLabel>
        <h:inputText id="radiusTF" value="#{graphicsObj.radius}"/>
    </h:panelGroup>

    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
        <h:outputLabel for="lengthTF">Enter Length:</h:outputLabel>
        <h:inputText id="lengthTF" value="#{graphicsObj.length}"/>
    </h:panelGroup>

</ui:repeat>

Based on the type of the object, I am calling the object-specific
method such as getRadius() or getLength(). This gives the following error. 

javax.faces.el.PropertyNotFoundException: /graphicsView.xhtml @31,80
value="#{graphicsObj.radius}": Bean: com.serviceramp.model.Rectangle,
property: radius

It appears that even when the object is of type rectangle, it executed
the first block of code, and is calling the getRadius() method. 

However, if I replace the HTMLInputText with HTMLOutputText, as in the
code below, it works perfectly.

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">

    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
        <h:outputText value="Found circle with radius:
#{graphicsObj.radius}"/>
    </h:panelGroup>

    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
        <h:outputText value="Found rectangle with length:
#{graphicsObj.length}"/>
    </h:panelGroup>

</ui:repeat>

What is going wrong here? How can I get the desired effect of creating
dynamic input components?

Thanks,
-- venkat
venkat.rao@cadenasoft.com


Re: Dynamic rendering of input components not possible?

Posted by Kapil Kataria <ka...@gmail.com>.
Hi

Do you have any architecture vision document , please mail me if you have
one, I need this for refrence, for creating a new achitecture for an
application CMS.

Thanks in Advance


On 7/25/06, Venkat Rao <ve...@cadenasoft.com> wrote:
>
> I am iterating over a list of Graphics entity objects, and am
> displaying information about each in input controls, by calling the
> object specific methods, as in the following code
>
> <ui:repeat var="graphicsObj" value="#{graphicsObjList}">
>
>    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
>        <h:outputLabel for="radiusTF">Enter Radius:</h:outputLabel>
>        <h:inputText id="radiusTF" value="#{graphicsObj.radius}"/>
>    </h:panelGroup>
>
>    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
>        <h:outputLabel for="lengthTF">Enter Length:</h:outputLabel>
>        <h:inputText id="lengthTF" value="#{graphicsObj.length}"/>
>    </h:panelGroup>
>
> </ui:repeat>
>
> Based on the type of the object, I am calling the object-specific
> method such as getRadius() or getLength(). This gives the following error.
>
> javax.faces.el.PropertyNotFoundException: /graphicsView.xhtml @31,80
> value="#{graphicsObj.radius}": Bean: com.serviceramp.model.Rectangle,
> property: radius
>
> It appears that even when the object is of type rectangle, it executed
> the first block of code, and is calling the getRadius() method.
>
> However, if I replace the HTMLInputText with HTMLOutputText, as in the
> code below, it works perfectly.
>
> <ui:repeat var="graphicsObj" value="#{graphicsObjList}">
>
>    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
>        <h:outputText value="Found circle with radius:
> #{graphicsObj.radius}"/>
>    </h:panelGroup>
>
>    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
>        <h:outputText value="Found rectangle with length:
> #{graphicsObj.length}"/>
>    </h:panelGroup>
>
> </ui:repeat>
>
> What is going wrong here? How can I get the desired effect of creating
> dynamic input components?
>
> Thanks,
> -- venkat
> venkat.rao@cadenasoft.com
>
>


-- 
Regards,
Kapil kataria

Re: Dynamic rendering of input components not possible?

Posted by Andrew Robinson <an...@gmail.com>.
Your stack trace doesn't seem to map to your previous example, so I am
not sure what is going on.

>From what it looks like, you have
"com.serviceramp.model.SelectionElement" mapped as a managed bean
called "sde". You have EL somewhere in your page that refers to
"sde.content". Therefore one of the following must exist on
"com.serviceramp.model.SelectionElement":

public Object getContent();
public boolean isContent();

(The return type is not that important as the method name and signature)
According to the stack trace "SelectionElement" does not have one of
these methods, so the property not found exception is being thrown.

Hope that helps. If not, we will need more information to help you
(XHTML/JSP code and the Java code -- at least signatures).


On 7/26/06, Venkat Rao <ve...@cadenasoft.com> wrote:
> Probably this problem does not have to do with the "rendered"
> property, but something deeper.
>
> I have been able to reproduce this error not only during rendering but
> also during a postback, when it is trying to update model values. My
> suspicion is that somewhere there is an assumption that all objects in
> the list are of the same class. It also appears that if there are two
> lists (two ui:repeats within the same form, it is trying to apply a
> list from one ui:repeat to another).
>
> Please see both stack traces. Could this be a problem with facelets?
> If it helps, I will create create a small independent test case
> project and send it to you. Please let me know.
>
> The stack trace when I try to render the page:
>
> javax.faces.el.PropertyNotFoundException: /serviceView.xhtml @28,46
> value="#{sde.content}": Bean: com.serviceramp.model.SelectionElement,
> property: content
>         at
> com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
>         at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
>         at
> com.sun.facelets.component.UIRepeat$SavedState.populate(UIRepeat.java:503)
>         at
> com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:225)
>         at
> com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:231)
>         at
> com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:211)
>         at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:302)
>         at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:386)
>         at
> com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:617)
>         at
> org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererU
> tils.java:436)
>         at
> org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(Render
> erUtils.java:419)
>         at
> org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEn
> d(HtmlGroupRendererBase.java:75)
>         at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
>         at
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(Rende
> rerUtils.java:442)
>         at
> org.apache.myfaces.custom.tabbedpane.HtmlTabbedPaneRenderer.writeTabsContent
> s(HtmlTabbedPaneRenderer.java:530)
>         at
> org.apache.myfaces.custom.tabbedpane.HtmlTabbedPaneRenderer.encodeEnd(HtmlTa
> bbedPaneRenderer.java:222)
>         at
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
>         at
> com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
> ava:242)
>         at
> com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
> ava:239)
>         at
> com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
> ava:239)
>         at
> com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:554)
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:252)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
> java:97)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
> java:144)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
> va:96)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:213)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:178)
>         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> ationValve.java:175)
>         at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
> 74)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
> )
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
> )
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :107)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
> onnection(Http11BaseProtocol.java:664)
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
> a:527)
>         at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre
> ad.java:112)
>         at java.lang.Thread.run(Thread.java:595)
>
>
>
> The stack trace when I submit the form -- in this case, I only have
> <h:outputText> and therefore I was able to show the contents. However,
> when I submit the form, during updating the model values, it hits this
> problem.
>
> javax.faces.el.PropertyNotFoundException: /serviceEdit.xhtml @56,80
> value="#{sde.content}": Bean: com.serviceramp.model.SelectionElement,
> property: content
>         at
> com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
>         at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
>         at
> com.sun.facelets.component.UIRepeat$SavedState.populate(UIRepeat.java:503)
>         at
> com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:225)
>         at
> com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:231)
>         at
> com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:211)
>         at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:302)
>         at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:333)
>         at
> com.sun.facelets.component.UIRepeat.processUpdates(UIRepeat.java:441)
>         at
> javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:64
> 5)
>         at
> javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:64
> 5)
>         at javax.faces.component.UIForm.processUpdates(UIForm.java:87)
>         at
> javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:64
> 5)
>         at
> javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:157)
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleImpl.j
> ava:302)
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:252)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
> java:97)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
> java:144)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
> va:96)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:173)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:213)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:178)
>         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> ationValve.java:175)
>         at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
> 74)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
> )
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
> )
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :107)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
> onnection(Http11BaseProtocol.java:664)
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
> a:527)
>         at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre
> ad.java:112)
>         at java.lang.Thread.run(Thread.java:595)
>
>
>
>

RE: Dynamic rendering of input components not possible?

Posted by Venkat Rao <ve...@cadenasoft.com>.
Probably this problem does not have to do with the "rendered"
property, but something deeper.

I have been able to reproduce this error not only during rendering but
also during a postback, when it is trying to update model values. My
suspicion is that somewhere there is an assumption that all objects in
the list are of the same class. It also appears that if there are two
lists (two ui:repeats within the same form, it is trying to apply a
list from one ui:repeat to another).

Please see both stack traces. Could this be a problem with facelets?
If it helps, I will create create a small independent test case
project and send it to you. Please let me know. 

The stack trace when I try to render the page:

javax.faces.el.PropertyNotFoundException: /serviceView.xhtml @28,46
value="#{sde.content}": Bean: com.serviceramp.model.SelectionElement,
property: content
	at
com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
	at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
	at
com.sun.facelets.component.UIRepeat$SavedState.populate(UIRepeat.java:503)
	at
com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:225)
	at
com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:231)
	at
com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:211)
	at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:302)
	at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:386)
	at
com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:617)
	at
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererU
tils.java:436)
	at
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(Render
erUtils.java:419)
	at
org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEn
d(HtmlGroupRendererBase.java:75)
	at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
	at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(Rende
rerUtils.java:442)
	at
org.apache.myfaces.custom.tabbedpane.HtmlTabbedPaneRenderer.writeTabsContent
s(HtmlTabbedPaneRenderer.java:530)
	at
org.apache.myfaces.custom.tabbedpane.HtmlTabbedPaneRenderer.encodeEnd(HtmlTa
bbedPaneRenderer.java:222)
	at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
	at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:242)
	at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:239)
	at
com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.j
ava:239)
	at
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:554)
	at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:97)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:144)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
va:96)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
	at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:175)
	at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
74)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
	at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre
ad.java:112)
	at java.lang.Thread.run(Thread.java:595)



The stack trace when I submit the form -- in this case, I only have
<h:outputText> and therefore I was able to show the contents. However,
when I submit the form, during updating the model values, it hits this
problem. 

javax.faces.el.PropertyNotFoundException: /serviceEdit.xhtml @56,80
value="#{sde.content}": Bean: com.serviceramp.model.SelectionElement,
property: content
	at
com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
	at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
	at
com.sun.facelets.component.UIRepeat$SavedState.populate(UIRepeat.java:503)
	at
com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:225)
	at
com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:231)
	at
com.sun.facelets.component.UIRepeat.saveChildState(UIRepeat.java:211)
	at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:302)
	at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:333)
	at
com.sun.facelets.component.UIRepeat.processUpdates(UIRepeat.java:441)
	at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:64
5)
	at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:64
5)
	at javax.faces.component.UIForm.processUpdates(UIForm.java:87)
	at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:64
5)
	at
javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:157)
	at
org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleImpl.j
ava:302)
	at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:97)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:144)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.ja
va:96)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:202)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
	at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:175)
	at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:
74)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
	at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThre
ad.java:112)
	at java.lang.Thread.run(Thread.java:595)




Re: Dynamic rendering of input components not possible?

Posted by Andrew Robinson <an...@gmail.com>.
Could you post the stack trace as well (I want to see where in the
lifecycle / rendering process this is dying)?

On 7/25/06, Venkat Rao <ve...@cadenasoft.com> wrote:
> The objType method returns a string, and the case is correct. The single
> missing quote was a typo when I composed my email.
>
> I tried your suggestion, and the values printed are as expected.
>
> The code below works as expected; however if I replace h:outputText with
> h:inputText, the problem is thrown (first block entered even when object
> is rectangle)
>
> <ui:repeat var="graphicsObj" value="#{graphicsObjList}">
>
>     <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
>         <h:outputText value="#{graphicsObj.radius}"/>
>     </h:panelGroup>
>
>     <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle'}" >
>         <h:outputText value="#{graphicsObj.length}"/>
>     </h:panelGroup>
>
> </ui:repeat>
>
> My code for the beans is as below:
>
> public abstract class GraphicsObj {
>     public String getObjType();
> }
>
> public class Circle {
>     public String getObjType() {
>         return "circle";
>     }
>
>     public void setRadius(int radius) {
>         this.radius = radius;
>     }
>     public int getRadius() {
>         return this.radius;
>     }
> }
>
> public class Rectangle {
>     public String getObjType() {
>         return "rectangle";
>     }
>
>     public void setLength(int length) {
>         this.length = length;
>     }
>     public int getLength() {
>         return this.length;
>     }
> }
>
> -- venkat
>
>
>
>

RE: Dynamic rendering of input components not possible?

Posted by Venkat Rao <ve...@cadenasoft.com>.
The objType method returns a string, and the case is correct. The single
missing quote was a typo when I composed my email.

I tried your suggestion, and the values printed are as expected. 

The code below works as expected; however if I replace h:outputText with 
h:inputText, the problem is thrown (first block entered even when object 
is rectangle)

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">

    <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
        <h:outputText value="#{graphicsObj.radius}"/>
    </h:panelGroup>

    <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle'}" >
        <h:outputText value="#{graphicsObj.length}"/>
    </h:panelGroup>

</ui:repeat>

My code for the beans is as below:

public abstract class GraphicsObj {
    public String getObjType();
}

public class Circle {
    public String getObjType() {
        return "circle";
    }

    public void setRadius(int radius) {
        this.radius = radius;
    }
    public int getRadius() {
        return this.radius;
    }
}

public class Rectangle {
    public String getObjType() {
        return "rectangle";
    }

    public void setLength(int length) {
        this.length = length;
    }
    public int getLength() {
        return this.length;
    }
}

-- venkat




Re: Dynamic rendering of input components not possible?

Posted by Andrew Robinson <an...@gmail.com>.
What is objType. is it a string? do you have the case correct? also
your 'rectangle' check is missing the last single quote.

The EL should not be evaluated until render time, so if the rendered =
false, then it should not be executed. Try this to make sure your
checks are correct:

<ui:repeat var="graphicsObj" value="#{graphicsObjList}">
   Circle: <h:outputText value="#{graphicsObj.objType eq 'circle'}" />
   Rectangle: <h:outputText value="#{graphicsObj.objType eq 'rectangle'}" />
   Class: <h:outputText value="#{graphicsObj.class.name}" />
</ui:repeat>

Hopefully that may shed some light. If not, post the results and your
'graphicsObj' java code and perhaps we can find something there.

-Andrew

On 7/25/06, Venkat Rao <ve...@cadenasoft.com> wrote:
> I am iterating over a list of Graphics entity objects, and am
> displaying information about each in input controls, by calling the
> object specific methods, as in the following code
>
> <ui:repeat var="graphicsObj" value="#{graphicsObjList}">
>
>     <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
>         <h:outputLabel for="radiusTF">Enter Radius:</h:outputLabel>
>         <h:inputText id="radiusTF" value="#{graphicsObj.radius}"/>
>     </h:panelGroup>
>
>     <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
>         <h:outputLabel for="lengthTF">Enter Length:</h:outputLabel>
>         <h:inputText id="lengthTF" value="#{graphicsObj.length}"/>
>     </h:panelGroup>
>
> </ui:repeat>
>
> Based on the type of the object, I am calling the object-specific
> method such as getRadius() or getLength(). This gives the following error.
>
> javax.faces.el.PropertyNotFoundException: /graphicsView.xhtml @31,80
> value="#{graphicsObj.radius}": Bean: com.serviceramp.model.Rectangle,
> property: radius
>
> It appears that even when the object is of type rectangle, it executed
> the first block of code, and is calling the getRadius() method.
>
> However, if I replace the HTMLInputText with HTMLOutputText, as in the
> code below, it works perfectly.
>
> <ui:repeat var="graphicsObj" value="#{graphicsObjList}">
>
>     <h:panelGroup rendered="#{graphicsObj.objType == 'circle'}" >
>         <h:outputText value="Found circle with radius:
> #{graphicsObj.radius}"/>
>     </h:panelGroup>
>
>     <h:panelGroup rendered="#{graphicsObj.objType == 'rectangle}" >
>         <h:outputText value="Found rectangle with length:
> #{graphicsObj.length}"/>
>     </h:panelGroup>
>
> </ui:repeat>
>
> What is going wrong here? How can I get the desired effect of creating
> dynamic input components?
>
> Thanks,
> -- venkat
> venkat.rao@cadenasoft.com
>
>