Iframe shortcircuits JSF Lifecycle

I need to find out why using an <iframe> element in my jsp page under JSF (with or without a <verbatim> tag
SHORT-CIRCUITS THE JSF LIFECYCLE?
ie: it goes right to after renderresponse completely bypassing validation and data binding!!
PLEASE HELP!!!

Hi,
The following are the steps I followed:
1. Create a new project
2. Drag and drop a textField
3. In the properties sheet check the required property for the textField
4. Drag and drop a button and an outputText
5. Right click on the session bean in the Project Navigator and add a property named txtVal
6. Double click on the button and in the button_action method enter the following lines of code
getSessionBean1().setTxtVal((String)textField1.getValue());
outputText1.setValue(getSessionBean1().getTxtVal());
7. Click on the jsp tab for the page1.jsp and add the following lines of code inside the form tags
<iframe align="right" height="80" src="http://www.yahoo.com" style="left: 48px; top: 264px; position: absolute" width="40%">
<p>See our newsflashes.</p>
</iframe>
8. Switch to the design view of Page1.jsp
9. Drag and drop a message list component onto Page1.jsp
10. Drag and drop a datatable
11. Drag and drop the PERSON table from the travel database
12. Save and run the application
On clicking on the button without entering a value we see that an error message " Validation Error: Value is required." is displayed by the message component. Also the rest of the components like the datatable also display tthe expected values.
Hope this helps
Cheers
Giri :-)

Similar Messages

  • High cpu usage during JSF lifecycle phase execution

    In our performance test we encountered a high cpu usage (100%) and the thread dumps indicated that most of the times the threads are either executing restore view or render response phase of the JSF lifecycle or they are blocked while accessing the jar files which containing the xhtml pages.
    One of the thread dump of a runnable thread is
    java.lang.Thread.State: RUNNABLE
    at java.util.HashMap.get(HashMap.java:317)
    at javax.faces.component.ComponentStateHelper.get(ComponentStateHelper.java:174)
    at javax.faces.component.ComponentStateHelper.add(ComponentStateHelper.java:216)
    at javax.faces.component.UIComponent.setValueExpression(UIComponent.java:436)
    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler$CompositeComponentRule$CompositeExpressionMetadata.applyMetadata(CompositeComponentTagHandler.java:631)
    at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81)
    at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102)
    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.setAttributes(CompositeComponentTagHandler.java:246)
    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(CompositeComponentTagHandler.java:184)
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
    at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:120)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:107)
    at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178)
    at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366)
    at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:112)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
    at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
    at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:120)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)while a thread trace for a blocked thread is
    java.lang.Thread.State: BLOCKED (on object monitor)
    at java.util.zip.ZipFile.getEntry(ZipFile.java:302)
    - waiting to lock <0x00000000c0f678f8> (a java.util.jar.JarFile)
    at java.util.jar.JarFile.getEntry(JarFile.java:225)
    at java.util.jar.JarFile.getJarEntry(JarFile.java:208)
    at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:817)
    at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:795)
    at sun.misc.URLClassPath.findResource(URLClassPath.java:172)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:551)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:549)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findResource(URLClassLoader.java:548)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1138)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1133)
    at org.glassfish.web.loader.WebappClassLoader.getResource(WebappClassLoader.java:1156)
    at org.glassfish.web.loader.WebappClassLoader.getResourceFromJars(WebappClassLoader.java:1111)
    at org.apache.catalina.core.StandardContext.getMetaInfResource(StandardContext.java:7586)
    at org.apache.catalina.core.StandardContext.getResource(StandardContext.java:6979)
    at org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:382)
    at org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:260)
    at com.sun.faces.context.ExternalContextImpl.getResource(ExternalContextImpl.java:502)
    at com.sun.faces.application.resource.WebappResourceHelper.getURL(WebappResourceHelper.java:119)
    at com.sun.faces.application.resource.ResourceImpl.getURL(ResourceImpl.java:190)
    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyCompositeComponent(CompositeComponentTagHandler.java:366)
    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(CompositeComponentTagHandler.java:191)
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
    at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:120)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:107)
    at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178)
    at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366)
    at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:112)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
    at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774)
    at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:223)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:188)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:148)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)We use glassfish 3.1.1 as our application and the project_stage property is set to System_test. I would like to get suggestions on how should I investigate this further. Is this a normal behavior? Does glassfish provide an alternative for resolving blocked threads like some caching mechanism for resources etc?
    Thanks in advance

    Nik wrote:
    Even if it is legal, have you tried moving them out of there (just to pinpoint a possible bug since the stacktrace indicates a wait on a jar file)?Indeed. If that clears up the issue it is good information to put in a JSF bug report (which may even cascade to the Glassfish level).
    Putting resources in a jar file is only really useful when you want to share those resources among different web applications, which should be a rare case. Even when it happens I would probably still choose to simply copy the resources so they are individually managed and you don't get unnecessary dependencies between applications. Just because something is technically possible doesn't make it a good idea.

  • What does the scriptcollector do and how does it related to jsf lifecycle?

    hi,
    i want to know what does the scriptcollector do and how does it related to jsf lifecycle? and also in the scriptcollector if i call this,
    preRender=#{myBean.onPageLoadBegin}
    postRender=#{myBean.onPageLoadEnd}
    how my page will react?

    The hx:scriptCollector is part of the IBM Faces Client Framework and has nothing to do with Sun JSF RI.
    Lot of the hx components require specific Javascript and those hx components should be placed inside a single hx:scriptCollector which on its turn checks the nested hx components and renders the desired Javascript for it at the end of the tag. Check the HTML source for that Javascript.

  • Problem with JSF lifecycle

    1> Create a index.html page which loads menu.jsp in frame 1 and search.jsp in frame 2
    2> menu.jsp --- define target as frame 2. Insert a command button, the action event of which re-loads search.jsp in frame 2
    3> search.jsp ---- insert one input text box.
    4> Start server and execute index.html on the server
    5> Click on command button in menu.jsp, it loads search.jsp in frame 2...ok...no problem....
    6> Keep on clicking the command link....after X number of clicks the menu.jsp gets loaded into frame 2.
    7> Click again and the cycle starts again...again after X number of clicks the menu.jsp gets loaded into frame 2.
    I have found that whenever the menu.jsp gets loaded in frame 2, the "Apply Request Values" phase and subsequent phases till the "Invoke Application" phase is not called.....Basically the menu.jsp page is not posted. In my case the X always turned out to be 18. I am testing on Websphere 5.1.2.
    Is this is bug in JSF lifecycle implementation OR a Webshere issue ?
    Appreciate any help in this regard.

    Thanks.
    Does anyone know if there is a patch available for WAS 5.1.2 to fix this problem ? OR is there any other solution because our company will not move to RAD 6 in the near future...Thks

  • Slow performance during Apply Request Values Phase of JSF lifecycle

    Dear all,
    I found that my application is sucked at the Apply Request Values Phase of JSF lifecycle when I submit the page. (Totally spend 1 min to pass this phase)
    In the application, there is around 300 input fields in the page. Who know how can I ehance the performace?
    Thanks.

    Thanks a lot for your help. Maybe I explain more about my current structure
    I need to develop a input form for course instructor to input students' assignment / examination result (max 9 assignments and 1 examination).
    so that I have below coding:
    *1. bean to store marks of a student*
    public class Mark {
    private String studentID = "";
    private String mark1 = "";
    private String mark9 = "";
    private String markExam = "";
    //getter & setter of above properties
    public void setMark1(String mark1) {
    this.mark1 = mark1;
    public String getMark1() {
    return this.mark1;
    *2. backing bean*
    public class markHandler {
    ArrayList<Mark> marks = new ArrayList<Mark>();
    //getter & setter of above property
    //method to retrieve list of student (this will be the action before go in mark input page)
    public void getStudentList() {
    //get student list from database
    for(int i = 0 ; i < studentCount; i++){
    //initial mark of student
    Mark mark = new Mark();
    mark.setStudentID(studentID);
    mark.setMark1("");
    mark.setMarkExam("");
    //put into arraylist
    marks.add(mark);
    *3. mark input page*
    <html>
    <h:dataTable value="#{markHandler.marks}" var="e">
    <column>
    <h:output value="#{e.studentID}" />
    </column>
    <column>
    <h:input id="mark1" value="#{e.mark1}" />
    </column>
    <column>
    <h:input id="mark1" value="#{e.markExam}" />
    </column>
    </h:dataTable>
    <h:commandButton action="#{markHandler.save} />
    </html>
    When I submit the page, It seems that there is a long time spent at the input field of datatable at Apply Request Values Phase. (I use Phase Listeners to test the time difference before & after phase)
    Pls help. Thanks.
    Edited by: Daniel_problem on Aug 15, 2008 10:34 AM
    Edited by: Daniel_problem on Aug 15, 2008 10:36 AM

  • Has anyone really understood the JSF LifeCycle

    I have created my own phase listener :
    public class MyPhaseListner implements PhaseListener {
    public void afterPhase(PhaseEvent evt) {
    System.out.println("EXITING : " + evt.getPhaseId());
    public void beforePhase(PhaseEvent evt) {      
    System.out.println("ENTERING : " + evt.getPhaseId());
    public PhaseId getPhaseId() {
    return PhaseId.ANY_PHASE;
    When i display my page first time I am getting the following output :
    ENTERING : RESTORE_VIEW 1
    EXITING : RESTORE_VIEW 1
    ENTERING : RENDER_RESPONSE 6
    Inside Constructor
    Managed Bean Created.......
    Thank you !!!!
    EXITING : RENDER_RESPONSE 6
    ENTERING : RESTORE_VIEW 1
    EXITING : RESTORE_VIEW 1
    ENTERING : RENDER_RESPONSE 6
    EXITING : RENDER_RESPONSE 6
    ENTERING : RESTORE_VIEW 1
    EXITING : RESTORE_VIEW 1
    ENTERING : RENDER_RESPONSE 6
    ENTERING : RESTORE_VIEW 1
    EXITING : RESTORE_VIEW 1
    ENTERING : RENDER_RESPONSE 6
    EXITING : RENDER_RESPONSE 6
    EXITING : RENDER_RESPONSE 6
    As per my knowledge I can understand first 4 statements(before "*****") outputted.
    An empty view is created and then render response phase is reached skipping all intermediate steps being the first request to JSF page.
    However I can not understand further calls made by JSF lifecycle.
    Can anyone elaborate me more on this?
    Also I am very much interested in some strange number displayed after every phaseId !!!!!

    Hi Sergy !
    Thanks for your reply.!!!!
    Well actually I have some style-sheets and images on my page.
    I think JSF even treats these elements to be a seapare entity.
    So all other statements were for these elements.
    Well I have modified my phase Listener to reflect the view Id as well.
    Below is the class...if anyone is interested !!!
    package util;
    import javax.faces.component.UIViewRoot;
    import javax.faces.event.PhaseEvent;
    import javax.faces.event.PhaseId;
    import javax.faces.event.PhaseListener;
    public class MyPhaseListner implements PhaseListener {
         public void afterPhase(PhaseEvent evt) {
         UIViewRoot root = evt.getFacesContext().getViewRoot();
         if(root == null){
              System.out.println("EXITING : " + evt.getPhaseId());
         }else{
              System.out.println("EXITING : " + evt.getPhaseId() + root.getViewId());
         public void beforePhase(PhaseEvent evt) {
              UIViewRoot root = evt.getFacesContext().getViewRoot();
              if(root != null){
                   System.out.println("ENTERING : " + evt.getPhaseId() + root.getViewId());
              }else{
                   System.out.println("ENTERING : " + evt.getPhaseId());
         public PhaseId getPhaseId() {
              return PhaseId.ANY_PHASE;
    }

  • Making the most of the JSF lifecycle

    I have read through some documenation for the JSF lifecycle, I am wondering though how you would really take advantage of it?
    One of the purposes of JSF was to insulate the developer from having too know much about HTTP. However, how much do they really need to know about JSF lifecycle and what cool things are there that really show the usefullness of this lifecycle being exposed?
    Thanks.

    beginner2 wrote:
    I have read through some documenation for the JSF lifecycle, I am wondering though how you would really take advantage of it?You don't. The phases of the lifecycle are just how JSF ticks; they are not there to make your life easier, they are a design choice you have to know about and have to know how to design around. Not knowing about them is eventually going to lead to unexpected behavior caused by wrong assumptions.
    One of the purposes of JSF was to insulate the developer from having too know much about HTTP. Utter nonsense, IMO. To use JSF, you should be incredibly familiar with HTTP, HTML and Javascript. Sticking your head in the sand and not taking the time to know the very foundation you are working on is going to make you step in a pothole and hurt yourself badly sooner rather than later.
    Of course, that does not stop people from trying. If you want to meet them, they regularly post "how do I do this", "why does this happen" and "bug in JSF?" questions right here in this forum.
    However, how much do they really need to know about JSF lifecycleKnow what each phase of the lifecycle does and in which order they are executed. Know when a phase will be skipped. That is in my opinion what you should know to avoid the gotchas.
    and what cool things are there that really show the usefullness of this lifecycle being exposed?See previous statements.

  • Where in the JSF lifecycle does submittedValue, localVaue, value get set?

    Where in the JSF lifecycle does submittedValue, localVaue and value get set? I was looking at those values on a hidden input field and it was not clear to me in what phases the various values get set. It seemed like sometimes one was set, sometimes the other was set. It was not clear to me how to know where to look for the value (other than try one if that was null try another).
    Brian

    BHiltbrunner wrote:
    Where in the JSF lifecycle does submittedValueIt will be set during the apply request values phase, in the decode() method of the HtmlBasicRenderer.
    It will be reset to null during the process validations phase, in the validate() method of the UIInput.
    localValue and value get set? Those will be set during the process validations phase, in the validate() method of the UIInput.
    The difference is that 'localValue' represents the actual and unevaluated value, and 'value' represents the outcome of the evaluated ValueExpression value.
    I was looking at those values on a hidden input field and it was not clear to me in what phases the various values get set. It seemed like sometimes one was set, sometimes the other was set. It was not clear to me how to know where to look for the value (other than try one if that was null try another).Depends on the where and when you're going to check them.

  • ValueChangeListener fires in JSF lifecycle on a typical actionListener?

    Why does a valueChangeListener on a selectOneChoice fire in the JSF Lifecycle when I click on a separate non-related commandButton that runs an actionListener?
    How do I prevent a valueChangeListener to not fire when I click on a commandButton that runs an actionListener?
    <af:selectOneChoice id="overrideDevice"
    label="#{common.labelOverrideDevice}"
    required="true"
    unselectedLabel="#{common.selectionRequired}"
    value="#{resend.overrideDevice}"
    autoSubmit="true"
    immediate="true"
    valueChangeListener="#{resend.valueChanged}"
    binding="#{resend.overrideDeviceSelect}">
    <f:selectItems value="#{resend.overrideDeviceList}" />
    </af:selectOneChoice>
    and
    <af:commandButton id="bSearch"
    text="#{common.tbFind}"
    actionListener="#{resend.doSearch}"/>
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    That caused a blank page to be rendered. After the user clicked on the commandButton and fired the actionListener, the valueChangeListener fired; the JSF Lifecycle jumped from APPLY_REQUEST to termination as soon as the APPLY_REQUEST phased completed.
    I can see this happening as I debug the application.
    I'm still at a lost of why a valueChangeListener would fire..?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • JSF lifecycle : render view

    Was just having look at logs of a JSF application, below are the output's from PhaseListener
    RESTORE_VIEW(1)
    APPLY_REQUEST_VALUES(2)
    RESTORE_VIEW(1)
    RENDER_RESPONSE(6)
    How come RESTORE_VIEW is called after APPLY_REQUEST_VALUES, from JSF lifecycle it seems
    that they are executed in certain order(although some can be skipped)
    Regards,
    Joshua

    Multiple requests?
    Without an SSCCE it's only guessing to an answer.

  • Simple component binding/JSF lifecycle question

    As a JSF newbie, I ran into an unexpected component binding state/JSF lifecycle issue. Given this JSP code:
    <h:inputText id="boundinput" binding="#{UserBean.boundInput}">and this Java setter code:
           private UIInput boundInput = new UIInput();
            public void setBoundInput(UIInput aBoundInput) {
                this.boundInput = aBoundInput;
                String value = aBoundInput.getValue();
            }the result of 'value' is the previous value of the input text field when the form is submitted. The component is bound, but why isn't the new value available?
    It seems to get the 'current' value of the bound component, a valueChangeListener has to be implemented? I may be missing something fundamental, so any help is appreciated.

    If you only want to get and set values, use valuebinding instead.
    If you're debugging the setBoundInput after form input, then yes, it is correct that the old value is still in there. This would be updated at a later JSF phase yet.
    Check http://balusc.xs4all.nl/srv/dev-jep-djl.html to get some insights in the JSF lifecycle.

  • Using IFRAME in JSF to display a PDF file

    2 all,
    How do i display a PDF file inside a JSF page in a IFRAME tag?
    I store the PDF file location (like d:\images\pdf1.pdf) in my database. I cant give this location directly into the src attribute cos then the file will be rendered to only users who have access to that folder (the application is a internet application). IFRAME would be ideal as the display is very very neat (esp for pdf files).
    To get this working i tried the examples given in balusc blogs (on image servlet) but the problem is that my servlet is not getting called. Find below the web.xml and imageDisplay.jsp pages that i tried
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>WorkFlowTool</display-name>
    <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
    </context-param>
    <filter>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
      <init-param>
       <param-name>maxFileSize</param-name>
       <param-value>20m</param-value>
      </init-param>
    </filter>
    <filter>
      <display-name>SecurityCheckFilter</display-name>
      <filter-name>SecurityCheckFilter</filter-name>
      <filter-class>filters.SecurityCheckFilter</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>/faces/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>*.faces</url-pattern>
    </filter-mapping>
    <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>*.jsf</url-pattern>
    </filter-mapping>
    <filter-mapping>
      <filter-name>SecurityCheckFilter</filter-name>
      <url-pattern>/faces/*</url-pattern>
    </filter-mapping>
    <listener>
      <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    <servlet>
      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
      <servlet-name>Image Servlet</servlet-name>
      <servlet-class>servlets.ImageServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>Image Servlet</servlet-name>
      <url-pattern>/imageServlet/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
      <session-timeout>60</session-timeout>
    </session-config>
    <welcome-file-list>
      <welcome-file>/jsp/index.jsp</welcome-file>
    </welcome-file-list>
    <error-page>
      <error-code>500</error-code>
      <location>/jsp/error.jsp</location>
    </error-page>
    <resource-ref>
      <res-ref-name>jdbc/JDDS</res-ref-name>
      <res-type>java.lang.Object</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </web-app>
    imageDisplay.jsp
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
    <f:loadBundle basename="messages" var="msg" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <LINK rel="stylesheet" type="text/css" href="../theme/Styles.css"
         title="Style">
    </HEAD>
    <body topmargin="0" leftmargin="0">
    <f:view>
         <h:form id="CaseLookUp">
              <h:dataTable value="#{pc_ImageDisplay.dataModel}" var="var">
                   <h:column id="one">
                        <f:facet name="header">
                             <h:outputText value="H1" id="HOne"/>
                        </f:facet>
                        <h:outputText value="#{var.caseID}" id="IDONE"/>
                   </h:column>
                   <h:column id="two">
                        <f:facet name="header">
                             <h:outputText value="H2" id="HTwo"/>
                        </f:facet>
                        <h:graphicImage value="imageServlet?file=#{var.PODocPath}" id="image"/>
                   </h:column>
              </h:dataTable>
         </h:form>
    </f:view>
    </body>
    </HTML>The image servlet is what i got from balusc's site (http://balusc.blogspot.com/2007/04/imageservlet.html).
    I dont know why my servlet is not getting called. Can someone help me with this pls?
    okay let me post the modified code for my image servlet here
    public class ImageServlet extends HttpServlet {
         private static final long serialVersionUID = 1L;
         public void doGet(HttpServletRequest request, HttpServletResponse response) {
            // Define base path somehow. You can define it as init-param of the servlet.
    //        String imageFilePath = "/images";
            // In a Windows environment with the Applicationserver running on the
            // c: volume, the above path is exactly the same as "c:\images".
            // In UNIX, it is just straightforward "/images".
            // If you have stored images in the WebContent of a WAR, for example in the
            // "/WEB-INF/images" folder, then you can retrieve the absolute path by:
            // String imageFilePath = getServletContext().getRealPath("/WEB-INF/images");
            // Get file name from request.
            String imageFileName = request.getParameter("file");
            System.out.println("Inside the image servlet ---->>>> " + imageFileName);
            // Check if file name is supplied to the request.
    //        if (imageFileName != null) {
    //            // Strip "../" and "..\" (avoid directory sniffing by hackers!).
    //            imageFileName = imageFileName.replaceAll("\\.+(\\\\|/)", "");
    //        } else {
    //            // Do your thing if the file name is not supplied to the request.
    //            // Throw an exception, or show default/warning image, or just ignore it.
    //            return;
            // Prepare file object.
            File imageFile = new File(imageFileName);
            // Check if file actually exists in filesystem.
            if (!imageFile.exists()) {
                // Do your thing if the file appears to be non-existing.
                // Throw an exception, or show default/warning image, or just ignore it.
                return;
            // Get content type by filename.
            String contentType = URLConnection.guessContentTypeFromName(imageFileName);
            // Check if file is actually an image (avoid download of other files by hackers!).
            // For all content types, see: http://www.w3schools.com/media/media_mimeref.asp
            if (contentType == null || !contentType.startsWith("image")) {
                // Do your thing if the file appears not being a real image.
                // Throw an exception, or show default/warning image, or just ignore it.
                return;
            // Prepare streams.
            BufferedInputStream input = null;
            BufferedOutputStream output = null;
            try {
                // Open image file.
                input = new BufferedInputStream(new FileInputStream(imageFile));
                int contentLength = input.available();
                // Init servlet response.
                response.reset();
                response.setContentLength(contentLength);
                response.setContentType(contentType);
                response.setHeader(
                    "Content-disposition", "inline; filename=\"" + imageFileName + "\"");
                output = new BufferedOutputStream(response.getOutputStream());
                // Write file contents to response.
                while (contentLength-- > 0) {
                    output.write(input.read());
                // Finalize task.
                output.flush();
            } catch (IOException e) {
                // Something went wrong?
                e.printStackTrace();
            } finally {
                // Gently close streams.
                if (input != null) {
                    try {
                        input.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                        // This is a serious error. Do more than just printing a trace.
                if (output != null) {
                    try {
                        output.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                        // This is a serious error. Do more than just printing a trace.
        }

    Thanks Balusc!!
    I have made use of your code to display PDF files in an IFRAME tag too!!! I just dint believe that this would be possible. Please just take a look at my JSP page.
    <h:form id="CaseLookUp">
         <%
         String path = request.getContextPath()+"";
         out.print(path);
         %>
    <iframe scrolling="auto" src="<%=path%>/imageServlet?file=D:\70-229 V5.pdf" width="80%" height="600" ></iframe>
         </h:form>

  • Customize JSF LifeCycle

    Hi all,
    Presently i am working on JDeveloper 11g. I want to customize JSF PageLifecycle in my project for customizing error messages to get proper error messages to the client. Can anybody help me ?

    This question has been ask here before. Have you searched the forum?
    Did you check the docs?
    [26.8 Customizing Error Handling|http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/web_adv.htm#CIHHBEEJ] shows how to do this.
    For the life cycle read [19 Understanding the Fusion Page Lifecycle|http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/adf_lifecycle.htm]
    Timo

  • JSF Lifecycle

    Hello all,
    I am experiencing the following problem:
    Imagine that there is a managed bean with scope = "request", called "bean". There is a page X that has a couple of properties bound to this bean:
    * commnandButton id="myButton" rendered="#{bean.buttonRendered}"
    * inputText value="#{bean.textValue}"
    And so on. When we navigate TO page X, we create the request scoped bean and fill the required properties in (e.g. bean.setTextValue("This is a test"); ).
    Now let the isButtonRendered method behave like this:
    if (getTextValue().equals("This is a test"))
    return true;
    return false;
    The problem is, that when we click the "myButton" button, the isButtonRendered() method of the bean is called before the request values are applied to the bean. So, textValue is still null and thus, a NullPointerException occurs in the isButtonRendered method.
    Could you please tell me why the isButtonRendered() method is called? Why does the JSF framework need this value before the values are applied, and how is this very frequently occurring problem worked around in practice?
    Best Regards,
    Slavi

    And there is something significantly more important:
    Imagine you have the following binding:
    #{bean.someObject.someField}
    and you click the button. Then you immediately get a NullPointerException in the Validation Phase, because the bean.someObject is null!!!!
    Please help - I am trying to get something extremely fundamental - a master-detail relationship between pages. In the master page, you have a datatable and when you click on some item, you are sent to a detail page that allows editing of the selected item. The bean behind the detail page is with request scope. Thus, I keep the ID of the selected item in a inputHidden field. However, when you click "Save" on the detail page, a NullPointerException occurs in the validation phase, because when validation occurs, the setter method of the hidden fields has not yet been called and someObject is null.
    Do you have any idea how to solve this task?
    Any help will be greatly appreciated. Thank you all in advance!
    Best Regards,
    Slavi

  • How does the JSF lifecycle work for stateless HttpSessions?

    Ok, so just trying to get my head around this. The JSF architecture stores a lot of UI info in the session. Now this can be stored client or server side but the server side is default. I am wondering what would happen if the serlvet HttpSessions were stateless?

    But they aren't. They are associated with an IP address, port, and jsessionid. All of that is state.

Maybe you are looking for

  • Is it possible to Uninstall the latest ipod update?

    I, like others on this board, made the mistake of trusting Apple to produce software that does no harm. Windows XP has a facility where you can go back to a restore point. Does anyone know of a Unix command that will do something similar? I was using

  • Set  item categaries of sales order  is  not  relevant for picking

    dear friends:    when i created the outbound delivery and must maintain the picking quantity of materails.i change the configration of system so that not nessesary maintain the picking quantity. set  item categaries of sales order  is  not  relevant

  • Merge to HDR - How to make it work?

    Merge to HDR worked once on the CS4 sample files but no more. Photoshop gets through the Merge to HDR dialog on the sample jpegs (or my own jpegs) but throws the following error when creating the HDR image: Error 54: uncaught JavaScript exception: Er

  • Problem while subcontracting with acct assgt category 'Q'

    Hi, We have a Subcontracting PO with item category 'L' and account assignment category 'Q'. While goods reciept against PO, for 543 it is taking project stock(Q) from storage location instead of vendor stock(O).Please provide the solution(with CIN de

  • 3gs not responding to itunes error (23) pops up whire restoring

    i hav apple 3gs n it is acting very bad it is not restoring..while rstoring error 23 message pops up...n it is also not geting started...plz help me...n re solve the problm...so tat i can start my phone