Re-rendering JSP/JSF pages

I wnat to be able to set up a checkbox that will cause some other components to be visible or invisible. I was thinking of using the rendering attribute on the target components. However, I am having trouble finding a good method of causing the rendered attribute to be re-evaluated when the checkbox is clicked. This is an enhancement to a current applicaiton that uses JSF1.1 with Tomahawk.
Any help would be appreciated. I've put in several hours researching this and have not found anything helpful.
Mike

Just let the checkbox submit the form on click.
<h:selectBooleanCheckbox value="#{myBean.checked}" onclick="this.form.submit();" />
<h:someComponent rendered="#{myBean.checked}" />If you want to do this asynchronously, consider Ajax4jsf.

Similar Messages

  • Is it possible to use two diff forms in same jsp/jsf page?

    Hi all,
    My requirement is to submit the form based on selection of radio button.
    since half part needs to be jsp based which is not using any tags etc.
    But i am trying to use some jsf based component which requires to be inside <f:view><h:form> of
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    i.e. some <c:comboBox>
    </h:form> </f:view>
    Now earlier i was submitting the form as
    <form action="/techstacks-v2_1/reportAction.do" method="post" name=doSearch id='doSearch'>
    But now i found, in order to use combo box component which is entirely jsf based i need to use <f:view><h:form> which is kind of taking over the previous form submission mechiansm.
    I am trying to keep them separate as two differnt forms.
    one entirely jsp based and other as jsf based.
    Now my question is can i use such way of doing so or is there any better way of implementing so.
    My friend suggested that i can pass the value of jsf based form in hidden form to a input box of form to be submitted finally instead of submitteing two diff forms.
    but in that case also i ahev to use two forms in a single jsp/jsf page.
    suggest me something which can really work out.
    thanks
    vijendra

    You can use as many forms as you want as long as you don't nest forms. The HTML spec probibits that.

  • Conditional rendering of JSF page depending on Navigation case

    Hi
    Can we conditionally render the JSF page depending the navigation case, which brought us in that page..
    Lets say that a page A does both Edit and create operations , we have two navigation cases "edit" and "create" directing to this page from main page. can we modify the components in the page depending on the navigation case.
    Thanks in advance
    Pradeep

    Hi Grant,
    your reply was helpful. i got into another scenario :-) where i need to know the navigation case which brought us into the page.
    I have a page flow in adf which can be called by client applications both as a popup or a regular window. the ADF's dialog framework more or less solves my requirement. But to return values from dialog, i have to use "returnFromDialog" method on click of button in the popup window. as i am reusing the page i would write a conditional statement to show diff behaviour when launched as a popup.
    my problem is that i do not want client application to set any parameter in the managed bean (this would get client apps into the implementation issues, causing unnecessary complexity). This again brings me back to the same question ability to KNOW (get handle of) the "navigation case".
    Pradeep

  • Access Java class in my JSP/JSF page and conditionally open a new browser

    When the user clicks on a button in my JSP page, I'd like to launch a new browser and display certain things in that browser window while leaving the original browser window open.
    My thought was to invoke a javascript method in 'onLoad' which would determine if the new window needs to be launched.
    This is kinda what my page looks like:
    <jsp:root version="1.2" ................>
        <jsp:directive.page import="java.util.*, com.test.Configuration" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
         <ui:body binding="#{Page1.body1}" id="body1" onLoad="launchWindow();">     
         </ui:body>
       </f:view>
       <script type="text/javascript">
            function launchWindow(){
             if (Configuration.openWindow()) {
              window.open("hello.jsp", "newWindow", 'toolbar,width=400,height=400');            
        </script>     
    </jsp:root>My problem is that the call to "Configuration.openWindow()" does not resolve correctly. If I remove that call and simply make a call to "window.open()" all works. But once I put the condition in, nothing happens. I do not see an exception in my browser window but a new browser window does not open.
    Is my syntax correct. Can I make a call to the static method 'openWindow()' in my class 'Configuration.java'.
    thanks,
    tsc

    I have made some changes so that I do not directly access the 'Configuration' class in my javascript.
    I have a hidden field on my form and when the user clicks the button, in my back bean, I set a value for the hidden field. In the javascript function 'launchWindow()' I check if a value has been set for the hidden field and if yes, I open a new window.
    <ui:body binding="#{Page1.body1}" id="body1" onLoad="launchWindow(document.forms[0]);">
    <h:inputText id="hiddenField" value="#{formBean.hiddenValue}" />
    <script type="text/javascript">
            function launchWindow(form){
                alert("in lw");
                var test = form["form1:hiddenField"].value;
                alert("got test");
                if (test !=  "")
                    window.open("hello.jsp", "newWindow", 'toolbar,width=400,height=400');            
                alert ("done test");
    </script>When my page is first loaded, the launchWindow() is called and all the alerts popup as expected.
    When I click on the button (the back bean sets the value on the hidden field), my page is reloaded but this time its blank.
    Any ideas as to why this maybe the case?
    thanks,
    tsc

  • Rendering a JSF page with a choice from CoreSelectOneChoice!

    Hi,
    I have a jsp page with lots of ADF and JSF components. I have a CoreTable component that gets it values from a DB thru Toplink. On this page I have a CoreSelectOneChoice component with a ValueChangedListener. When the user makes a selection from the CoreSelectOneChoice component I want the CoreTable to update its value based on code in the ValueChangeListener.
    My problem is that when the user makes its selection on the CoreSelectOneChoice component my CoreTable dont renders out from the new values I set in the ValueChangedListener.
    So how can I render (re-post) my CoreTable component or my whole page after the code in my ValueChangedListener has run? Or what code should I put in the ValueChangedListener to get the wanted behavior.
    Hope that sombody can help a stuck developer :-)
    Eskild

    Hi,
    set autosubmit = true on the core selet one component and define an ID value. On the table component, set the PatrialTriggers property to the ID value
    Frank

  • How to access a session variable just before rendering a JSF page???

    Dear Sirs...
    i am using jdeveloper 10.1.3.2 with JSF and ADF faces. i want to access a session variable and perform some processing just before rendering a page. how can i achieve this????
    i am a little new to jsf, so i feel a little lost
    thanks for any help in advance, and best regards

    <p>
    Hi,
    </p>
    <p>
    See example 60 &quot;<strong>Triggering OnPageLoad-Style Code in a JSF Backing Bean Using ADF PagePhaseListener or PageController</strong>&quot; on Steve&#39;s Muench blog.
    </p>
    <p>
    Kuba 
    </p>

  • Getting style missing errors while rendering ADF trees in JSF page

    I am getting the following message while rendering a JSF page with af:tree. Based on other posts on this forum, I verified servlet-mapping in web.xml and it is already set to /faces/*.
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    Here is my JSF code snippet.
    <f:view><af:document title="DeviceTree2.jsf" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <af:tree value="#{bindings.Device1.treeModel}" var="node" selectionListener="#{bindings.Device1.treeModel.makeCurrent}" rowSelection="single" id="t1">
    <f:facet name="nodeStamp"><af:outputText value="#{node}" id="ot1"/>
    </f:facet>
    </af:tree>
    </af:form>
    </af:document>
    </f:view>
    Surely I am missing something here but not sure on the real issue.
    Would appreciate if someone can help on this.

    I am getting the following error. Browser shows the JSF XML code listed in my original issue statement followed by this error.
    "This XML file does not appear to have any style information associated with it. The document tree is shown below."

  • Modifications to JSF page dont show up

    I am using JSF 1.1, Tomcat 4.1. I am facing a strange problem. If there happens some error on my jsp/jsf page once and any error message shown. I modify file, fix the problem and again load the page in browser. But the error continues to show as it was on first time. When I view the html source of this file from browser, I am shocked to see that same old html is being rendered. My modifications are not updated in it. First I thought it is due to browser settings, that cached page may be shown, but after testing from other machines it is confirmed that there is some problem at JSF engine level. that it continues to show the initial error prone version of page. I have restarted TOMCAT and even system. But unable to see the modified page.
    Please help me for this.
    Thanks,
    Zahida

    You may also clear the session. The error persists even after restarting tomcat because tomcat serialises sessions.
    Create a simple jsp page to clear the session:
    <%
    session.invalidate();
    %>

  • Actions/submitting non JSF forms to JSF pages

    Ok, I am new to JSF so bear with me,
    I am trying to execute some logic BEFORE displaying a JSP/JSF page - a simple example of this is checking if user is logged in, or getting data for the page based on parameters passed in from a non-JSF page (or on URL line), or deciding which page to display, etc. In other words similar to struts action.
    Seems basic but I cant figure out how to do it without placing logic into JSPs. All examples I see seem to require a submit from a JSF page to get to the controller logic. What am I missing?
    Thanks.

    I decide the struggling is a sheer waste of time and hurts future reusability and maintainability.
    Write a set of JSF embedded JSPs from scratch.
    Or give a try to: https://facelets.dev.java.net/

  • JSF page 'Initial load' problem

    I've found several threads touching on this already, but none seem to have a solution.
    When JSF loads a JSP page for the first time, it goes through the restore view phase which creates an initial view (as there isn't a current one to restore). It then goes directly to the render response phase.
    My problem is, I have a JSP/JSF page that I pass paramaters to via html GET. For example:
    http://localhost:8080/jsf/region.jsp?locationForm:directorate=1&locationForm=locationForm
    Because the first load goes directly to the render response phase, the parsing of these paramaters is never done & the page does not update as expected.
    The second time you perform the same request, JSF goes through the standard request processing lifecycle and works as you would expect, setting directorate to 1 in the backing bean and displaying an updated page.
    Is there any way to change JSF's default behaviour on a JSP initial load to do the whole lifecycle? Is there another way to get around this, short of loading the page twice to ensure it has the right information in it (which would be quite a hack)?
    I need to use html GET (as opposed to html POST) because:
    I'm using a technique of a hidden iframe that loads dynamically created javascript to update a dropdown list (DDL) on the main page without reloading the page in its entirity. This is to minimise network chatter as the system will be run on a 56k network. I have an onchange event on my JSF DDL that calls javascript to reload the hidden iframe.

    Thanks for the replies.
    I tried both of the suggested options
    1. If your bean is managed (declared as managed bean in faces_config), you can set the initial value of the property as, for example, #{param.locationFor }.
    Unfortunately I can't use this option as the backing bean i'm using has to be session scope. This is because the DDL options are set by the iframe page, not the main page. There could be many request/responses between client/server before the user finally presses the submit button. If I change the backing bean to request scope, I end up getting "Validation Error: Value is not valid" for the DDL because the selected ID is not in the backing bean's list of possible values for the DDL.. #{param} can't be used for session level BBs.
    2. If you don't want to use the managed bean properties, you can go get your parameters in your bean's constructor.
    I'm unable to use this option either. The backing bean is shared between the main page and the hidden iframe page. When the main page loads, the backing bean's constructor is called but that isn't the time when parameters need to be parsed. When the iframe page is loaded for the first time (via javascript onchange on a DDL on the main page) using http://localhost/iframe.jsf?iframeForm:ddlId=1&iframeForm=iframeForm is when I need to parse the parameters, by which time the backing bean is already instanciated and the constructor has already been called.
    I'm looking at where else I could get the parameters other than the constructor. I might be able to do it elsewhere.
    My guess as to why the following code works is it's not using a backing bean & isn't updating backing bean values on the first run:
    <f:view>
    <h:outputText value="param= #{param}"/>
    </f:view>To replicate the problem, create a simple backing bean, for example:
    public class sample {
        private Integer selectedId
        public String getSelectedId() {
            return selectedId
        public void setSelectedId(Integer selectedId) {
            this.selectedId = selectedId;
    }Then create the following sample.jsp:
    <!doctype html public "-//w3c//dtd html 4.01 transitional//en">
    <!--
      Copyright 2004 ArcMind, Inc. All Rights Reserved.
    -->
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
    <head>
    <f:view>
      <h:form id="iframeForm">
        <h:panelGroup>
          <h:inputText id="selectedId" value="#{sample.selectedId}" />
        </h:panelGroup>
      </h:form>
    </f:view>
    </head>
    </html>Then try going to sample.jsp?iframeForm:selectedId=10&iframeForm=iframeForm (Similar to the request my main page is doing via javascript to populate the hidden iframe)
    The first time you do this, the text box will be populated with 0 (ie, it skipped the JSF lifecycle and ignored your 10 input). The second time and subsequent times it works as expected, with the text box containing the number 10.

  • JSF page not rendered in Design View (JDev 11.1.2.1.0)

    Hi!
    Recently strange behavior in JDeveloper 11.1.2.1.0) begins: JSF pages in some projects are not rendered anymore. We enabled "Show Design time Messages in log" in JDev Tools/Preferences/JSP and HTML Visual editor and message
    WARNING: A problem was encountered executing the page.  Using fallback rendering is shown in log. This is visible on this snapshot:
    [http://dl.dropbox.com/u/14304804/design_view_problem.jpg|http://dl.dropbox.com/u/14304804/design_view_problem.jpg]
    What is common to all of the projects with this issue is that we run "Remove ADF Security Configuration" which was enabled before and we implemented our custom security using phase-listener.
    Any idea what is wrong here?
    Regards,
    Sašo
    Edited by: Sašo C. on May 21, 2012 2:24 PM

    It's a limitation, if you will, of the way JDeveloper works. It essentially runs your JSF page in order to get the rendering. At design time, the phase listener is obviously messing things up since you're not in a proper secured environment - hence the workaround to bypass your phase listener at design time.

  • JSF tags are not rendered in error page

    I have configured error page for HTTP 404 error in web.xml like this
    <error-page>
    <error-code>404</error-code>
    <location>/Common/error.jspx</location>
    </error-page>
    Faces Servlet is configured as follows
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    My error page (error.jspx) looks like this
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html" xmlns:trh="http://myfaces.apache.org/trinidad/html"
    xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:c="http://java.sun.com/jsp/jstl/core">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <html>
    <head>
    <title>Error Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </head>
    <body id="b1">
    <h4 style="color:red">An Error Occured. Please click Back button or Signout.</h4>
    <input type="button" value="Back" onclick="history.back()"/>
    <tr:commandButton id="cb1" text="SIGN OUT" action="exit" actionListener="#{Login.LogOut}"/>
    </body>
    </html>
    </jsp:root>
    When I deploy application and run into 404 error, page displays error message with only Back button. I don't see SingOut button. I have checked url and it follows /faces/* pattern. Still to double check, I made a change and configured servlet mapping in web.xml as
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    Still commandButton is not rendered. I understand that my error page don't have access to FacesContext or not going through Faces Servlet. I know this is a small issue, but couldn't figure out what can be done. I have also tried using .xhtml and .jsf as per googled suggestion. But no luck
    I have tried different solutions to my problem and googled for solutions. But I couldn't get it resolved.
    So can you please provide any suggestions...
    Edited by: user1818355 on May 22, 2013 2:29 PM

    I think my faces servlet is configured to handle URLs having /faces/* pattern. I don't have any folder named with faces but I can access all my web pages which have /faces/ in their url. All jspx pages in application are configured in task flows. So I think they have access in FacesContext. But error page is configured in only web.xml and some how it is missing access to FacesContext and not rendering JSF tags. Any help?

  • JSF Page is not  rendering correctly on NON JSF Action

    Hi All,
    When I go from JSF actions (clicking HtmlCommandButton HtmlActionLink), I am getting the correct page. But when I come from non jsf actions say if I come through by clicking normal anchor tag or javascript action or normal html submit button, I am getting same old rendered page. How can I overcome this problem??
    Thanks
    Sudhakar

    I am getting same old rendered pageIn otherwords, page is not getting refreshed and contains old data

  • How to get rendered JSF page (send it as HTML email)

    Hello,
    I would like to send notification email in my application. Could you please help me to find a way how to get HTML result of JSF page as string-file-stream. Simply anything I could handle and use it as email body or attachment.
    My use case: User click to button (raise a action) which change something in DB and confirmation.xhtml(.jsf) is shown to him to confirm that this action was succesful. And I would like to send notification email to all other users with this page (simplified version).
    I need a something like String getJsfPage(String url) but I could not find anything in JSF API.
    Thanks for any clue.

    quote gimbal2: +...now write the code to generate the email body...+
    Thanks for reply...
    Is that mean that I could not use already written code (confirmation.xhtml)? The beuty on JSF is that JSF parser take care about CSS styles, EL, templating (ui: ...), ... When anybody (administrators) wants to change how this email looks - just change this XHTML file.
    How should I write email body? I thought about several way but nothing what looks good:
    - I really dont want to use StringBuilder do build HTML.
    - I dont want to write my own parser of .xhtml template (confirmation.xhtml).
    - Write HTML (xml) template and parse it with XSLT transformation seems to me acceptable but complicated. Needs a special library to perform XSLT, complicated template service (future changes)
    - JSP page, more-or-less the same problems like JSF page
    The sad is that this email (html) body is quite small but highly dynamic (css, language of texts, logos...).

  • Jsf page not rendering in Jdeveloper

    Hello. I am using jdeveloper 11.1.2.2. I was working on an application this evening, and added a new jsff page. When I opened the page, I got the "waiting for designer to render" then it stopped, and all I see is white.
    I am able to add components to the page via the structure window, but I cannot see what the form looks like in the design view. The the problem started hitting the other jspx form I have in the application.
    I read somewhere about someone having the same problem and I tried renaming the windowinglayout.xml, and re-opened jdeveloper, but it did not solve the problem.
    This has happened before. I wiped out the system directory, and that works, but wiping out the system directory is painful. Are there any intelligent solutions?
    Thank you,
    Stuart

    I tried renaming the system directory, opening jdeveloper, opening the jsf page -- it rendered. So I then went to the system directory and found the windowinglayout.xml and backed it up.
    then I deleted out the new system directory, and the renamed back the old system directory. Found the windowinglayout.xml and replaced it with the good file.
    Opened Jdeveloper and the jsf page. Did some work and soon the render failed again.
    I am not sure if this is relevant...but the log shows this:
    Oct 16, 2012 9:47:44 PM oracle.security.jps.util.JpsUtil disableAudit
    INFO: JpsUtil: isAuditDisabled set to true
    Oct 16, 2012 9:47:56 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Initializing Mojarra 2.0.9 (SNAPSHOT 20120202) for context ''
    Oct 16, 2012 9:47:58 PM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
    Oct 16, 2012 9:47:59 PM org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl _checkTimestamp
    WARNING: Apache Trinidad is running with time-stamp checking enabled. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
    Oct 16, 2012 9:47:59 PM oracle.adfinternal.view.faces.lifecycle.LifecycleImpl _initializeTrinidadFrameBustingAppMapValue
    WARNING: The framebusting context param 'oracle.adf.view.rich.security.FRAME_BUSTING' has been deprecated. Please change your web.xml to use 'org.apache.myfaces.trinidad.security.FRAME_BUSTING' instead. The legal values are 'always', 'never', and 'differentOrigin'. If you were setting the value of 'oracle.adf.view.rich.security.FRAME_BUSTING' to 'differentDomain', then please note that you should set 'org.apache.myfaces.trinidad.security.FRAME_BUSTING' to 'differentOrigin'.
    Oct 16, 2012 9:48:01 PM org.apache.myfaces.trinidad.component.UIXEditableValue _isBeanValidationAvailable
    WARNING: A Bean Validation provider is not present, therefore bean validation is disabled
    Oct 16, 2012 9:48:20 PM oracle.security.jps.internal.common.util.StrictValidationEventHandler handleEvent
    WARNING: Failed to validate the xml content. SchemaLocation: schemaLocation value = 'http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd' must have even number of URI's. Location: unavailable.
    Oct 16, 2012 9:48:20 PM oracle.security.jps.internal.common.util.StrictValidationEventHandler handleEvent
    WARNING: Failed to validate the xml content. SchemaLocation: schemaLocation value = 'http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd' must have even number of URI's. Location: unavailable.
    Oct 16, 2012 9:50:11 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Initializing Mojarra 2.0.9 (SNAPSHOT 20120202) for context ''
    Oct 16, 2012 9:50:12 PM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
    Oct 16, 2012 9:50:14 PM oracle.security.jps.internal.common.util.StrictValidationEventHandler handleEvent
    WARNING: Failed to validate the xml content. SchemaLocation: schemaLocation value = 'http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd' must have even number of URI's. Location: unavailable.
    Oct 16, 2012 9:50:14 PM oracle.security.jps.internal.common.util.StrictValidationEventHandler handleEvent
    WARNING: Failed to validate the xml content. SchemaLocation: schemaLocation value = 'http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd' must have even number of URI's. Location: unavailable.
    Oct 16, 2012 9:50:15 PM org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl _checkTimestamp
    WARNING: Apache Trinidad is running with time-stamp checking enabled. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
    Oct 16, 2012 9:50:15 PM oracle.adfinternal.view.faces.lifecycle.LifecycleImpl _initializeTrinidadFrameBustingAppMapValue
    WARNING: The framebusting context param 'oracle.adf.view.rich.security.FRAME_BUSTING' has been deprecated. Since there is a non-null value for the context param 'org.apache.myfaces.trinidad.security.FRAME_BUSTING' the value of 'oracle.adf.view.rich.security.FRAME_BUSTING' will be ignored. Please remove 'oracle.adf.view.rich.security.FRAME_BUSTING' from the web.xml.
    Oct 16, 2012 9:50:18 PM org.apache.myfaces.trinidad.component.UIXEditableValue _isBeanValidationAvailable
    WARNING: A Bean Validation provider is not present, therefore bean validation is disabled

Maybe you are looking for